mirror of https://github.com/flutter/samples.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.1 KiB
31 lines
1.1 KiB
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:platform_design/main.dart';
|
|
|
|
void main() {
|
|
testWidgets('Can change platform correctly', (tester) async {
|
|
await tester.pumpWidget(MyAdaptingApp());
|
|
|
|
// The test should be able to find the drawer button.
|
|
expect(find.byIcon(Icons.menu), findsOneWidget);
|
|
// There should be a refresh button.
|
|
expect(find.byIcon(Icons.refresh), findsOneWidget);
|
|
|
|
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
|
|
await tester.pumpWidget(MyAdaptingApp());
|
|
|
|
// There should now be a large title style nav bar.
|
|
expect(find.byType(CupertinoSliverNavigationBar), findsOneWidget);
|
|
// There's a tab button for the first tab.
|
|
expect(find.byIcon(CupertinoIcons.music_note), findsOneWidget);
|
|
// The hamburger button isn't there anymore.
|
|
expect(find.byIcon(Icons.menu), findsNothing);
|
|
|
|
// Since this is a static, undo the change made in the test.
|
|
debugDefaultTargetPlatformOverride = null;
|
|
});
|
|
}
|