Make compact Dock persistent and support week swipes
This commit is contained in:
@@ -9,46 +9,46 @@ import 'navigation_test.dart' show uiController;
|
||||
|
||||
void main() {
|
||||
setUpAll(tzdata.initializeTimeZones);
|
||||
testWidgets(
|
||||
'glass cursor drags in both directions, taps work, body swipes do not navigate',
|
||||
(tester) async {
|
||||
final c = uiController();
|
||||
await c.initialize();
|
||||
await c.showDemo();
|
||||
await tester.pumpWidget(HepanApp(controller: c));
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(TimetablePage),
|
||||
matching: find.text('课表'),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(tester.getRect(find.text('周日')).right, lessThanOrEqualTo(800));
|
||||
await tester.drag(find.text('周三'), const Offset(-250, 0));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('登录学校账户'), findsNothing);
|
||||
await tester.drag(
|
||||
find.byKey(const Key('dock-cursor')),
|
||||
const Offset(185, 0),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('登录学校账户'), findsOneWidget);
|
||||
await tester.drag(find.text('连接学校课表'), const Offset(250, 0));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('登录学校账户'), findsOneWidget);
|
||||
await tester.drag(
|
||||
find.byKey(const Key('dock-cursor')),
|
||||
const Offset(-185, 0),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('示例课表'), findsOneWidget);
|
||||
await tester.tap(find.text('我的'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('登录学校账户'), findsOneWidget);
|
||||
c.dispose();
|
||||
},
|
||||
);
|
||||
testWidgets('dock drags switch tabs while body swipes only change week', (
|
||||
tester,
|
||||
) async {
|
||||
final c = uiController();
|
||||
await c.initialize();
|
||||
await c.showDemo();
|
||||
await tester.pumpWidget(HepanApp(controller: c));
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(TimetablePage),
|
||||
matching: find.text('课表'),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(tester.getRect(find.text('周日')).right, lessThanOrEqualTo(800));
|
||||
await tester.drag(find.text('周三'), const Offset(-250, 0));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('第 2 周'), findsOneWidget);
|
||||
expect(find.text('登录学校账户'), findsNothing);
|
||||
await tester.drag(
|
||||
find.byKey(const Key('dock-cursor')),
|
||||
const Offset(185, 0),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('登录学校账户'), findsOneWidget);
|
||||
await tester.drag(find.text('连接学校课表'), const Offset(250, 0));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('登录学校账户'), findsOneWidget);
|
||||
await tester.drag(
|
||||
find.byKey(const Key('dock-cursor')),
|
||||
const Offset(-185, 0),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('示例课表'), findsOneWidget);
|
||||
await tester.tap(find.text('我的'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('登录学校账户'), findsOneWidget);
|
||||
c.dispose();
|
||||
});
|
||||
testWidgets('cancelled cursor drag keeps selected tab', (tester) async {
|
||||
int selected = 0;
|
||||
await tester.pumpWidget(
|
||||
|
||||
Reference in New Issue
Block a user