test: 增加登录页面键盘弹出布局测试

This commit is contained in:
qzl
2026-03-10 17:45:08 +08:00
parent 339777dae3
commit b48f7abf72
2 changed files with 125 additions and 23 deletions
+24
View File
@@ -60,4 +60,28 @@ void main() {
expect((topSpace - bottomSpace).abs(), lessThanOrEqualTo(2));
});
testWidgets('Login screen does not overflow when keyboard is visible', (
WidgetTester tester,
) async {
final mockAuthBloc = MockAuthBloc();
when(() => mockAuthBloc.state).thenReturn(AuthInitial());
when(
() => mockAuthBloc.stream,
).thenAnswer((_) => Stream.value(AuthInitial()));
await tester.pumpWidget(
MediaQuery(
data: const MediaQueryData(
size: Size(390, 844),
viewInsets: EdgeInsets.only(bottom: 320),
),
child: LinksyApp(authBloc: mockAuthBloc),
),
);
await tester.pumpAndSettle();
expect(tester.takeException(), isNull);
expect(find.text('登录'), findsOneWidget);
});
}