fix Flutter shell platform defaults and tab state
This commit is contained in:
@@ -47,6 +47,41 @@ void main() {
|
||||
expect(find.text('Pipelines — Not implemented'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('Cupertino content stays inside safe area', (tester) async {
|
||||
tester.view.padding = const FakeViewPadding(top: 36, bottom: 28);
|
||||
addTearDown(tester.view.resetPadding);
|
||||
await tester.pumpWidget(const MyApp(cupertino: true));
|
||||
final tabBar = tester.getRect(find.byType(CupertinoTabBar));
|
||||
expect(tabBar.bottom, lessThanOrEqualTo(900 - 28));
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('destination state survives switching tabs', (tester) async {
|
||||
var builds = 0;
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: AdaptiveShell(
|
||||
destinationBodies: {
|
||||
AppDestination.pipelines: (_) => StatefulBuilder(
|
||||
builder: (context, setState) => TextButton(
|
||||
onPressed: () => setState(() => builds++),
|
||||
child: Text('Builds: $builds'),
|
||||
),
|
||||
),
|
||||
AppDestination.runs: (_) => const Text('Runs screen'),
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.tap(find.text('Builds: 0'));
|
||||
await tester.pump();
|
||||
await tester.tap(find.text('Runs').last);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Pipelines').last);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Builds: 1'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('destination content can be supplied by integration', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
Reference in New Issue
Block a user