- Lab app: proxy panel, node editor, configuration and detail pages, responsive layout, and related tests - Add meshport-socks crate and sing-box bridge scripts/docs - Add singbox_flutter binding and meshport_client_core package - FFI, VPN helper (unified mac path), and Android/macOS runner updates - Docs for architecture, client runtime, UI design, and validation - UI design output artifacts under outputs/ui Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
60 lines
2.4 KiB
Dart
60 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:meshport_client_core/meshport_client_core.dart';
|
|
import 'package:meshport_lab/app.dart';
|
|
import 'package:meshport_lab/features/configuration_pages.dart';
|
|
import 'package:meshport_lab/features/lab_screen.dart';
|
|
import 'package:meshport_lab/features/proxy_node_editor.dart';
|
|
|
|
void main() {
|
|
for (final width in [360.0, 800.0]) {
|
|
testWidgets('main tabs fit ${width}px with larger text', (tester) async {
|
|
tester.view.physicalSize = Size(width, 850);
|
|
tester.view.devicePixelRatio = 1;
|
|
addTearDown(tester.view.resetPhysicalSize);
|
|
addTearDown(tester.view.resetDevicePixelRatio);
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: meshPortTheme(),
|
|
builder: (context, child) => MediaQuery(
|
|
data: MediaQuery.of(
|
|
context,
|
|
).copyWith(textScaler: const TextScaler.linear(1.4)),
|
|
child: child!,
|
|
),
|
|
home: const LabScreen(initializeNative: false),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
expect(tester.takeException(), isNull);
|
|
for (final label in ['代理', '组网', '设置', '概览']) {
|
|
await tester.tap(find.text(label).last);
|
|
await tester.pumpAndSettle();
|
|
expect(tester.takeException(), isNull, reason: label);
|
|
}
|
|
});
|
|
}
|
|
testWidgets('forms keep fields apart at phone width', (tester) async {
|
|
tester.view.physicalSize = const Size(360, 850);
|
|
tester.view.devicePixelRatio = 1;
|
|
addTearDown(tester.view.resetPhysicalSize);
|
|
addTearDown(tester.view.resetDevicePixelRatio);
|
|
for (final page in <Widget>[
|
|
DnsPage(profile: ProxyProfile(), changed: () {}),
|
|
const ProxyNodeEditor(),
|
|
const RuleEditor(),
|
|
NetworkConfigPage(section: '基础配置', initial: const {}, save: (_) async {}),
|
|
]) {
|
|
await tester.pumpWidget(MaterialApp(theme: meshPortTheme(), home: page));
|
|
await tester.pumpAndSettle();
|
|
expect(tester.takeException(), isNull);
|
|
final fields = find.byType(TextField).evaluate().toList();
|
|
for (var i = 1; i < fields.length; i++) {
|
|
final previous = tester.getRect(find.byWidget(fields[i - 1].widget));
|
|
final current = tester.getRect(find.byWidget(fields[i].widget));
|
|
expect(current.top - previous.bottom, greaterThanOrEqualTo(12));
|
|
}
|
|
}
|
|
});
|
|
}
|