e25649cd27
- form_factor 触屏 tablet 阈值 600→900,对齐 design/ui_kits/tablet(1180×820 横屏 侧栏):iPad 横屏/12.9″竖屏走侧栏,标准/11″竖屏回落 mobile 底 Tab,避免双栏挤压 - form_factor_test 补全断点边界(900/899)与各 iPad 尺寸用例 - 新增 tablet_pages_golden_test:四视图×明暗×中英 12 张 golden,注入演示数据 (6 节点/周流量/30 天用量)让 2 列网格与周柱满渲染,作回归闸 - design/CONTRACT.md:tablet 像素契约(取自 tabapp.jsx)+ 逐屏验收清单 - 真机 iPad mini 6 视觉签核通过;141 测试全绿 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
39 lines
1.5 KiB
Dart
39 lines
1.5 KiB
Dart
import 'package:flutter/widgets.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pangolin_vpn/core/responsive/form_factor.dart';
|
|
|
|
Future<FormFactor> _ffAt(WidgetTester tester, Size size) async {
|
|
late FormFactor ff;
|
|
tester.view.physicalSize = size;
|
|
tester.view.devicePixelRatio = 1.0;
|
|
addTearDown(tester.view.reset);
|
|
await tester.pumpWidget(MediaQuery(
|
|
data: MediaQueryData.fromView(tester.view),
|
|
child: Builder(builder: (c) { ff = c.formFactor; return const SizedBox(); }),
|
|
));
|
|
return ff;
|
|
}
|
|
|
|
void main() {
|
|
// tablet 阈值 ≥900,对齐 iPad 设计源(横屏侧栏布局)。
|
|
testWidgets('iPad 横屏(1024) → tablet', (t) async {
|
|
expect(await _ffAt(t, const Size(1024, 768)), FormFactor.tablet);
|
|
});
|
|
testWidgets('iPad 12.9″ 竖屏(1024) → tablet', (t) async {
|
|
expect(await _ffAt(t, const Size(1024, 1366)), FormFactor.tablet);
|
|
});
|
|
testWidgets('iPad 11″ 竖屏(834) → mobile(窄屏回落底 Tab)', (t) async {
|
|
expect(await _ffAt(t, const Size(834, 1194)), FormFactor.mobile);
|
|
});
|
|
testWidgets('iPad 标准竖屏(768) → mobile', (t) async {
|
|
expect(await _ffAt(t, const Size(768, 1024)), FormFactor.mobile);
|
|
});
|
|
testWidgets('断点边界:900 → tablet, 899 → mobile', (t) async {
|
|
expect(await _ffAt(t, const Size(900, 1200)), FormFactor.tablet);
|
|
expect(await _ffAt(t, const Size(899, 1200)), FormFactor.mobile);
|
|
});
|
|
testWidgets('iPhone(390) → mobile', (t) async {
|
|
expect(await _ffAt(t, const Size(390, 844)), FormFactor.mobile);
|
|
});
|
|
}
|