Unverified Commit 219efce7 authored by Polina Cherkasova's avatar Polina Cherkasova Committed by GitHub

Cover more tests with leak tracking. (#134363)

parent 6de4e169
...@@ -1460,7 +1460,7 @@ void main() { ...@@ -1460,7 +1460,7 @@ void main() {
expect(find.text('Exception: Injected failure'), findsOneWidget); expect(find.text('Exception: Injected failure'), findsOneWidget);
}); });
testWidgets('Material2 - LicensePage master view layout position - ltr', (WidgetTester tester) async { testWidgetsWithLeakTracking('Material2 - LicensePage master view layout position - ltr', (WidgetTester tester) async {
const TextDirection textDirection = TextDirection.ltr; const TextDirection textDirection = TextDirection.ltr;
const Size defaultSize = Size(800.0, 600.0); const Size defaultSize = Size(800.0, 600.0);
const Size wideSize = Size(1200.0, 600.0); const Size wideSize = Size(1200.0, 600.0);
...@@ -1592,7 +1592,7 @@ void main() { ...@@ -1592,7 +1592,7 @@ void main() {
expect(tester.getCenter(find.byType(ListView)), const Offset(160, 356)); expect(tester.getCenter(find.byType(ListView)), const Offset(160, 356));
}); });
testWidgets('Material2 - LicensePage master view layout position - rtl', (WidgetTester tester) async { testWidgetsWithLeakTracking('Material2 - LicensePage master view layout position - rtl', (WidgetTester tester) async {
const TextDirection textDirection = TextDirection.rtl; const TextDirection textDirection = TextDirection.rtl;
const Size defaultSize = Size(800.0, 600.0); const Size defaultSize = Size(800.0, 600.0);
const Size wideSize = Size(1200.0, 600.0); const Size wideSize = Size(1200.0, 600.0);
...@@ -1657,7 +1657,7 @@ void main() { ...@@ -1657,7 +1657,7 @@ void main() {
expect(tester.getCenter(find.byType(ListView)), const Offset(1040.0, 356.0)); expect(tester.getCenter(find.byType(ListView)), const Offset(1040.0, 356.0));
}); });
testWidgets('Material3 - LicensePage master view layout position - rtl', (WidgetTester tester) async { testWidgetsWithLeakTracking('Material3 - LicensePage master view layout position - rtl', (WidgetTester tester) async {
const TextDirection textDirection = TextDirection.rtl; const TextDirection textDirection = TextDirection.rtl;
const Size defaultSize = Size(800.0, 600.0); const Size defaultSize = Size(800.0, 600.0);
const Size wideSize = Size(1200.0, 600.0); const Size wideSize = Size(1200.0, 600.0);
...@@ -1724,7 +1724,7 @@ void main() { ...@@ -1724,7 +1724,7 @@ void main() {
expect(tester.getCenter(find.byType(ListView)), const Offset(1040.0, 356.0)); expect(tester.getCenter(find.byType(ListView)), const Offset(1040.0, 356.0));
}); });
testWidgets('License page title in lateral UI does not use AppBarTheme.foregroundColor', (WidgetTester tester) async { testWidgetsWithLeakTracking('License page title in lateral UI does not use AppBarTheme.foregroundColor', (WidgetTester tester) async {
// This is a regression test for https://github.com/flutter/flutter/issues/108991 // This is a regression test for https://github.com/flutter/flutter/issues/108991
final ThemeData theme = ThemeData( final ThemeData theme = ThemeData(
appBarTheme: const AppBarTheme(foregroundColor: Color(0xFFFFFFFF)), appBarTheme: const AppBarTheme(foregroundColor: Color(0xFFFFFFFF)),
......
...@@ -170,7 +170,7 @@ void main() { ...@@ -170,7 +170,7 @@ void main() {
expect(material.clipBehavior, clipBehavior); expect(material.clipBehavior, clipBehavior);
}); });
testWidgets('Modal bottom sheet-specific parameters are used for modal bottom sheets', (WidgetTester tester) async { testWidgetsWithLeakTracking('Modal bottom sheet-specific parameters are used for modal bottom sheets', (WidgetTester tester) async {
const double modalElevation = 5.0; const double modalElevation = 5.0;
const double persistentElevation = 7.0; const double persistentElevation = 7.0;
const Color modalBackgroundColor = Colors.yellow; const Color modalBackgroundColor = Colors.yellow;
...@@ -249,7 +249,7 @@ void main() { ...@@ -249,7 +249,7 @@ void main() {
expect(material.color, null); expect(material.color, null);
}); });
testWidgets('Modal bottom sheets respond to theme changes', (WidgetTester tester) async { testWidgetsWithLeakTracking('Modal bottom sheets respond to theme changes', (WidgetTester tester) async {
const double lightElevation = 5.0; const double lightElevation = 5.0;
const double darkElevation = 3.0; const double darkElevation = 3.0;
const Color lightBackgroundColor = Colors.green; const Color lightBackgroundColor = Colors.green;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
void main() { void main() {
...@@ -67,7 +68,7 @@ void main() { ...@@ -67,7 +68,7 @@ void main() {
expect(theme.colorScheme, const ColorScheme.dark()); expect(theme.colorScheme, const ColorScheme.dark());
}); });
testWidgets('ButtonTheme alignedDropdown', (WidgetTester tester) async { testWidgetsWithLeakTracking('ButtonTheme alignedDropdown', (WidgetTester tester) async {
final Key dropdownKey = UniqueKey(); final Key dropdownKey = UniqueKey();
Widget buildFrame({ required bool alignedDropdown, required TextDirection textDirection }) { Widget buildFrame({ required bool alignedDropdown, required TextDirection textDirection }) {
......
...@@ -213,7 +213,7 @@ void main() { ...@@ -213,7 +213,7 @@ void main() {
expect(state.isEndDrawerOpen, equals(false)); expect(state.isEndDrawerOpen, equals(false));
}); });
testWidgets('Scaffold.drawer - null restorationId ', (WidgetTester tester) async { testWidgetsWithLeakTracking('Scaffold.drawer - null restorationId ', (WidgetTester tester) async {
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
...@@ -236,7 +236,7 @@ void main() { ...@@ -236,7 +236,7 @@ void main() {
expect(find.text('drawer'), findsNothing); expect(find.text('drawer'), findsNothing);
}); });
testWidgets('Scaffold.endDrawer - null restorationId ', (WidgetTester tester) async { testWidgetsWithLeakTracking('Scaffold.endDrawer - null restorationId ', (WidgetTester tester) async {
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
...@@ -259,7 +259,7 @@ void main() { ...@@ -259,7 +259,7 @@ void main() {
expect(find.text('endDrawer'), findsNothing); expect(find.text('endDrawer'), findsNothing);
}); });
testWidgets('Scaffold.drawer state restoration test', (WidgetTester tester) async { testWidgetsWithLeakTracking('Scaffold.drawer state restoration test', (WidgetTester tester) async {
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
...@@ -290,7 +290,7 @@ void main() { ...@@ -290,7 +290,7 @@ void main() {
expect(find.text('drawer'), findsOneWidget); expect(find.text('drawer'), findsOneWidget);
}); });
testWidgets('Scaffold.endDrawer state restoration test', (WidgetTester tester) async { testWidgetsWithLeakTracking('Scaffold.endDrawer state restoration test', (WidgetTester tester) async {
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
...@@ -321,7 +321,7 @@ void main() { ...@@ -321,7 +321,7 @@ void main() {
expect(find.text('endDrawer'), findsOneWidget); expect(find.text('endDrawer'), findsOneWidget);
}); });
testWidgets('Both drawer and endDrawer state restoration test', (WidgetTester tester) async { testWidgetsWithLeakTracking('Both drawer and endDrawer state restoration test', (WidgetTester tester) async {
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
......
...@@ -43,7 +43,7 @@ void main() { ...@@ -43,7 +43,7 @@ void main() {
expect(description, <String>[]); expect(description, <String>[]);
}); });
testWidgets('With no other configuration, defaults are used', (WidgetTester tester) async { testWidgetsWithLeakTracking('With no other configuration, defaults are used', (WidgetTester tester) async {
final ThemeData themeData = ThemeData(); final ThemeData themeData = ThemeData();
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
...@@ -179,7 +179,7 @@ void main() { ...@@ -179,7 +179,7 @@ void main() {
expect(material.textStyle?.color, theme.colorScheme.onSurface); expect(material.textStyle?.color, theme.colorScheme.onSurface);
}); });
testWidgets('DropdownMenuTheme overrides ThemeData and defaults', (WidgetTester tester) async { testWidgetsWithLeakTracking('DropdownMenuTheme overrides ThemeData and defaults', (WidgetTester tester) async {
final DropdownMenuThemeData global = DropdownMenuThemeData( final DropdownMenuThemeData global = DropdownMenuThemeData(
textStyle: TextStyle( textStyle: TextStyle(
color: Colors.orange, color: Colors.orange,
...@@ -282,7 +282,7 @@ void main() { ...@@ -282,7 +282,7 @@ void main() {
expect(material.textStyle?.color, theme.colorScheme.onSurface); expect(material.textStyle?.color, theme.colorScheme.onSurface);
}); });
testWidgets('Widget parameters overrides DropdownMenuTheme, ThemeData and defaults', (WidgetTester tester) async { testWidgetsWithLeakTracking('Widget parameters overrides DropdownMenuTheme, ThemeData and defaults', (WidgetTester tester) async {
final DropdownMenuThemeData global = DropdownMenuThemeData( final DropdownMenuThemeData global = DropdownMenuThemeData(
textStyle: TextStyle( textStyle: TextStyle(
color: Colors.orange, color: Colors.orange,
......
...@@ -160,7 +160,7 @@ void main() { ...@@ -160,7 +160,7 @@ void main() {
expect(material.type, MaterialType.button); expect(material.type, MaterialType.button);
}); });
testWidgets('Default ElevatedButton meets a11y contrast guidelines', (WidgetTester tester) async { testWidgetsWithLeakTracking('Default ElevatedButton meets a11y contrast guidelines', (WidgetTester tester) async {
final FocusNode focusNode = FocusNode(); final FocusNode focusNode = FocusNode();
await tester.pumpWidget( await tester.pumpWidget(
......
...@@ -237,7 +237,7 @@ void main() { ...@@ -237,7 +237,7 @@ void main() {
expect(material.type, MaterialType.button); expect(material.type, MaterialType.button);
}); });
testWidgets('Default FilledButton meets a11y contrast guidelines', (WidgetTester tester) async { testWidgetsWithLeakTracking('Default FilledButton meets a11y contrast guidelines', (WidgetTester tester) async {
final FocusNode focusNode = FocusNode(); final FocusNode focusNode = FocusNode();
addTearDown(focusNode.dispose); addTearDown(focusNode.dispose);
...@@ -1750,7 +1750,7 @@ void main() { ...@@ -1750,7 +1750,7 @@ void main() {
expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic); expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic);
}); });
testWidgets('FilledButton in SelectionArea changes mouse cursor when hovered', (WidgetTester tester) async { testWidgetsWithLeakTracking('FilledButton in SelectionArea changes mouse cursor when hovered', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/104595. // Regression test for https://github.com/flutter/flutter/issues/104595.
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
home: SelectionArea( home: SelectionArea(
......
...@@ -184,7 +184,7 @@ void main() { ...@@ -184,7 +184,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
}); });
testWidgets('interrupting motion towards the StartTop location.', (WidgetTester tester) async { testWidgetsWithLeakTracking('interrupting motion towards the StartTop location.', (WidgetTester tester) async {
await tester.pumpWidget(_buildFrame(location: FloatingActionButtonLocation.centerFloat, listener: geometryListener)); await tester.pumpWidget(_buildFrame(location: FloatingActionButtonLocation.centerFloat, listener: geometryListener));
setupListener(tester); setupListener(tester);
...@@ -197,7 +197,7 @@ void main() { ...@@ -197,7 +197,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
}); });
testWidgets('interrupting entrance to remove the fab.', (WidgetTester tester) async { testWidgetsWithLeakTracking('interrupting entrance to remove the fab.', (WidgetTester tester) async {
await tester.pumpWidget(_buildFrame(fab: null, location: FloatingActionButtonLocation.centerFloat, listener: geometryListener)); await tester.pumpWidget(_buildFrame(fab: null, location: FloatingActionButtonLocation.centerFloat, listener: geometryListener));
setupListener(tester); setupListener(tester);
...@@ -216,7 +216,7 @@ void main() { ...@@ -216,7 +216,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
}); });
testWidgets('interrupting entrance of a new fab.', (WidgetTester tester) async { testWidgetsWithLeakTracking('interrupting entrance of a new fab.', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
_buildFrame( _buildFrame(
fab: null, fab: null,
...@@ -409,7 +409,7 @@ void main() { ...@@ -409,7 +409,7 @@ void main() {
expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_rightOffsetX, _topOffsetY)); expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_rightOffsetX, _topOffsetY));
}); });
testWidgets('startFloat', (WidgetTester tester) async { testWidgetsWithLeakTracking('startFloat', (WidgetTester tester) async {
await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.startFloat)); await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.startFloat));
expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_leftOffsetX, _floatOffsetY)); expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_leftOffsetX, _floatOffsetY));
...@@ -421,25 +421,25 @@ void main() { ...@@ -421,25 +421,25 @@ void main() {
expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_centerOffsetX, _floatOffsetY)); expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_centerOffsetX, _floatOffsetY));
}); });
testWidgets('endFloat', (WidgetTester tester) async { testWidgetsWithLeakTracking('endFloat', (WidgetTester tester) async {
await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.endFloat)); await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.endFloat));
expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_rightOffsetX, _floatOffsetY)); expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_rightOffsetX, _floatOffsetY));
}); });
testWidgets('startDocked', (WidgetTester tester) async { testWidgetsWithLeakTracking('startDocked', (WidgetTester tester) async {
await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.startDocked)); await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.startDocked));
expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_leftOffsetX, _dockedOffsetY)); expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_leftOffsetX, _dockedOffsetY));
}); });
testWidgets('centerDocked', (WidgetTester tester) async { testWidgetsWithLeakTracking('centerDocked', (WidgetTester tester) async {
await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.centerDocked)); await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.centerDocked));
expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_centerOffsetX, _dockedOffsetY)); expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_centerOffsetX, _dockedOffsetY));
}); });
testWidgets('endDocked', (WidgetTester tester) async { testWidgetsWithLeakTracking('endDocked', (WidgetTester tester) async {
await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.endDocked)); await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.endDocked));
expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_rightOffsetX, _dockedOffsetY)); expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_rightOffsetX, _dockedOffsetY));
...@@ -463,31 +463,31 @@ void main() { ...@@ -463,31 +463,31 @@ void main() {
expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_miniRightOffsetX, _topOffsetY)); expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_miniRightOffsetX, _topOffsetY));
}); });
testWidgets('miniStartFloat', (WidgetTester tester) async { testWidgetsWithLeakTracking('miniStartFloat', (WidgetTester tester) async {
await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.miniStartFloat)); await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.miniStartFloat));
expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_miniLeftOffsetX, _miniFloatOffsetY)); expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_miniLeftOffsetX, _miniFloatOffsetY));
}); });
testWidgets('miniCenterFloat', (WidgetTester tester) async { testWidgetsWithLeakTracking('miniCenterFloat', (WidgetTester tester) async {
await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.miniCenterFloat)); await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.miniCenterFloat));
expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_centerOffsetX, _miniFloatOffsetY)); expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_centerOffsetX, _miniFloatOffsetY));
}); });
testWidgets('miniEndFloat', (WidgetTester tester) async { testWidgetsWithLeakTracking('miniEndFloat', (WidgetTester tester) async {
await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.miniEndFloat)); await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.miniEndFloat));
expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_miniRightOffsetX, _miniFloatOffsetY)); expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_miniRightOffsetX, _miniFloatOffsetY));
}); });
testWidgets('miniStartDocked', (WidgetTester tester) async { testWidgetsWithLeakTracking('miniStartDocked', (WidgetTester tester) async {
await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.miniStartDocked)); await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.miniStartDocked));
expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_miniLeftOffsetX, _dockedOffsetY)); expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_miniLeftOffsetX, _dockedOffsetY));
}); });
testWidgets('miniEndDocked', (WidgetTester tester) async { testWidgetsWithLeakTracking('miniEndDocked', (WidgetTester tester) async {
await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.miniEndDocked)); await tester.pumpWidget(_singleFabScaffold(FloatingActionButtonLocation.miniEndDocked));
expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_miniRightOffsetX, _dockedOffsetY)); expect(tester.getCenter(find.byType(FloatingActionButton)), const Offset(_miniRightOffsetX, _dockedOffsetY));
...@@ -1000,7 +1000,7 @@ void main() { ...@@ -1000,7 +1000,7 @@ void main() {
); );
} }
testWidgets('startFloat', (WidgetTester tester) async { testWidgetsWithLeakTracking('startFloat', (WidgetTester tester) async {
const Rect defaultRect = Rect.fromLTRB(16.0, 478.0, 72.0, 534.0); const Rect defaultRect = Rect.fromLTRB(16.0, 478.0, 72.0, 534.0);
// Positioned relative to BottomNavigationBar // Positioned relative to BottomNavigationBar
const Rect bottomNavigationBarRect = Rect.fromLTRB(16.0, 422.0, 72.0, 478.0); const Rect bottomNavigationBarRect = Rect.fromLTRB(16.0, 422.0, 72.0, 478.0);
...@@ -1018,7 +1018,7 @@ void main() { ...@@ -1018,7 +1018,7 @@ void main() {
); );
}); });
testWidgets('miniStartFloat', (WidgetTester tester) async { testWidgetsWithLeakTracking('miniStartFloat', (WidgetTester tester) async {
const Rect defaultRect = Rect.fromLTRB(12.0, 490.0, 60.0, 538.0); const Rect defaultRect = Rect.fromLTRB(12.0, 490.0, 60.0, 538.0);
// Positioned relative to BottomNavigationBar // Positioned relative to BottomNavigationBar
const Rect bottomNavigationBarRect = Rect.fromLTRB(12.0, 434.0, 60.0, 482.0); const Rect bottomNavigationBarRect = Rect.fromLTRB(12.0, 434.0, 60.0, 482.0);
...@@ -1055,7 +1055,7 @@ void main() { ...@@ -1055,7 +1055,7 @@ void main() {
); );
}); });
testWidgets('miniCenterFloat', (WidgetTester tester) async { testWidgetsWithLeakTracking('miniCenterFloat', (WidgetTester tester) async {
const Rect defaultRect = Rect.fromLTRB(376.0, 490.0, 424.0, 538.0); const Rect defaultRect = Rect.fromLTRB(376.0, 490.0, 424.0, 538.0);
// Positioned relative to BottomNavigationBar // Positioned relative to BottomNavigationBar
const Rect bottomNavigationBarRect = Rect.fromLTRB(376.0, 434.0, 424.0, 482.0); const Rect bottomNavigationBarRect = Rect.fromLTRB(376.0, 434.0, 424.0, 482.0);
...@@ -1074,7 +1074,7 @@ void main() { ...@@ -1074,7 +1074,7 @@ void main() {
); );
}); });
testWidgets('endFloat', (WidgetTester tester) async { testWidgetsWithLeakTracking('endFloat', (WidgetTester tester) async {
const Rect defaultRect = Rect.fromLTRB(728.0, 478.0, 784.0, 534.0); const Rect defaultRect = Rect.fromLTRB(728.0, 478.0, 784.0, 534.0);
// Positioned relative to BottomNavigationBar // Positioned relative to BottomNavigationBar
const Rect bottomNavigationBarRect = Rect.fromLTRB(728.0, 422.0, 784.0, 478.0); const Rect bottomNavigationBarRect = Rect.fromLTRB(728.0, 422.0, 784.0, 478.0);
...@@ -1092,7 +1092,7 @@ void main() { ...@@ -1092,7 +1092,7 @@ void main() {
); );
}); });
testWidgets('miniEndFloat', (WidgetTester tester) async { testWidgetsWithLeakTracking('miniEndFloat', (WidgetTester tester) async {
const Rect defaultRect = Rect.fromLTRB(740.0, 490.0, 788.0, 538.0); const Rect defaultRect = Rect.fromLTRB(740.0, 490.0, 788.0, 538.0);
// Positioned relative to BottomNavigationBar // Positioned relative to BottomNavigationBar
const Rect bottomNavigationBarRect = Rect.fromLTRB(740.0, 434.0, 788.0, 482.0); const Rect bottomNavigationBarRect = Rect.fromLTRB(740.0, 434.0, 788.0, 482.0);
...@@ -1363,7 +1363,7 @@ void main() { ...@@ -1363,7 +1363,7 @@ void main() {
); );
} }
testWidgets('startDocked', (WidgetTester tester) async { testWidgetsWithLeakTracking('startDocked', (WidgetTester tester) async {
const Rect defaultRect = Rect.fromLTRB(16.0, 494.0, 72.0, 550.0); const Rect defaultRect = Rect.fromLTRB(16.0, 494.0, 72.0, 550.0);
// Positioned relative to BottomNavigationBar // Positioned relative to BottomNavigationBar
const Rect bottomNavigationBarRect = Rect.fromLTRB(16.0, 466.0, 72.0, 522.0); const Rect bottomNavigationBarRect = Rect.fromLTRB(16.0, 466.0, 72.0, 522.0);
...@@ -1381,7 +1381,7 @@ void main() { ...@@ -1381,7 +1381,7 @@ void main() {
); );
}); });
testWidgets('miniStartDocked', (WidgetTester tester) async { testWidgetsWithLeakTracking('miniStartDocked', (WidgetTester tester) async {
const Rect defaultRect = Rect.fromLTRB(12.0, 502.0, 60.0, 550.0); const Rect defaultRect = Rect.fromLTRB(12.0, 502.0, 60.0, 550.0);
// Positioned relative to BottomNavigationBar // Positioned relative to BottomNavigationBar
const Rect bottomNavigationBarRect = Rect.fromLTRB(12.0, 470.0, 60.0, 518.0); const Rect bottomNavigationBarRect = Rect.fromLTRB(12.0, 470.0, 60.0, 518.0);
...@@ -1400,7 +1400,7 @@ void main() { ...@@ -1400,7 +1400,7 @@ void main() {
); );
}); });
testWidgets('centerDocked', (WidgetTester tester) async { testWidgetsWithLeakTracking('centerDocked', (WidgetTester tester) async {
const Rect defaultRect = Rect.fromLTRB(372.0, 494.0, 428.0, 550.0); const Rect defaultRect = Rect.fromLTRB(372.0, 494.0, 428.0, 550.0);
// Positioned relative to BottomNavigationBar // Positioned relative to BottomNavigationBar
const Rect bottomNavigationBarRect = Rect.fromLTRB(372.0, 466.0, 428.0, 522.0); const Rect bottomNavigationBarRect = Rect.fromLTRB(372.0, 466.0, 428.0, 522.0);
...@@ -1418,7 +1418,7 @@ void main() { ...@@ -1418,7 +1418,7 @@ void main() {
); );
}); });
testWidgets('miniCenterDocked', (WidgetTester tester) async { testWidgetsWithLeakTracking('miniCenterDocked', (WidgetTester tester) async {
const Rect defaultRect = Rect.fromLTRB(376.0, 502.0, 424.0, 550.0); const Rect defaultRect = Rect.fromLTRB(376.0, 502.0, 424.0, 550.0);
// Positioned relative to BottomNavigationBar // Positioned relative to BottomNavigationBar
const Rect bottomNavigationBarRect = Rect.fromLTRB(376.0, 470.0, 424.0, 518.0); const Rect bottomNavigationBarRect = Rect.fromLTRB(376.0, 470.0, 424.0, 518.0);
...@@ -1437,7 +1437,7 @@ void main() { ...@@ -1437,7 +1437,7 @@ void main() {
); );
}); });
testWidgets('endDocked', (WidgetTester tester) async { testWidgetsWithLeakTracking('endDocked', (WidgetTester tester) async {
const Rect defaultRect = Rect.fromLTRB(728.0, 494.0, 784.0, 550.0); const Rect defaultRect = Rect.fromLTRB(728.0, 494.0, 784.0, 550.0);
// Positioned relative to BottomNavigationBar // Positioned relative to BottomNavigationBar
const Rect bottomNavigationBarRect = Rect.fromLTRB(728.0, 466.0, 784.0, 522.0); const Rect bottomNavigationBarRect = Rect.fromLTRB(728.0, 466.0, 784.0, 522.0);
...@@ -1455,7 +1455,7 @@ void main() { ...@@ -1455,7 +1455,7 @@ void main() {
); );
}); });
testWidgets('miniEndDocked', (WidgetTester tester) async { testWidgetsWithLeakTracking('miniEndDocked', (WidgetTester tester) async {
const Rect defaultRect = Rect.fromLTRB(740.0, 502.0, 788.0, 550.0); const Rect defaultRect = Rect.fromLTRB(740.0, 502.0, 788.0, 550.0);
// Positioned relative to BottomNavigationBar // Positioned relative to BottomNavigationBar
const Rect bottomNavigationBarRect = Rect.fromLTRB(740.0, 470.0, 788.0, 518.0); const Rect bottomNavigationBarRect = Rect.fromLTRB(740.0, 470.0, 788.0, 518.0);
......
...@@ -325,7 +325,7 @@ void main() { ...@@ -325,7 +325,7 @@ void main() {
expect(tester.widget<PhysicalShape>(find.byType(PhysicalShape)).elevation, 6.0); expect(tester.widget<PhysicalShape>(find.byType(PhysicalShape)).elevation, 6.0);
}); });
testWidgets('Floating Action Button states elevation', (WidgetTester tester) async { testWidgetsWithLeakTracking('Floating Action Button states elevation', (WidgetTester tester) async {
final FocusNode focusNode = FocusNode(); final FocusNode focusNode = FocusNode();
await tester.pumpWidget( await tester.pumpWidget(
...@@ -720,7 +720,7 @@ void main() { ...@@ -720,7 +720,7 @@ void main() {
semantics.dispose(); semantics.dispose();
}); });
testWidgets('extended FAB hero transitions succeed', (WidgetTester tester) async { testWidgetsWithLeakTracking('extended FAB hero transitions succeed', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/18782 // Regression test for https://github.com/flutter/flutter/issues/18782
await tester.pumpWidget( await tester.pumpWidget(
...@@ -786,7 +786,7 @@ void main() { ...@@ -786,7 +786,7 @@ void main() {
}); });
// This test prevents https://github.com/flutter/flutter/issues/20483 // This test prevents https://github.com/flutter/flutter/issues/20483
testWidgets('Floating Action Button clips ink splash and highlight', (WidgetTester tester) async { testWidgetsWithLeakTracking('Floating Action Button clips ink splash and highlight', (WidgetTester tester) async {
final GlobalKey key = GlobalKey(); final GlobalKey key = GlobalKey();
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
...@@ -1167,7 +1167,7 @@ void main() { ...@@ -1167,7 +1167,7 @@ void main() {
expect(tester.widget<PhysicalShape>(find.byType(PhysicalShape)).elevation, 6.0); expect(tester.widget<PhysicalShape>(find.byType(PhysicalShape)).elevation, 6.0);
}); });
testWidgets('Floating Action Button states elevation', (WidgetTester tester) async { testWidgetsWithLeakTracking('Floating Action Button states elevation', (WidgetTester tester) async {
final FocusNode focusNode = FocusNode(); final FocusNode focusNode = FocusNode();
await tester.pumpWidget( await tester.pumpWidget(
...@@ -1332,7 +1332,7 @@ void main() { ...@@ -1332,7 +1332,7 @@ void main() {
// This test prevents https://github.com/flutter/flutter/issues/20483 // This test prevents https://github.com/flutter/flutter/issues/20483
testWidgets('Floating Action Button clips ink splash and highlight', (WidgetTester tester) async { testWidgetsWithLeakTracking('Floating Action Button clips ink splash and highlight', (WidgetTester tester) async {
final GlobalKey key = GlobalKey(); final GlobalKey key = GlobalKey();
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
......
...@@ -2023,7 +2023,7 @@ void main() { ...@@ -2023,7 +2023,7 @@ void main() {
expect(iconColor(), colorScheme.onSurface.withOpacity(0.38)); expect(iconColor(), colorScheme.onSurface.withOpacity(0.38));
}); });
testWidgets('Default IconButton meets a11y contrast guidelines - M3', (WidgetTester tester) async { testWidgetsWithLeakTracking('Default IconButton meets a11y contrast guidelines - M3', (WidgetTester tester) async {
final FocusNode focusNode = FocusNode(); final FocusNode focusNode = FocusNode();
await tester.pumpWidget( await tester.pumpWidget(
......
...@@ -1041,7 +1041,7 @@ testWidgetsWithLeakTracking('InkResponse radius can be updated', (WidgetTester t ...@@ -1041,7 +1041,7 @@ testWidgetsWithLeakTracking('InkResponse radius can be updated', (WidgetTester t
expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic); expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic);
}); });
testWidgets('InkResponse containing selectable text changes mouse cursor when hovered', (WidgetTester tester) async { testWidgetsWithLeakTracking('InkResponse containing selectable text changes mouse cursor when hovered', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/104595. // Regression test for https://github.com/flutter/flutter/issues/104595.
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
home: SelectionArea( home: SelectionArea(
......
...@@ -1668,7 +1668,7 @@ void runAllTests({ required bool useMaterial3 }) { ...@@ -1668,7 +1668,7 @@ void runAllTests({ required bool useMaterial3 }) {
expect(find.text('errorText'), findsOneWidget); expect(find.text('errorText'), findsOneWidget);
}); });
testWidgets('InputDecoration shows error border for errorText and error widget', (WidgetTester tester) async { testWidgetsWithLeakTracking('InputDecoration shows error border for errorText and error widget', (WidgetTester tester) async {
const InputBorder errorBorder = OutlineInputBorder( const InputBorder errorBorder = OutlineInputBorder(
borderSide: BorderSide(color: Colors.red, width: 1.5), borderSide: BorderSide(color: Colors.red, width: 1.5),
); );
......
...@@ -746,7 +746,7 @@ void main() { ...@@ -746,7 +746,7 @@ void main() {
expect(find.byType(Material), paints..rect(color: selectedTileColor)); expect(find.byType(Material), paints..rect(color: selectedTileColor));
}); });
testWidgets('ListTile uses ListTileTheme shape in a drawer', (WidgetTester tester) async { testWidgetsWithLeakTracking('ListTile uses ListTileTheme shape in a drawer', (WidgetTester tester) async {
// This is a regression test for https://github.com/flutter/flutter/issues/106303 // This is a regression test for https://github.com/flutter/flutter/issues/106303
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
......
...@@ -243,7 +243,7 @@ void main() { ...@@ -243,7 +243,7 @@ void main() {
expect(material.color, const Color(0xff00ff00)); expect(material.color, const Color(0xff00ff00));
}); });
testWidgets('Default MaterialButton meets a11y contrast guidelines', (WidgetTester tester) async { testWidgetsWithLeakTracking('Default MaterialButton meets a11y contrast guidelines', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
home: Scaffold( home: Scaffold(
......
...@@ -322,7 +322,7 @@ void main() { ...@@ -322,7 +322,7 @@ void main() {
focusNode.dispose(); focusNode.dispose();
}); });
testWidgets('Default OutlinedButton meets a11y contrast guidelines', (WidgetTester tester) async { testWidgetsWithLeakTracking('Default OutlinedButton meets a11y contrast guidelines', (WidgetTester tester) async {
final FocusNode focusNode = FocusNode(); final FocusNode focusNode = FocusNode();
await tester.pumpWidget( await tester.pumpWidget(
...@@ -371,7 +371,7 @@ void main() { ...@@ -371,7 +371,7 @@ void main() {
skip: isBrowser, // https://github.com/flutter/flutter/issues/44115 skip: isBrowser, // https://github.com/flutter/flutter/issues/44115
); );
testWidgets('OutlinedButton with colored theme meets a11y contrast guidelines', (WidgetTester tester) async { testWidgetsWithLeakTracking('OutlinedButton with colored theme meets a11y contrast guidelines', (WidgetTester tester) async {
final FocusNode focusNode = FocusNode(); final FocusNode focusNode = FocusNode();
Color getTextColor(Set<MaterialState> states) { Color getTextColor(Set<MaterialState> states) {
...@@ -1837,7 +1837,7 @@ void main() { ...@@ -1837,7 +1837,7 @@ void main() {
expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic); expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic);
}); });
testWidgets('OutlinedButton in SelectionArea changes mouse cursor when hovered', (WidgetTester tester) async { testWidgetsWithLeakTracking('OutlinedButton in SelectionArea changes mouse cursor when hovered', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/104595. // Regression test for https://github.com/flutter/flutter/issues/104595.
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
home: SelectionArea( home: SelectionArea(
......
...@@ -206,7 +206,7 @@ void main() { ...@@ -206,7 +206,7 @@ void main() {
expect(indicatorColors(tester), const <Color>[kBlue, kRed, kRed]); expect(indicatorColors(tester), const <Color>[kBlue, kRed, kRed]);
}); });
testWidgets('PageSelector indicatorSize', (WidgetTester tester) async { testWidgetsWithLeakTracking('PageSelector indicatorSize', (WidgetTester tester) async {
final TabController tabController = TabController( final TabController tabController = TabController(
vsync: const TestVSync(), vsync: const TestVSync(),
initialIndex: 1, initialIndex: 1,
......
...@@ -1041,7 +1041,7 @@ void main() { ...@@ -1041,7 +1041,7 @@ void main() {
expect(pageTapCount, 1); expect(pageTapCount, 1);
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS })); }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
testWidgets('A MaterialPageRoute should slide out with CupertinoPageTransition when a compatible PageRoute is pushed on top of it', (WidgetTester tester) async { testWidgetsWithLeakTracking('A MaterialPageRoute should slide out with CupertinoPageTransition when a compatible PageRoute is pushed on top of it', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/44864. // Regression test for https://github.com/flutter/flutter/issues/44864.
await tester.pumpWidget( await tester.pumpWidget(
......
...@@ -23,7 +23,7 @@ void main() { ...@@ -23,7 +23,7 @@ void main() {
expect(dyDelta1, isNot(moreOrLessEquals(dyDelta2, epsilon: 0.1))); expect(dyDelta1, isNot(moreOrLessEquals(dyDelta2, epsilon: 0.1)));
} }
testWidgets('Persistent draggableScrollableSheet localHistoryEntries test', (WidgetTester tester) async { testWidgetsWithLeakTracking('Persistent draggableScrollableSheet localHistoryEntries test', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/110123 // Regression test for https://github.com/flutter/flutter/issues/110123
Widget buildFrame(Widget? bottomSheet) { Widget buildFrame(Widget? bottomSheet) {
return MaterialApp( return MaterialApp(
...@@ -79,7 +79,7 @@ void main() { ...@@ -79,7 +79,7 @@ void main() {
}); });
// Regression test for https://github.com/flutter/flutter/issues/83668 // Regression test for https://github.com/flutter/flutter/issues/83668
testWidgets('Scaffold.bottomSheet update test', (WidgetTester tester) async { testWidgetsWithLeakTracking('Scaffold.bottomSheet update test', (WidgetTester tester) async {
Widget buildFrame(Widget? bottomSheet) { Widget buildFrame(Widget? bottomSheet) {
return MaterialApp( return MaterialApp(
home: Scaffold( home: Scaffold(
...@@ -123,7 +123,7 @@ void main() { ...@@ -123,7 +123,7 @@ void main() {
expect(buildCount, equals(2)); expect(buildCount, equals(2));
}); });
testWidgets('Verify that a persistent BottomSheet cannot be dismissed', (WidgetTester tester) async { testWidgetsWithLeakTracking('Verify that a persistent BottomSheet cannot be dismissed', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
home: Scaffold( home: Scaffold(
body: const Center(child: Text('body')), body: const Center(child: Text('body')),
...@@ -186,7 +186,7 @@ void main() { ...@@ -186,7 +186,7 @@ void main() {
expect(find.text('Two'), findsNothing); expect(find.text('Two'), findsNothing);
}); });
testWidgets('Verify DraggableScrollableSheet.shouldCloseOnMinExtent == false prevents dismissal', (WidgetTester tester) async { testWidgetsWithLeakTracking('Verify DraggableScrollableSheet.shouldCloseOnMinExtent == false prevents dismissal', (WidgetTester tester) async {
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
...@@ -259,7 +259,7 @@ void main() { ...@@ -259,7 +259,7 @@ void main() {
expect(find.text('Two'), findsNothing); expect(find.text('Two'), findsNothing);
}); });
testWidgets('Verify that a scrollControlled BottomSheet can be dismissed', (WidgetTester tester) async { testWidgetsWithLeakTracking('Verify that a scrollControlled BottomSheet can be dismissed', (WidgetTester tester) async {
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
...@@ -298,7 +298,7 @@ void main() { ...@@ -298,7 +298,7 @@ void main() {
expect(find.text('Two'), findsNothing); expect(find.text('Two'), findsNothing);
}); });
testWidgets('Verify that a persistent BottomSheet can fling up and hide the fab', (WidgetTester tester) async { testWidgetsWithLeakTracking('Verify that a persistent BottomSheet can fling up and hide the fab', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
home: Scaffold( home: Scaffold(
...@@ -348,7 +348,7 @@ void main() { ...@@ -348,7 +348,7 @@ void main() {
expect(find.byType(FloatingActionButton).hitTestable(), findsNothing); expect(find.byType(FloatingActionButton).hitTestable(), findsNothing);
}); });
testWidgets('Verify that a back button resets a persistent BottomSheet', (WidgetTester tester) async { testWidgetsWithLeakTracking('Verify that a back button resets a persistent BottomSheet', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
home: Scaffold( home: Scaffold(
...@@ -409,7 +409,7 @@ void main() { ...@@ -409,7 +409,7 @@ void main() {
expect(find.text('Item 22'), findsNothing); expect(find.text('Item 22'), findsNothing);
}); });
testWidgets('Verify that a scrollable BottomSheet hides the fab when scrolled up', (WidgetTester tester) async { testWidgetsWithLeakTracking('Verify that a scrollable BottomSheet hides the fab when scrolled up', (WidgetTester tester) async {
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
...@@ -530,7 +530,7 @@ void main() { ...@@ -530,7 +530,7 @@ void main() {
); );
}); });
testWidgets('Scaffold.bottomSheet', (WidgetTester tester) async { testWidgetsWithLeakTracking('Scaffold.bottomSheet', (WidgetTester tester) async {
final Key bottomSheetKey = UniqueKey(); final Key bottomSheetKey = UniqueKey();
await tester.pumpWidget( await tester.pumpWidget(
......
...@@ -3741,7 +3741,7 @@ void main() { ...@@ -3741,7 +3741,7 @@ void main() {
expect(_labelStyle(tester, 'Item 1')!.fontStyle, customTextStyle.fontStyle); expect(_labelStyle(tester, 'Item 1')!.fontStyle, customTextStyle.fontStyle);
}); });
testWidgets('CheckedPopupMenuItem.onTap callback is called when defined', (WidgetTester tester) async { testWidgetsWithLeakTracking('CheckedPopupMenuItem.onTap callback is called when defined', (WidgetTester tester) async {
int count = 0; int count = 0;
await tester.pumpWidget( await tester.pumpWidget(
TestApp( TestApp(
......
...@@ -718,7 +718,7 @@ void main() { ...@@ -718,7 +718,7 @@ void main() {
expect(tester.hasRunningAnimations, isTrue); expect(tester.hasRunningAnimations, isTrue);
}); });
testWidgets('Material2 - RefreshProgressIndicator uses expected animation', (WidgetTester tester) async { testWidgetsWithLeakTracking('Material2 - RefreshProgressIndicator uses expected animation', (WidgetTester tester) async {
final AnimationSheetBuilder animationSheet = AnimationSheetBuilder(frameSize: const Size(50, 50)); final AnimationSheetBuilder animationSheet = AnimationSheetBuilder(frameSize: const Size(50, 50));
addTearDown(animationSheet.dispose); addTearDown(animationSheet.dispose);
...@@ -735,7 +735,7 @@ void main() { ...@@ -735,7 +735,7 @@ void main() {
); );
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/56001 }, skip: isBrowser); // https://github.com/flutter/flutter/issues/56001
testWidgets('Material3 - RefreshProgressIndicator uses expected animation', (WidgetTester tester) async { testWidgetsWithLeakTracking('Material3 - RefreshProgressIndicator uses expected animation', (WidgetTester tester) async {
final AnimationSheetBuilder animationSheet = AnimationSheetBuilder(frameSize: const Size(50, 50)); final AnimationSheetBuilder animationSheet = AnimationSheetBuilder(frameSize: const Size(50, 50));
addTearDown(animationSheet.dispose); addTearDown(animationSheet.dispose);
...@@ -1017,7 +1017,7 @@ void main() { ...@@ -1017,7 +1017,7 @@ void main() {
handle.dispose(); handle.dispose();
}); });
testWidgets('Material2 - Indeterminate CircularProgressIndicator uses expected animation', (WidgetTester tester) async { testWidgetsWithLeakTracking('Material2 - Indeterminate CircularProgressIndicator uses expected animation', (WidgetTester tester) async {
final AnimationSheetBuilder animationSheet = AnimationSheetBuilder(frameSize: const Size(40, 40)); final AnimationSheetBuilder animationSheet = AnimationSheetBuilder(frameSize: const Size(40, 40));
addTearDown(animationSheet.dispose); addTearDown(animationSheet.dispose);
...@@ -1040,7 +1040,7 @@ void main() { ...@@ -1040,7 +1040,7 @@ void main() {
); );
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/56001 }, skip: isBrowser); // https://github.com/flutter/flutter/issues/56001
testWidgets('Material3 - Indeterminate CircularProgressIndicator uses expected animation', (WidgetTester tester) async { testWidgetsWithLeakTracking('Material3 - Indeterminate CircularProgressIndicator uses expected animation', (WidgetTester tester) async {
final AnimationSheetBuilder animationSheet = AnimationSheetBuilder(frameSize: const Size(40, 40)); final AnimationSheetBuilder animationSheet = AnimationSheetBuilder(frameSize: const Size(40, 40));
addTearDown(animationSheet.dispose); addTearDown(animationSheet.dispose);
......
...@@ -271,7 +271,7 @@ void main() { ...@@ -271,7 +271,7 @@ void main() {
expect(tester.binding.transientCallbackCount, greaterThan(0)); expect(tester.binding.transientCallbackCount, greaterThan(0));
}); });
testWidgets('Floating action button shrinks when bottom sheet becomes dominant', (WidgetTester tester) async { testWidgetsWithLeakTracking('Floating action button shrinks when bottom sheet becomes dominant', (WidgetTester tester) async {
final DraggableScrollableController draggableController = DraggableScrollableController(); final DraggableScrollableController draggableController = DraggableScrollableController();
const double kBottomSheetDominatesPercentage = 0.3; const double kBottomSheetDominatesPercentage = 0.3;
...@@ -310,7 +310,7 @@ void main() { ...@@ -310,7 +310,7 @@ void main() {
} }
}); });
testWidgets('Scaffold shows scrim when bottom sheet becomes dominant', (WidgetTester tester) async { testWidgetsWithLeakTracking('Scaffold shows scrim when bottom sheet becomes dominant', (WidgetTester tester) async {
final DraggableScrollableController draggableController = DraggableScrollableController(); final DraggableScrollableController draggableController = DraggableScrollableController();
const double kBottomSheetDominatesPercentage = 0.3; const double kBottomSheetDominatesPercentage = 0.3;
const double kMinBottomSheetScrimOpacity = 0.1; const double kMinBottomSheetScrimOpacity = 0.1;
...@@ -621,7 +621,7 @@ void main() { ...@@ -621,7 +621,7 @@ void main() {
expect(appBarBottomRight, equals(sheetTopRight)); expect(appBarBottomRight, equals(sheetTopRight));
}); });
testWidgets('BottomSheet bottom padding is not consumed by viewInsets', (WidgetTester tester) async { testWidgetsWithLeakTracking('BottomSheet bottom padding is not consumed by viewInsets', (WidgetTester tester) async {
final Widget child = Directionality( final Widget child = Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: Scaffold( child: Scaffold(
...@@ -2155,7 +2155,7 @@ void main() { ...@@ -2155,7 +2155,7 @@ void main() {
}); });
group('FlutterError control test', () { group('FlutterError control test', () {
testWidgets('showBottomSheet() while Scaffold has bottom sheet', testWidgetsWithLeakTracking('showBottomSheet() while Scaffold has bottom sheet',
(WidgetTester tester) async { (WidgetTester tester) async {
final GlobalKey<ScaffoldState> key = GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> key = GlobalKey<ScaffoldState>();
await tester.pumpWidget( await tester.pumpWidget(
...@@ -2658,7 +2658,7 @@ void main() { ...@@ -2658,7 +2658,7 @@ void main() {
expect(summary.toString(), 'The showSnackBar() method cannot be called during build.'); expect(summary.toString(), 'The showSnackBar() method cannot be called during build.');
}); });
testWidgets('Persistent BottomSheet is not dismissible via a11y means', (WidgetTester tester) async { testWidgetsWithLeakTracking('Persistent BottomSheet is not dismissible via a11y means', (WidgetTester tester) async {
final Key bottomSheetKey = UniqueKey(); final Key bottomSheetKey = UniqueKey();
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
...@@ -2681,7 +2681,7 @@ void main() { ...@@ -2681,7 +2681,7 @@ void main() {
}); });
// Regression test for https://github.com/flutter/flutter/issues/117004 // Regression test for https://github.com/flutter/flutter/issues/117004
testWidgets('can rebuild and remove bottomSheet at the same time', (WidgetTester tester) async { testWidgetsWithLeakTracking('can rebuild and remove bottomSheet at the same time', (WidgetTester tester) async {
bool themeIsLight = true; bool themeIsLight = true;
bool? defaultBottomSheet = true; bool? defaultBottomSheet = true;
final GlobalKey bottomSheetKey1 = GlobalKey(); final GlobalKey bottomSheetKey1 = GlobalKey();
......
...@@ -242,19 +242,19 @@ void main() { ...@@ -242,19 +242,19 @@ void main() {
expect(trailingRect.right, barRect.right - 16.0); expect(trailingRect.right, barRect.right - 16.0);
} }
testWidgets('SearchBar properties overrides defaults', (WidgetTester tester) async { testWidgetsWithLeakTracking('SearchBar properties overrides defaults', (WidgetTester tester) async {
await tester.pumpWidget(buildFrame(useSearchBarProperties: true)); await tester.pumpWidget(buildFrame(useSearchBarProperties: true));
await tester.pumpAndSettle(); // allow the animations to finish await tester.pumpAndSettle(); // allow the animations to finish
checkSearchBar(tester); checkSearchBar(tester);
}); });
testWidgets('SearchBar theme data overrides defaults', (WidgetTester tester) async { testWidgetsWithLeakTracking('SearchBar theme data overrides defaults', (WidgetTester tester) async {
await tester.pumpWidget(buildFrame(searchBarThemeData: searchBarTheme)); await tester.pumpWidget(buildFrame(searchBarThemeData: searchBarTheme));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
checkSearchBar(tester); checkSearchBar(tester);
}); });
testWidgets('Overall Theme SearchBar theme overrides defaults', (WidgetTester tester) async { testWidgetsWithLeakTracking('Overall Theme SearchBar theme overrides defaults', (WidgetTester tester) async {
await tester.pumpWidget(buildFrame(overallTheme: searchBarTheme)); await tester.pumpWidget(buildFrame(overallTheme: searchBarTheme));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
checkSearchBar(tester); checkSearchBar(tester);
...@@ -262,7 +262,7 @@ void main() { ...@@ -262,7 +262,7 @@ void main() {
// Same as the previous tests with empty SearchBarThemeData's instead of null. // Same as the previous tests with empty SearchBarThemeData's instead of null.
testWidgets('SearchBar properties overrides defaults, empty theme and overall theme', (WidgetTester tester) async { testWidgetsWithLeakTracking('SearchBar properties overrides defaults, empty theme and overall theme', (WidgetTester tester) async {
await tester.pumpWidget(buildFrame(useSearchBarProperties: true, await tester.pumpWidget(buildFrame(useSearchBarProperties: true,
searchBarThemeData: const SearchBarThemeData(), searchBarThemeData: const SearchBarThemeData(),
overallTheme: const SearchBarThemeData())); overallTheme: const SearchBarThemeData()));
...@@ -270,14 +270,14 @@ void main() { ...@@ -270,14 +270,14 @@ void main() {
checkSearchBar(tester); checkSearchBar(tester);
}); });
testWidgets('SearchBar theme overrides defaults and overall theme', (WidgetTester tester) async { testWidgetsWithLeakTracking('SearchBar theme overrides defaults and overall theme', (WidgetTester tester) async {
await tester.pumpWidget(buildFrame(searchBarThemeData: searchBarTheme, await tester.pumpWidget(buildFrame(searchBarThemeData: searchBarTheme,
overallTheme: const SearchBarThemeData())); overallTheme: const SearchBarThemeData()));
await tester.pumpAndSettle(); // allow the animations to finish await tester.pumpAndSettle(); // allow the animations to finish
checkSearchBar(tester); checkSearchBar(tester);
}); });
testWidgets('Overall Theme SearchBar theme overrides defaults and null theme', (WidgetTester tester) async { testWidgetsWithLeakTracking('Overall Theme SearchBar theme overrides defaults and null theme', (WidgetTester tester) async {
await tester.pumpWidget(buildFrame(overallTheme: searchBarTheme)); await tester.pumpWidget(buildFrame(overallTheme: searchBarTheme));
await tester.pumpAndSettle(); // allow the animations to finish await tester.pumpAndSettle(); // allow the animations to finish
checkSearchBar(tester); checkSearchBar(tester);
......
...@@ -97,7 +97,7 @@ void main() { ...@@ -97,7 +97,7 @@ void main() {
expect(material.type, MaterialType.transparency); expect(material.type, MaterialType.transparency);
}); });
testWidgets('SegmentedButton supports exclusive choice by default', (WidgetTester tester) async { testWidgetsWithLeakTracking('SegmentedButton supports exclusive choice by default', (WidgetTester tester) async {
int callbackCount = 0; int callbackCount = 0;
int selectedSegment = 2; int selectedSegment = 2;
...@@ -147,7 +147,7 @@ void main() { ...@@ -147,7 +147,7 @@ void main() {
expect(selectedSegment, 3); expect(selectedSegment, 3);
}); });
testWidgets('SegmentedButton supports multiple selected segments', (WidgetTester tester) async { testWidgetsWithLeakTracking('SegmentedButton supports multiple selected segments', (WidgetTester tester) async {
int callbackCount = 0; int callbackCount = 0;
Set<int> selection = <int>{1}; Set<int> selection = <int>{1};
...@@ -202,7 +202,7 @@ void main() { ...@@ -202,7 +202,7 @@ void main() {
expect(selection, <int>{2, 3}); expect(selection, <int>{2, 3});
}); });
testWidgets('SegmentedButton allows for empty selection', (WidgetTester tester) async { testWidgetsWithLeakTracking('SegmentedButton allows for empty selection', (WidgetTester tester) async {
int callbackCount = 0; int callbackCount = 0;
int? selectedSegment = 1; int? selectedSegment = 1;
...@@ -255,7 +255,7 @@ testWidgets('SegmentedButton allows for empty selection', (WidgetTester tester) ...@@ -255,7 +255,7 @@ testWidgets('SegmentedButton allows for empty selection', (WidgetTester tester)
expect(selectedSegment, 3); expect(selectedSegment, 3);
}); });
testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTester tester) async { testWidgetsWithLeakTracking('SegmentedButton shows checkboxes for selected segments', (WidgetTester tester) async {
Widget frameWithSelection(int selected) { Widget frameWithSelection(int selected) {
return Material( return Material(
child: boilerplate( child: boilerplate(
...@@ -292,7 +292,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes ...@@ -292,7 +292,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes
expect(find.byIcon(Icons.check), findsOneWidget); expect(find.byIcon(Icons.check), findsOneWidget);
}); });
testWidgets('SegmentedButton shows selected checkboxes in place of icon if it has a label as well', (WidgetTester tester) async { testWidgetsWithLeakTracking('SegmentedButton shows selected checkboxes in place of icon if it has a label as well', (WidgetTester tester) async {
Widget frameWithSelection(int selected) { Widget frameWithSelection(int selected) {
return Material( return Material(
child: boilerplate( child: boilerplate(
...@@ -335,7 +335,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes ...@@ -335,7 +335,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes
expect(find.byIcon(Icons.add_alarm), findsNothing); expect(find.byIcon(Icons.add_alarm), findsNothing);
}); });
testWidgets('SegmentedButton shows selected checkboxes next to icon if there is no label', (WidgetTester tester) async { testWidgetsWithLeakTracking('SegmentedButton shows selected checkboxes next to icon if there is no label', (WidgetTester tester) async {
Widget frameWithSelection(int selected) { Widget frameWithSelection(int selected) {
return Material( return Material(
child: boilerplate( child: boilerplate(
...@@ -376,7 +376,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes ...@@ -376,7 +376,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes
}); });
testWidgets('SegmentedButtons have correct semantics', (WidgetTester tester) async { testWidgetsWithLeakTracking('SegmentedButtons have correct semantics', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester); final SemanticsTester semantics = SemanticsTester(tester);
await tester.pumpWidget( await tester.pumpWidget(
...@@ -455,7 +455,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes ...@@ -455,7 +455,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes
}); });
testWidgets('Multi-select SegmentedButtons have correct semantics', (WidgetTester tester) async { testWidgetsWithLeakTracking('Multi-select SegmentedButtons have correct semantics', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester); final SemanticsTester semantics = SemanticsTester(tester);
await tester.pumpWidget( await tester.pumpWidget(
...@@ -532,7 +532,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes ...@@ -532,7 +532,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes
semantics.dispose(); semantics.dispose();
}); });
testWidgets('SegmentedButton default overlayColor and foregroundColor resolve pressed state', (WidgetTester tester) async { testWidgetsWithLeakTracking('SegmentedButton default overlayColor and foregroundColor resolve pressed state', (WidgetTester tester) async {
final ThemeData theme = ThemeData(useMaterial3: true); final ThemeData theme = ThemeData(useMaterial3: true);
await tester.pumpWidget( await tester.pumpWidget(
...@@ -580,7 +580,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes ...@@ -580,7 +580,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes
expect(material.textStyle?.color, theme.colorScheme.onSurface); expect(material.textStyle?.color, theme.colorScheme.onSurface);
}); });
testWidgets('SegmentedButton has no tooltips by default', (WidgetTester tester) async { testWidgetsWithLeakTracking('SegmentedButton has no tooltips by default', (WidgetTester tester) async {
final ThemeData theme = ThemeData(useMaterial3: true); final ThemeData theme = ThemeData(useMaterial3: true);
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
...@@ -604,7 +604,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes ...@@ -604,7 +604,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes
expect(find.byType(Tooltip), findsNothing); expect(find.byType(Tooltip), findsNothing);
}); });
testWidgets('SegmentedButton has correct tooltips', (WidgetTester tester) async { testWidgetsWithLeakTracking('SegmentedButton has correct tooltips', (WidgetTester tester) async {
final ThemeData theme = ThemeData(useMaterial3: true); final ThemeData theme = ThemeData(useMaterial3: true);
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
......
...@@ -42,7 +42,7 @@ void main() { ...@@ -42,7 +42,7 @@ void main() {
expect(description, <String>[]); expect(description, <String>[]);
}); });
testWidgets('With no other configuration, defaults are used', (WidgetTester tester) async { testWidgetsWithLeakTracking('With no other configuration, defaults are used', (WidgetTester tester) async {
final ThemeData theme = ThemeData(useMaterial3: true); final ThemeData theme = ThemeData(useMaterial3: true);
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
...@@ -109,7 +109,7 @@ void main() { ...@@ -109,7 +109,7 @@ void main() {
} }
}); });
testWidgets('ThemeData.segmentedButtonTheme overrides defaults', (WidgetTester tester) async { testWidgetsWithLeakTracking('ThemeData.segmentedButtonTheme overrides defaults', (WidgetTester tester) async {
final ThemeData theme = ThemeData( final ThemeData theme = ThemeData(
useMaterial3: true, useMaterial3: true,
segmentedButtonTheme: SegmentedButtonThemeData( segmentedButtonTheme: SegmentedButtonThemeData(
...@@ -202,7 +202,7 @@ void main() { ...@@ -202,7 +202,7 @@ void main() {
} }
}); });
testWidgets('SegmentedButtonTheme overrides ThemeData and defaults', (WidgetTester tester) async { testWidgetsWithLeakTracking('SegmentedButtonTheme overrides ThemeData and defaults', (WidgetTester tester) async {
final SegmentedButtonThemeData global = SegmentedButtonThemeData( final SegmentedButtonThemeData global = SegmentedButtonThemeData(
style: ButtonStyle( style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states) { backgroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states) {
...@@ -329,7 +329,7 @@ void main() { ...@@ -329,7 +329,7 @@ void main() {
} }
}); });
testWidgets('Widget parameters overrides SegmentedTheme, ThemeData and defaults', (WidgetTester tester) async { testWidgetsWithLeakTracking('Widget parameters overrides SegmentedTheme, ThemeData and defaults', (WidgetTester tester) async {
final SegmentedButtonThemeData global = SegmentedButtonThemeData( final SegmentedButtonThemeData global = SegmentedButtonThemeData(
style: ButtonStyle( style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states) { backgroundColor: MaterialStateProperty.resolveWith((Set<MaterialState> states) {
......
...@@ -8,6 +8,7 @@ import 'package:flutter/gestures.dart'; ...@@ -8,6 +8,7 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
Offset textOffsetToPosition(RenderParagraph paragraph, int offset) { Offset textOffsetToPosition(RenderParagraph paragraph, int offset) {
...@@ -17,7 +18,7 @@ Offset textOffsetToPosition(RenderParagraph paragraph, int offset) { ...@@ -17,7 +18,7 @@ Offset textOffsetToPosition(RenderParagraph paragraph, int offset) {
} }
void main() { void main() {
testWidgets('SelectionArea uses correct selection controls', (WidgetTester tester) async { testWidgetsWithLeakTracking('SelectionArea uses correct selection controls', (WidgetTester tester) async {
await tester.pumpWidget(const MaterialApp( await tester.pumpWidget(const MaterialApp(
home: SelectionArea( home: SelectionArea(
child: Text('abc'), child: Text('abc'),
...@@ -39,7 +40,7 @@ void main() { ...@@ -39,7 +40,7 @@ void main() {
} }
}, variant: TargetPlatformVariant.all()); }, variant: TargetPlatformVariant.all());
testWidgets('Does not crash when long pressing on padding after dragging', (WidgetTester tester) async { testWidgetsWithLeakTracking('Does not crash when long pressing on padding after dragging', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/123378 // Regression test for https://github.com/flutter/flutter/issues/123378
await tester.pumpWidget( await tester.pumpWidget(
const MaterialApp( const MaterialApp(
...@@ -70,11 +71,14 @@ void main() { ...@@ -70,11 +71,14 @@ void main() {
}); });
testWidgets('builds the default context menu by default', (WidgetTester tester) async { testWidgetsWithLeakTracking('builds the default context menu by default', (WidgetTester tester) async {
final FocusNode focusNode = FocusNode();
addTearDown(focusNode.dispose);
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
home: SelectionArea( home: SelectionArea(
focusNode: FocusNode(), focusNode: focusNode,
child: const Text('How are you?'), child: const Text('How are you?'),
), ),
), ),
...@@ -97,12 +101,15 @@ void main() { ...@@ -97,12 +101,15 @@ void main() {
skip: kIsWeb, // [intended] skip: kIsWeb, // [intended]
); );
testWidgets('builds a custom context menu if provided', (WidgetTester tester) async { testWidgetsWithLeakTracking('builds a custom context menu if provided', (WidgetTester tester) async {
final GlobalKey key = GlobalKey(); final GlobalKey key = GlobalKey();
final FocusNode focusNode = FocusNode();
addTearDown(focusNode.dispose);
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
home: SelectionArea( home: SelectionArea(
focusNode: FocusNode(), focusNode: focusNode,
contextMenuBuilder: ( contextMenuBuilder: (
BuildContext context, BuildContext context,
SelectableRegionState selectableRegionState, SelectableRegionState selectableRegionState,
...@@ -133,7 +140,7 @@ void main() { ...@@ -133,7 +140,7 @@ void main() {
skip: kIsWeb, // [intended] skip: kIsWeb, // [intended]
); );
testWidgets('onSelectionChange is called when the selection changes', (WidgetTester tester) async { testWidgetsWithLeakTracking('onSelectionChange is called when the selection changes', (WidgetTester tester) async {
SelectedContent? content; SelectedContent? content;
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
...@@ -165,7 +172,10 @@ void main() { ...@@ -165,7 +172,10 @@ void main() {
expect(content!.plainText, 'How'); expect(content!.plainText, 'How');
}); });
testWidgets('stopping drag of end handle will show the toolbar', (WidgetTester tester) async { testWidgetsWithLeakTracking('stopping drag of end handle will show the toolbar', (WidgetTester tester) async {
final FocusNode focusNode = FocusNode();
addTearDown(focusNode.dispose);
// Regression test for https://github.com/flutter/flutter/issues/119314 // Regression test for https://github.com/flutter/flutter/issues/119314
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
...@@ -177,7 +187,7 @@ void main() { ...@@ -177,7 +187,7 @@ void main() {
children: <Widget>[ children: <Widget>[
const Text('How are you?'), const Text('How are you?'),
SelectionArea( SelectionArea(
focusNode: FocusNode(), focusNode: focusNode,
child: const Text('Good, and you?'), child: const Text('Good, and you?'),
), ),
const Text('Fine, thank you.'), const Text('Fine, thank you.'),
......
...@@ -2988,7 +2988,7 @@ void main() { ...@@ -2988,7 +2988,7 @@ void main() {
expect(state.position.value, greaterThan(1)); expect(state.position.value, greaterThan(1));
}); });
testWidgets('Switch thumb shows correct pressed color - M3', (WidgetTester tester) async { testWidgetsWithLeakTracking('Switch thumb shows correct pressed color - M3', (WidgetTester tester) async {
final ThemeData themeData = ThemeData(useMaterial3: true); final ThemeData themeData = ThemeData(useMaterial3: true);
final ColorScheme colors = themeData.colorScheme; final ColorScheme colors = themeData.colorScheme;
Widget buildApp({bool enabled = true, bool value = true}) { Widget buildApp({bool enabled = true, bool value = true}) {
......
...@@ -155,7 +155,7 @@ void main() { ...@@ -155,7 +155,7 @@ void main() {
expect(material.type, MaterialType.button); expect(material.type, MaterialType.button);
}); });
testWidgets('Default TextButton meets a11y contrast guidelines', (WidgetTester tester) async { testWidgetsWithLeakTracking('Default TextButton meets a11y contrast guidelines', (WidgetTester tester) async {
final FocusNode focusNode = FocusNode(); final FocusNode focusNode = FocusNode();
await tester.pumpWidget( await tester.pumpWidget(
...@@ -203,7 +203,7 @@ void main() { ...@@ -203,7 +203,7 @@ void main() {
skip: isBrowser, // https://github.com/flutter/flutter/issues/44115 skip: isBrowser, // https://github.com/flutter/flutter/issues/44115
); );
testWidgets('TextButton with colored theme meets a11y contrast guidelines', (WidgetTester tester) async { testWidgetsWithLeakTracking('TextButton with colored theme meets a11y contrast guidelines', (WidgetTester tester) async {
final FocusNode focusNode = FocusNode(); final FocusNode focusNode = FocusNode();
Color getTextColor(Set<MaterialState> states) { Color getTextColor(Set<MaterialState> states) {
...@@ -1636,7 +1636,7 @@ void main() { ...@@ -1636,7 +1636,7 @@ void main() {
expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic); expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic);
}); });
testWidgets('TextButton in SelectionArea changes mouse cursor when hovered', (WidgetTester tester) async { testWidgetsWithLeakTracking('TextButton in SelectionArea changes mouse cursor when hovered', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/104595. // Regression test for https://github.com/flutter/flutter/issues/104595.
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
home: SelectionArea( home: SelectionArea(
...@@ -1689,6 +1689,7 @@ void main() { ...@@ -1689,6 +1689,7 @@ void main() {
count += 1; count += 1;
} }
final MaterialStatesController controller = MaterialStatesController(); final MaterialStatesController controller = MaterialStatesController();
addTearDown(controller.dispose);
controller.addListener(valueChanged); controller.addListener(valueChanged);
await tester.pumpWidget( await tester.pumpWidget(
...@@ -1789,20 +1790,21 @@ void main() { ...@@ -1789,20 +1790,21 @@ void main() {
await gesture.removePointer(); await gesture.removePointer();
} }
testWidgets('TextButton statesController', (WidgetTester tester) async { testWidgetsWithLeakTracking('TextButton statesController', (WidgetTester tester) async {
testStatesController(null, tester); testStatesController(null, tester);
}); });
testWidgets('TextButton.icon statesController', (WidgetTester tester) async { testWidgetsWithLeakTracking('TextButton.icon statesController', (WidgetTester tester) async {
testStatesController(const Icon(Icons.add), tester); testStatesController(const Icon(Icons.add), tester);
}); });
testWidgets('Disabled TextButton statesController', (WidgetTester tester) async { testWidgetsWithLeakTracking('Disabled TextButton statesController', (WidgetTester tester) async {
int count = 0; int count = 0;
void valueChanged() { void valueChanged() {
count += 1; count += 1;
} }
final MaterialStatesController controller = MaterialStatesController(); final MaterialStatesController controller = MaterialStatesController();
addTearDown(controller.dispose);
controller.addListener(valueChanged); controller.addListener(valueChanged);
await tester.pumpWidget( await tester.pumpWidget(
......
...@@ -4,12 +4,13 @@ ...@@ -4,12 +4,13 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
const String text = 'Hello World! How are you? Life is good!'; const String text = 'Hello World! How are you? Life is good!';
const String alternativeText = 'Everything is awesome!!'; const String alternativeText = 'Everything is awesome!!';
void main() { void main() {
testWidgets('TextField restoration', (WidgetTester tester) async { testWidgetsWithLeakTracking('TextField restoration', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
const MaterialApp( const MaterialApp(
restorationScopeId: 'app', restorationScopeId: 'app',
...@@ -20,7 +21,7 @@ void main() { ...@@ -20,7 +21,7 @@ void main() {
await restoreAndVerify(tester); await restoreAndVerify(tester);
}); });
testWidgets('TextField restoration with external controller', (WidgetTester tester) async { testWidgetsWithLeakTracking('TextField restoration with external controller', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
const MaterialApp( const MaterialApp(
restorationScopeId: 'root', restorationScopeId: 'root',
......
...@@ -4,12 +4,13 @@ ...@@ -4,12 +4,13 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
const String text = 'Hello World! How are you? Life is good!'; const String text = 'Hello World! How are you? Life is good!';
const String alternativeText = 'Everything is awesome!!'; const String alternativeText = 'Everything is awesome!!';
void main() { void main() {
testWidgets('TextField restoration', (WidgetTester tester) async { testWidgetsWithLeakTracking('TextField restoration', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
const MaterialApp( const MaterialApp(
restorationScopeId: 'app', restorationScopeId: 'app',
...@@ -20,7 +21,7 @@ void main() { ...@@ -20,7 +21,7 @@ void main() {
await restoreAndVerify(tester); await restoreAndVerify(tester);
}); });
testWidgets('TextField restoration with external controller', (WidgetTester tester) async { testWidgetsWithLeakTracking('TextField restoration with external controller', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
const MaterialApp( const MaterialApp(
restorationScopeId: 'root', restorationScopeId: 'root',
...@@ -33,7 +34,7 @@ void main() { ...@@ -33,7 +34,7 @@ void main() {
await restoreAndVerify(tester); await restoreAndVerify(tester);
}); });
testWidgets('State restoration (No Form ancestor) - onUserInteraction error text validation', (WidgetTester tester) async { testWidgetsWithLeakTracking('State restoration (No Form ancestor) - onUserInteraction error text validation', (WidgetTester tester) async {
String? errorText(String? value) => '$value/error'; String? errorText(String? value) => '$value/error';
late GlobalKey<FormFieldState<String>> formState; late GlobalKey<FormFieldState<String>> formState;
...@@ -91,7 +92,7 @@ void main() { ...@@ -91,7 +92,7 @@ void main() {
expect(find.text(errorText('bar')!), findsOneWidget); expect(find.text(errorText('bar')!), findsOneWidget);
}); });
testWidgets('State Restoration (No Form ancestor) - validator sets the error text only when validate is called', (WidgetTester tester) async { testWidgetsWithLeakTracking('State Restoration (No Form ancestor) - validator sets the error text only when validate is called', (WidgetTester tester) async {
String? errorText(String? value) => '$value/error'; String? errorText(String? value) => '$value/error';
late GlobalKey<FormFieldState<String>> formState; late GlobalKey<FormFieldState<String>> formState;
......
...@@ -1233,7 +1233,7 @@ void main() { ...@@ -1233,7 +1233,7 @@ void main() {
expect(editableText.magnifierConfiguration, equals(myTextMagnifierConfiguration)); expect(editableText.magnifierConfiguration, equals(myTextMagnifierConfiguration));
}); });
testWidgets('Passes undoController to undoController TextField', (WidgetTester tester) async { testWidgetsWithLeakTracking('Passes undoController to undoController TextField', (WidgetTester tester) async {
final UndoHistoryController undoController = UndoHistoryController(value: UndoHistoryValue.empty); final UndoHistoryController undoController = UndoHistoryController(value: UndoHistoryValue.empty);
addTearDown(undoController.dispose); addTearDown(undoController.dispose);
......
...@@ -123,7 +123,7 @@ void main() { ...@@ -123,7 +123,7 @@ void main() {
expect(findOverflowButton(), findsOneWidget); expect(findOverflowButton(), findsOneWidget);
}); });
testWidgets('positions itself at anchorAbove if it fits', (WidgetTester tester) async { testWidgetsWithLeakTracking('positions itself at anchorAbove if it fits', (WidgetTester tester) async {
late StateSetter setState; late StateSetter setState;
const double height = 44.0; const double height = 44.0;
const double anchorBelowY = 500.0; const double anchorBelowY = 500.0;
...@@ -172,7 +172,7 @@ void main() { ...@@ -172,7 +172,7 @@ void main() {
expect(toolbarY, equals(anchorAboveY - height - _kToolbarContentDistance)); expect(toolbarY, equals(anchorAboveY - height - _kToolbarContentDistance));
}); });
testWidgets('can create and use a custom toolbar', (WidgetTester tester) async { testWidgetsWithLeakTracking('can create and use a custom toolbar', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
home: Scaffold( home: Scaffold(
......
...@@ -196,7 +196,7 @@ void main() { ...@@ -196,7 +196,7 @@ void main() {
expect(Theme.of(tester.element(find.text('menuItem'))).brightness, equals(Brightness.light)); expect(Theme.of(tester.element(find.text('menuItem'))).brightness, equals(Brightness.light));
}); });
testWidgets('DropdownMenu inherits shadowed app theme', (WidgetTester tester) async { testWidgetsWithLeakTracking('DropdownMenu inherits shadowed app theme', (WidgetTester tester) async {
final Key dropdownMenuButtonKey = UniqueKey(); final Key dropdownMenuButtonKey = UniqueKey();
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
......
...@@ -80,7 +80,7 @@ void main() { ...@@ -80,7 +80,7 @@ void main() {
expect(state.timeOfDay.value, const TimeOfDay(hour: 2, minute: 2)); expect(state.timeOfDay.value, const TimeOfDay(hour: 2, minute: 2));
}); });
testWidgets('restart and restore', (WidgetTester tester) async { testWidgetsWithLeakTracking('restart and restore', (WidgetTester tester) async {
await tester.pumpWidget(const RootRestorationScope( await tester.pumpWidget(const RootRestorationScope(
restorationId: 'root-child', restorationId: 'root-child',
child: _RestorableWidget(), child: _RestorableWidget(),
...@@ -108,7 +108,7 @@ void main() { ...@@ -108,7 +108,7 @@ void main() {
expect(state.timeOfDay.value, const TimeOfDay(hour: 2, minute: 2)); expect(state.timeOfDay.value, const TimeOfDay(hour: 2, minute: 2));
}); });
testWidgets('restore to older state', (WidgetTester tester) async { testWidgetsWithLeakTracking('restore to older state', (WidgetTester tester) async {
await tester.pumpWidget(const RootRestorationScope( await tester.pumpWidget(const RootRestorationScope(
restorationId: 'root-child', restorationId: 'root-child',
child: _RestorableWidget(), child: _RestorableWidget(),
...@@ -139,7 +139,7 @@ void main() { ...@@ -139,7 +139,7 @@ void main() {
expect(state.timeOfDay.value, const TimeOfDay(hour: 10, minute: 5)); expect(state.timeOfDay.value, const TimeOfDay(hour: 10, minute: 5));
}); });
testWidgets('call notifiers when value changes', (WidgetTester tester) async { testWidgetsWithLeakTracking('call notifiers when value changes', (WidgetTester tester) async {
await tester.pumpWidget(const RootRestorationScope( await tester.pumpWidget(const RootRestorationScope(
restorationId: 'root-child', restorationId: 'root-child',
child: _RestorableWidget(), child: _RestorableWidget(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment