Files
pipelines/app/test/ui/adaptive/platform_test.dart
T
alan 8316b25029 Remove remaining Cupertino-only shell tests
Keep the Material coverage while removing tests for unreachable Cupertino hosts and variants from the shell cleanup.
2026-11-11 04:11:51 +00:00

31 lines
1.3 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/application/app.dart';
import 'package:pipelines_app/ui/adaptive/platform.dart';
import 'package:pipelines_app/ui/theme/app_theme.dart';
void main() {
test('no platform prefers the Cupertino host', () {
expect(prefersCupertino(), isFalse);
});
for (final platform in TargetPlatform.values) {
testWidgets('the app uses the Material host on $platform', (tester) async {
debugDefaultTargetPlatformOverride = platform;
addTearDown(() => debugDefaultTargetPlatformOverride = null);
await tester.pumpWidget(const MyApp());
expect(find.byType(MaterialApp), findsOneWidget);
expect(find.byType(CupertinoApp), findsNothing);
// Native hosts keep the target platform so Flutter's automatic
// behaviours (scroll physics, text selection, back-swipe) still apply.
final expected = kIsWeb ? TargetPlatform.android : platform;
expect(appLightTheme().platform, expected);
expect(appDarkTheme().platform, expected);
await tester.pumpWidget(const SizedBox.shrink());
debugDefaultTargetPlatformOverride = null;
});
}
}