|
|
|
|
@@ -5,6 +5,7 @@
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
|
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
|
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
|
group('SystemChrome - style', () {
|
|
|
|
|
@@ -37,8 +38,7 @@ void main() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
group('status bar', () {
|
|
|
|
|
testWidgets(
|
|
|
|
|
"statusBarColor isn't set for unannotated view",
|
|
|
|
|
testWidgetsWithLeakTracking("statusBarColor isn't set for unannotated view",
|
|
|
|
|
(WidgetTester tester) async {
|
|
|
|
|
await tester.pumpWidget(const SizedBox.expand());
|
|
|
|
|
await tester.pumpAndSettle();
|
|
|
|
|
@@ -47,8 +47,7 @@ void main() {
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
testWidgets(
|
|
|
|
|
'statusBarColor is set for annotated view',
|
|
|
|
|
testWidgetsWithLeakTracking('statusBarColor is set for annotated view',
|
|
|
|
|
(WidgetTester tester) async {
|
|
|
|
|
setupTestDevice(tester);
|
|
|
|
|
await tester.pumpWidget(const AnnotatedRegion<SystemUiOverlayStyle>(
|
|
|
|
|
@@ -67,8 +66,7 @@ void main() {
|
|
|
|
|
variant: TargetPlatformVariant.mobile(),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
testWidgets(
|
|
|
|
|
"statusBarColor isn't set when view covers less than half of the system status bar",
|
|
|
|
|
testWidgetsWithLeakTracking("statusBarColor isn't set when view covers less than half of the system status bar",
|
|
|
|
|
(WidgetTester tester) async {
|
|
|
|
|
setupTestDevice(tester);
|
|
|
|
|
const double lessThanHalfOfTheStatusBarHeight =
|
|
|
|
|
@@ -92,8 +90,7 @@ void main() {
|
|
|
|
|
variant: TargetPlatformVariant.mobile(),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
testWidgets(
|
|
|
|
|
'statusBarColor is set when view covers more than half of tye system status bar',
|
|
|
|
|
testWidgetsWithLeakTracking('statusBarColor is set when view covers more than half of tye system status bar',
|
|
|
|
|
(WidgetTester tester) async {
|
|
|
|
|
setupTestDevice(tester);
|
|
|
|
|
const double moreThanHalfOfTheStatusBarHeight =
|
|
|
|
|
@@ -122,8 +119,7 @@ void main() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
group('navigation color (Android only)', () {
|
|
|
|
|
testWidgets(
|
|
|
|
|
"systemNavigationBarColor isn't set for non Android device",
|
|
|
|
|
testWidgetsWithLeakTracking("systemNavigationBarColor isn't set for non Android device",
|
|
|
|
|
(WidgetTester tester) async {
|
|
|
|
|
setupTestDevice(tester);
|
|
|
|
|
await tester.pumpWidget(const AnnotatedRegion<SystemUiOverlayStyle>(
|
|
|
|
|
@@ -142,8 +138,7 @@ void main() {
|
|
|
|
|
variant: TargetPlatformVariant.only(TargetPlatform.iOS),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
testWidgets(
|
|
|
|
|
"systemNavigationBarColor isn't set for unannotated view",
|
|
|
|
|
testWidgetsWithLeakTracking("systemNavigationBarColor isn't set for unannotated view",
|
|
|
|
|
(WidgetTester tester) async {
|
|
|
|
|
await tester.pumpWidget(const SizedBox.expand());
|
|
|
|
|
await tester.pumpAndSettle();
|
|
|
|
|
@@ -153,8 +148,7 @@ void main() {
|
|
|
|
|
variant: TargetPlatformVariant.only(TargetPlatform.android),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
testWidgets(
|
|
|
|
|
'systemNavigationBarColor is set for annotated view',
|
|
|
|
|
testWidgetsWithLeakTracking('systemNavigationBarColor is set for annotated view',
|
|
|
|
|
(WidgetTester tester) async {
|
|
|
|
|
setupTestDevice(tester);
|
|
|
|
|
await tester.pumpWidget(const AnnotatedRegion<SystemUiOverlayStyle>(
|
|
|
|
|
@@ -173,8 +167,7 @@ void main() {
|
|
|
|
|
variant: TargetPlatformVariant.only(TargetPlatform.android),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
testWidgets(
|
|
|
|
|
"systemNavigationBarColor isn't set when view covers less than half of navigation bar",
|
|
|
|
|
testWidgetsWithLeakTracking("systemNavigationBarColor isn't set when view covers less than half of navigation bar",
|
|
|
|
|
(WidgetTester tester) async {
|
|
|
|
|
setupTestDevice(tester);
|
|
|
|
|
const double lessThanHalfOfTheNavigationBarHeight =
|
|
|
|
|
@@ -198,8 +191,7 @@ void main() {
|
|
|
|
|
variant: TargetPlatformVariant.only(TargetPlatform.android),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
testWidgets(
|
|
|
|
|
'systemNavigationBarColor is set when view covers more than half of navigation bar',
|
|
|
|
|
testWidgetsWithLeakTracking('systemNavigationBarColor is set when view covers more than half of navigation bar',
|
|
|
|
|
(WidgetTester tester) async {
|
|
|
|
|
setupTestDevice(tester);
|
|
|
|
|
const double moreThanHalfOfTheNavigationBarHeight =
|
|
|
|
|
@@ -227,7 +219,7 @@ void main() {
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testWidgets('Top AnnotatedRegion provides status bar overlay style and bottom AnnotatedRegion provides navigation bar overlay style', (WidgetTester tester) async {
|
|
|
|
|
testWidgetsWithLeakTracking('Top AnnotatedRegion provides status bar overlay style and bottom AnnotatedRegion provides navigation bar overlay style', (WidgetTester tester) async {
|
|
|
|
|
setupTestDevice(tester);
|
|
|
|
|
await tester.pumpWidget(
|
|
|
|
|
const Column(children: <Widget>[
|
|
|
|
|
@@ -253,7 +245,7 @@ void main() {
|
|
|
|
|
expect(SystemChrome.latestStyle?.systemNavigationBarColor, Colors.green);
|
|
|
|
|
}, variant: TargetPlatformVariant.only(TargetPlatform.android));
|
|
|
|
|
|
|
|
|
|
testWidgets('Top only AnnotatedRegion provides status bar and navigation bar style properties', (WidgetTester tester) async {
|
|
|
|
|
testWidgetsWithLeakTracking('Top only AnnotatedRegion provides status bar and navigation bar style properties', (WidgetTester tester) async {
|
|
|
|
|
setupTestDevice(tester);
|
|
|
|
|
await tester.pumpWidget(
|
|
|
|
|
const Column(children: <Widget>[
|
|
|
|
|
@@ -273,7 +265,7 @@ void main() {
|
|
|
|
|
expect(SystemChrome.latestStyle?.systemNavigationBarColor, Colors.blue);
|
|
|
|
|
}, variant: TargetPlatformVariant.only(TargetPlatform.android));
|
|
|
|
|
|
|
|
|
|
testWidgets('Bottom only AnnotatedRegion provides status bar and navigation bar style properties', (WidgetTester tester) async {
|
|
|
|
|
testWidgetsWithLeakTracking('Bottom only AnnotatedRegion provides status bar and navigation bar style properties', (WidgetTester tester) async {
|
|
|
|
|
setupTestDevice(tester);
|
|
|
|
|
await tester.pumpWidget(
|
|
|
|
|
const Column(children: <Widget>[
|
|
|
|
|
|