2026-11-02 04:13:58 +00:00
|
|
|
namespace UCVL.VPNPlus;
|
|
|
|
|
|
|
|
|
|
internal sealed partial class MainForm
|
|
|
|
|
{
|
|
|
|
|
// UI fixture only: independent supplied values, no adapter/core/route reads.
|
|
|
|
|
internal Dictionary<string, bool> CheckTailnetTrafficUi()
|
|
|
|
|
{
|
|
|
|
|
var checks = new Dictionary<string, bool>();
|
|
|
|
|
var originalSize = ClientSize;
|
2026-11-03 15:15:23 +00:00
|
|
|
ClientSize = new Size(ScaleLogical(480), ScaleLogical(360));
|
|
|
|
|
SetTailnetTrafficVisibility(true);
|
|
|
|
|
SetNodeTrafficPermission(true);
|
|
|
|
|
LayoutDashboard();
|
|
|
|
|
checks["proxy_speed_row_spans_dashboard"] = _trafficCard.Left == _statusCard.Left
|
|
|
|
|
&& _trafficCard.Width == _statusCard.Width;
|
|
|
|
|
checks["cumulative_strip_keeps_plot_space"] = _dailyCard.Height <= ScaleLogical(40)
|
|
|
|
|
&& _trafficChart.Width >= ScaleLogical(340) && _speedTrendCard.Height >= ScaleLogical(45);
|
|
|
|
|
UpdateConnectedTransportPresentation(true);
|
|
|
|
|
DisplayTraffic(1024, 2048, "已计入代理总流量");
|
|
|
|
|
checks["proxy_total_always_includes_tailnet_stream"] = _uploadMetric.ValueText == "1.0"
|
|
|
|
|
&& _downloadMetric.ValueText == "2.0";
|
|
|
|
|
SetNodeTrafficPermission(false);
|
2026-11-02 04:13:58 +00:00
|
|
|
foreach (var size in new[] { new Size(480, 360), new Size(900, 360), new Size(960, 720), new Size(620, 550), new Size(900, 640) })
|
|
|
|
|
{
|
|
|
|
|
ClientSize = new Size(ScaleLogical(size.Width), ScaleLogical(size.Height));
|
|
|
|
|
SetTailnetTrafficVisibility(false); LayoutDashboard();
|
|
|
|
|
var baseline = (_trafficCard.Bounds, _dailyCard.Bounds, _footer.Bounds, _dashboardBody.Size);
|
|
|
|
|
checks[$"no_tailnet_single_left_{size.Width}"] = !_tailnetTrafficCard.Visible
|
2026-11-03 15:15:23 +00:00
|
|
|
&& _trafficCard.Width == _statusCard.Width && _speedTrendCard.Top > _dailyCard.Bottom;
|
2026-11-02 04:13:58 +00:00
|
|
|
SetTailnetTrafficVisibility(true);
|
|
|
|
|
checks[$"tailnet_only_subdivides_left_{size.Width}"] = _tailnetTrafficCard.Left == _trafficCard.Left
|
|
|
|
|
&& _tailnetTrafficCard.Width == _trafficCard.Width && _tailnetTrafficCard.Top > _trafficCard.Bottom
|
2026-11-03 15:15:23 +00:00
|
|
|
&& _dailyCard.Top > _tailnetTrafficCard.Bottom && _speedTrendCard.Top > _dailyCard.Bottom;
|
|
|
|
|
checks[$"tailnet_never_increases_page_{size.Width}"] = _footer.Bounds == baseline.Item3 && _dashboardBody.Size == baseline.Item4
|
2026-11-02 04:13:58 +00:00
|
|
|
&& !_dashboardScrollBar.Visible && _dashboardBody.Location == Point.Empty;
|
|
|
|
|
checks[$"all_card_controls_fit_{size.Width}"] = DashboardControlsFit();
|
2026-11-03 15:15:23 +00:00
|
|
|
using(var headingGraphics=_nodeCard.CreateGraphics())
|
|
|
|
|
checks[$"dense_headings_remain_complete_when_resized_{size.Width}"] = new[]
|
|
|
|
|
{ _nodeHeading, _routeHeading, _actualModeHeading, _trafficHeading, _dailyHeading }
|
|
|
|
|
.All(label=>TextRenderer.MeasureText(headingGraphics,label.Text,label.Font,Size.Empty,TextFormatFlags.SingleLine).Width<=label.Width);
|
2026-11-02 04:13:58 +00:00
|
|
|
SetTailnetTrafficVisibility(false);
|
|
|
|
|
checks[$"tailnet_hide_restores_geometry_{size.Width}"] = _trafficCard.Bounds == baseline.Item1
|
|
|
|
|
&& _dailyCard.Bounds == baseline.Item2 && _footer.Bounds == baseline.Item3;
|
|
|
|
|
}
|
|
|
|
|
ClientSize=new Size(ScaleLogical(480),ScaleLogical(360));
|
|
|
|
|
_connectionModeCombo.SelectedIndex=1;
|
|
|
|
|
if(_manualNodeCombo.Items.Count>0)_manualNodeCombo.SelectedIndex=0;
|
|
|
|
|
RefreshSelectionControls(); LayoutDashboard();
|
|
|
|
|
checks["half_size_manual_node_does_not_overlap_mode_selector"] = !_manualNodeCombo.Visible
|
|
|
|
|
|| (!_manualNodeCombo.Bounds.IntersectsWith(_connectionModeCombo.Bounds)
|
|
|
|
|
&& _manualNodeCombo.Bottom<=_nodeCard.Height);
|
|
|
|
|
_connectionModeCombo.SelectedIndex=0;
|
|
|
|
|
SetTailnetTrafficVisibility(true);
|
|
|
|
|
var proxyValue = _uploadMetric.ValueText;
|
|
|
|
|
var session = (_sessionUp, _sessionDown);
|
|
|
|
|
var curveCount = _trafficChart.PointCount;
|
|
|
|
|
DisplayTailnetTraffic(12345, 67890, "独立 UI 样本");
|
|
|
|
|
checks["tailnet_never_double_counts_session_or_curve"] = session == (_sessionUp, _sessionDown)
|
|
|
|
|
&& _trafficChart.PointCount == curveCount;
|
2026-11-03 15:15:23 +00:00
|
|
|
checks["tailnet_values_are_independent_controls"] = _tailnetUploadMetric.ValueText == "12.1"
|
2026-11-02 04:13:58 +00:00
|
|
|
&& _tailnetDownloadMetric.ValueText == "66.3" && _uploadMetric.ValueText == proxyValue;
|
|
|
|
|
checks["tailnet_scope_and_already_accounted_are_explicit"] = _tailnetSampleLabel.Text.StartsWith("仅纵横家链路 · ")
|
|
|
|
|
&& _tailnetUploadMetric.Hint == "已计入代理总流量";
|
|
|
|
|
DisplayTailnetTraffic(null, double.NaN, "采样不可用");
|
|
|
|
|
checks["tailnet_missing_samples_not_fake_zero"] = _tailnetUploadMetric.ValueText == "—"
|
|
|
|
|
&& _tailnetDownloadMetric.ValueText == "—";
|
|
|
|
|
DisplayTailnetTraffic(1, 2, "独立 UI 样本");
|
|
|
|
|
SetTailnetTrafficVisibility(false); SetTailnetTrafficVisibility(true);
|
|
|
|
|
checks["tailnet_hide_clears_previous_numbers"] = _tailnetUploadMetric.ValueText == "—"
|
|
|
|
|
&& _tailnetDownloadMetric.ValueText == "—";
|
|
|
|
|
checks["cumulative_is_numeric_only_proxy_has_speed_curve"] = !_dailyCard.Controls.OfType<TrafficChart>().Any()
|
|
|
|
|
&& !_trafficCard.Controls.OfType<TrafficChart>().Any()
|
|
|
|
|
&& !_tailnetTrafficCard.Controls.OfType<TrafficChart>().Any()
|
|
|
|
|
&& _speedTrendCard.Controls.OfType<TrafficChart>().Single() == _trafficChart
|
|
|
|
|
&& _dailyChart.Parent is null && !_dailyChart.Visible;
|
|
|
|
|
UpdateConnectedTransportPresentation(true);
|
|
|
|
|
DisplayTraffic(1024, 2048, "互斥入口样本");
|
|
|
|
|
DisplayTailnetTraffic(1024, 2048, "互斥入口样本");
|
2026-11-03 15:15:23 +00:00
|
|
|
checks["tailnet_sample_remains_in_overall_proxy_total"] = _uploadMetric.ValueText == "1.0"
|
|
|
|
|
&& _downloadMetric.ValueText == "2.0" && _tailnetUploadMetric.ValueText == "1.0"
|
|
|
|
|
&& _tailnetDownloadMetric.ValueText == "2.0" && session == (_sessionUp, _sessionDown);
|
2026-11-02 04:13:58 +00:00
|
|
|
checks["actual_tailnet_transport_shows_section"] = _currentNodeUsesTailnet && _tailnetTrafficVisible;
|
|
|
|
|
UpdateConnectedTransportPresentation(false);
|
|
|
|
|
DisplayTraffic(3072, 4096, "公网样本");
|
2026-11-03 15:15:23 +00:00
|
|
|
checks["public_sample_uses_only_public_speed_section"] = _uploadMetric.ValueText == "3.0" && _downloadMetric.ValueText == "4.0";
|
2026-11-02 04:13:58 +00:00
|
|
|
checks["public_transport_hides_section"] = !_currentNodeUsesTailnet && !_tailnetTrafficVisible;
|
|
|
|
|
using var curve = new TrafficChart();
|
|
|
|
|
var end = DateTimeOffset.Now;
|
|
|
|
|
for (var i = 0; i <= 720; i++) curve.Add(i, i * 2, end.AddSeconds((i - 720) * 5));
|
|
|
|
|
checks["speed_history_retains_actual_one_hour"] = curve.PointCount == 721;
|
|
|
|
|
curve.SetPeriodMinutes(1);
|
|
|
|
|
checks["one_minute_filter_uses_actual_samples"] = curve.VisiblePointCount == 13 && curve.PointCount == 721;
|
|
|
|
|
curve.SetPeriodMinutes(5);
|
|
|
|
|
checks["five_minute_filter_uses_actual_samples"] = curve.VisiblePointCount == 61;
|
|
|
|
|
curve.SetPeriodMinutes(15);
|
|
|
|
|
checks["fifteen_minute_filter_uses_actual_samples"] = curve.VisiblePointCount == 181;
|
|
|
|
|
curve.SetPeriodMinutes(60);
|
|
|
|
|
checks["hour_filter_preserves_available_samples"] = curve.VisiblePointCount == 721;
|
|
|
|
|
curve.Add(1, 2, end.AddSeconds(5));
|
|
|
|
|
checks["old_samples_expire_at_one_hour"] = curve.PointCount == 721;
|
|
|
|
|
curve.Reset();
|
|
|
|
|
checks["speed_history_reset_has_no_fabricated_samples"] = curve.PointCount == 0 && curve.VisiblePointCount == 0;
|
|
|
|
|
ClientSize = originalSize; LayoutDashboard();
|
|
|
|
|
checks["fitted_geometry_448_viewport_dpi_cases"] = DashboardLayout.SelfTest();
|
|
|
|
|
checks["card_surface_remains_half_transparent"] = CardPanel.SurfaceAlpha == 128;
|
|
|
|
|
return checks;
|
|
|
|
|
}
|
|
|
|
|
}
|