Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
127b90e1
Unverified
Commit
127b90e1
authored
Aug 31, 2023
by
Polina Cherkasova
Committed by
GitHub
Aug 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test cover more tests with leak tracking. (#133712)
parent
c1256d53
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
23 deletions
+30
-23
adaptive_text_selection_toolbar_test.dart
...r/test/material/adaptive_text_selection_toolbar_test.dart
+14
-6
app_bar_test.dart
packages/flutter/test/material/app_bar_test.dart
+1
-1
autocomplete_test.dart
packages/flutter/test/material/autocomplete_test.dart
+13
-14
button_bar_test.dart
packages/flutter/test/material/button_bar_test.dart
+2
-2
No files found.
packages/flutter/test/material/adaptive_text_selection_toolbar_test.dart
View file @
127b90e1
...
@@ -111,8 +111,10 @@ void main() {
...
@@ -111,8 +111,10 @@ void main() {
expect
(
find
.
byKey
(
key
),
findsOneWidget
);
expect
(
find
.
byKey
(
key
),
findsOneWidget
);
});
});
testWidgets
(
'Can build from EditableTextState'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Can build from EditableTextState'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
key
=
GlobalKey
();
final
GlobalKey
key
=
GlobalKey
();
final
TextEditingController
controller
=
TextEditingController
();
final
FocusNode
focusNode
=
FocusNode
();
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
home:
Scaffold
(
home:
Scaffold
(
...
@@ -120,9 +122,9 @@ void main() {
...
@@ -120,9 +122,9 @@ void main() {
child:
SizedBox
(
child:
SizedBox
(
width:
400
,
width:
400
,
child:
EditableText
(
child:
EditableText
(
controller:
TextEditingController
()
,
controller:
controller
,
backgroundCursorColor:
const
Color
(
0xff00ffff
),
backgroundCursorColor:
const
Color
(
0xff00ffff
),
focusNode:
FocusNode
()
,
focusNode:
focusNode
,
style:
const
TextStyle
(),
style:
const
TextStyle
(),
cursorColor:
const
Color
(
0xff00ffff
),
cursorColor:
const
Color
(
0xff00ffff
),
selectionControls:
materialTextSelectionHandleControls
,
selectionControls:
materialTextSelectionHandleControls
,
...
@@ -170,6 +172,8 @@ void main() {
...
@@ -170,6 +172,8 @@ void main() {
case
TargetPlatform
.
macOS
:
case
TargetPlatform
.
macOS
:
expect
(
find
.
byType
(
CupertinoDesktopTextSelectionToolbarButton
),
findsOneWidget
);
expect
(
find
.
byType
(
CupertinoDesktopTextSelectionToolbarButton
),
findsOneWidget
);
}
}
controller
.
dispose
();
focusNode
.
dispose
();
},
},
skip:
kIsWeb
,
// [intended] on web the browser handles the context menu.
skip:
kIsWeb
,
// [intended] on web the browser handles the context menu.
variant:
TargetPlatformVariant
.
all
(),
variant:
TargetPlatformVariant
.
all
(),
...
@@ -233,13 +237,14 @@ void main() {
...
@@ -233,13 +237,14 @@ void main() {
);
);
group
(
'buttonItems'
,
()
{
group
(
'buttonItems'
,
()
{
testWidgets
(
'getEditableTextButtonItems builds the correct button items per-platform'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'getEditableTextButtonItems builds the correct button items per-platform'
,
(
WidgetTester
tester
)
async
{
// Fill the clipboard so that the Paste option is available in the text
// Fill the clipboard so that the Paste option is available in the text
// selection menu.
// selection menu.
await
Clipboard
.
setData
(
const
ClipboardData
(
text:
'Clipboard data'
));
await
Clipboard
.
setData
(
const
ClipboardData
(
text:
'Clipboard data'
));
Set
<
ContextMenuButtonType
>
buttonTypes
=
<
ContextMenuButtonType
>{};
Set
<
ContextMenuButtonType
>
buttonTypes
=
<
ContextMenuButtonType
>{};
final
TextEditingController
controller
=
TextEditingController
();
final
TextEditingController
controller
=
TextEditingController
();
final
FocusNode
focusNode
=
FocusNode
();
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
...
@@ -248,7 +253,7 @@ void main() {
...
@@ -248,7 +253,7 @@ void main() {
child:
EditableText
(
child:
EditableText
(
controller:
controller
,
controller:
controller
,
backgroundCursorColor:
Colors
.
grey
,
backgroundCursorColor:
Colors
.
grey
,
focusNode:
FocusNode
()
,
focusNode:
focusNode
,
style:
const
TextStyle
(),
style:
const
TextStyle
(),
cursorColor:
Colors
.
red
,
cursorColor:
Colors
.
red
,
selectionControls:
materialTextSelectionHandleControls
,
selectionControls:
materialTextSelectionHandleControls
,
...
@@ -323,12 +328,15 @@ void main() {
...
@@ -323,12 +328,15 @@ void main() {
case
TargetPlatform
.
macOS
:
case
TargetPlatform
.
macOS
:
expect
(
buttonTypes
,
isNot
(
contains
(
ContextMenuButtonType
.
selectAll
)));
expect
(
buttonTypes
,
isNot
(
contains
(
ContextMenuButtonType
.
selectAll
)));
}
}
focusNode
.
dispose
();
controller
.
dispose
();
},
},
variant:
TargetPlatformVariant
.
all
(),
variant:
TargetPlatformVariant
.
all
(),
skip:
kIsWeb
,
// [intended]
skip:
kIsWeb
,
// [intended]
);
);
testWidgets
(
'getAdaptiveButtons builds the correct button widgets per-platform'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'getAdaptiveButtons builds the correct button widgets per-platform'
,
(
WidgetTester
tester
)
async
{
const
String
buttonText
=
'Click me'
;
const
String
buttonText
=
'Click me'
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
...
packages/flutter/test/material/app_bar_test.dart
View file @
127b90e1
...
@@ -3360,7 +3360,7 @@ void main() {
...
@@ -3360,7 +3360,7 @@ void main() {
expect
(
tester
.
getRect
(
find
.
byKey
(
key
)),
const
Rect
.
fromLTRB
(
0
,
0
,
100
,
56
));
expect
(
tester
.
getRect
(
find
.
byKey
(
key
)),
const
Rect
.
fromLTRB
(
0
,
0
,
100
,
56
));
});
});
testWidgets
(
"AppBar with EndDrawer doesn't have leading"
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
"AppBar with EndDrawer doesn't have leading"
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
home:
Scaffold
(
appBar:
AppBar
(),
appBar:
AppBar
(),
...
...
packages/flutter/test/material/autocomplete_test.dart
View file @
127b90e1
...
@@ -47,7 +47,6 @@ void main() {
...
@@ -47,7 +47,6 @@ void main() {
];
];
testWidgetsWithLeakTracking
(
'can filter and select a list of string options'
,
(
WidgetTester
tester
)
async
{
testWidgetsWithLeakTracking
(
'can filter and select a list of string options'
,
(
WidgetTester
tester
)
async
{
late
String
lastSelection
;
late
String
lastSelection
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
...
@@ -107,7 +106,7 @@ void main() {
...
@@ -107,7 +106,7 @@ void main() {
expect
(
list
.
semanticChildCount
,
6
);
expect
(
list
.
semanticChildCount
,
6
);
});
});
testWidgets
(
'can filter and select a list of custom User options'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'can filter and select a list of custom User options'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
home:
Scaffold
(
home:
Scaffold
(
...
@@ -161,7 +160,7 @@ void main() {
...
@@ -161,7 +160,7 @@ void main() {
expect
(
list
.
semanticChildCount
,
1
);
expect
(
list
.
semanticChildCount
,
1
);
});
});
testWidgets
(
'displayStringForOption is displayed in the options'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'displayStringForOption is displayed in the options'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
home:
Scaffold
(
home:
Scaffold
(
...
@@ -204,7 +203,7 @@ void main() {
...
@@ -204,7 +203,7 @@ void main() {
expect
(
field
.
controller
!.
text
,
kOptionsUsers
.
first
.
name
);
expect
(
field
.
controller
!.
text
,
kOptionsUsers
.
first
.
name
);
});
});
testWidgets
(
'can build a custom field'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'can build a custom field'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
fieldKey
=
GlobalKey
();
final
GlobalKey
fieldKey
=
GlobalKey
();
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
...
@@ -228,7 +227,7 @@ void main() {
...
@@ -228,7 +227,7 @@ void main() {
expect
(
find
.
byType
(
TextFormField
),
findsNothing
);
expect
(
find
.
byType
(
TextFormField
),
findsNothing
);
});
});
testWidgets
(
'can build custom options'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'can build custom options'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
optionsKey
=
GlobalKey
();
final
GlobalKey
optionsKey
=
GlobalKey
();
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
...
@@ -257,7 +256,7 @@ void main() {
...
@@ -257,7 +256,7 @@ void main() {
expect
(
find
.
byKey
(
optionsKey
),
findsOneWidget
);
expect
(
find
.
byKey
(
optionsKey
),
findsOneWidget
);
});
});
testWidgets
(
'the default Autocomplete options widget has a maximum height of 200'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'the default Autocomplete options widget has a maximum height of 200'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Autocomplete
<
String
>(
body:
Autocomplete
<
String
>(
optionsBuilder:
(
TextEditingValue
textEditingValue
)
{
optionsBuilder:
(
TextEditingValue
textEditingValue
)
{
...
@@ -278,7 +277,7 @@ void main() {
...
@@ -278,7 +277,7 @@ void main() {
expect
(
resultingHeight
,
equals
(
200
));
expect
(
resultingHeight
,
equals
(
200
));
});
});
testWidgets
(
'the options height restricts to max desired height'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'the options height restricts to max desired height'
,
(
WidgetTester
tester
)
async
{
const
double
desiredHeight
=
150.0
;
const
double
desiredHeight
=
150.0
;
await
tester
.
pumpWidget
(
MaterialApp
(
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
home:
Scaffold
(
...
@@ -307,7 +306,7 @@ void main() {
...
@@ -307,7 +306,7 @@ void main() {
expect
(
resultingHeight
,
equals
(
desiredHeight
));
expect
(
resultingHeight
,
equals
(
desiredHeight
));
});
});
testWidgets
(
'The height of options shrinks to height of resulting items, if less than maxHeight'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'The height of options shrinks to height of resulting items, if less than maxHeight'
,
(
WidgetTester
tester
)
async
{
// Returns a Future with the height of the default [Autocomplete] options widget
// Returns a Future with the height of the default [Autocomplete] options widget
// after the provided text had been entered into the [Autocomplete] field.
// after the provided text had been entered into the [Autocomplete] field.
Future
<
double
>
getDefaultOptionsHeight
(
Future
<
double
>
getDefaultOptionsHeight
(
...
@@ -355,7 +354,7 @@ void main() {
...
@@ -355,7 +354,7 @@ void main() {
expect
(
oneItemsHeight
,
lessThan
(
twoItemsHeight
));
expect
(
oneItemsHeight
,
lessThan
(
twoItemsHeight
));
});
});
testWidgets
(
'initialValue sets initial text field value'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'initialValue sets initial text field value'
,
(
WidgetTester
tester
)
async
{
late
String
lastSelection
;
late
String
lastSelection
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
...
@@ -416,7 +415,7 @@ void main() {
...
@@ -416,7 +415,7 @@ void main() {
}
}
}
}
testWidgets
(
'keyboard navigation of the options properly highlights the option'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'keyboard navigation of the options properly highlights the option'
,
(
WidgetTester
tester
)
async
{
const
Color
highlightColor
=
Color
(
0xFF112233
);
const
Color
highlightColor
=
Color
(
0xFF112233
);
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
...
@@ -455,7 +454,7 @@ void main() {
...
@@ -455,7 +454,7 @@ void main() {
checkOptionHighlight
(
tester
,
'elephant'
,
highlightColor
);
checkOptionHighlight
(
tester
,
'elephant'
,
highlightColor
);
});
});
testWidgets
(
'keyboard navigation keeps the highlighted option scrolled into view'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'keyboard navigation keeps the highlighted option scrolled into view'
,
(
WidgetTester
tester
)
async
{
const
Color
highlightColor
=
Color
(
0xFF112233
);
const
Color
highlightColor
=
Color
(
0xFF112233
);
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
...
@@ -519,7 +518,7 @@ void main() {
...
@@ -519,7 +518,7 @@ void main() {
});
});
group
(
'optionsViewOpenDirection'
,
()
{
group
(
'optionsViewOpenDirection'
,
()
{
testWidgets
(
'default (down)'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'default (down)'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
home:
Scaffold
(
home:
Scaffold
(
...
@@ -534,7 +533,7 @@ void main() {
...
@@ -534,7 +533,7 @@ void main() {
expect
(
actual
,
equals
(
OptionsViewOpenDirection
.
down
));
expect
(
actual
,
equals
(
OptionsViewOpenDirection
.
down
));
});
});
testWidgets
(
'down'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'down'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
home:
Scaffold
(
home:
Scaffold
(
...
@@ -550,7 +549,7 @@ void main() {
...
@@ -550,7 +549,7 @@ void main() {
expect
(
actual
,
equals
(
OptionsViewOpenDirection
.
down
));
expect
(
actual
,
equals
(
OptionsViewOpenDirection
.
down
));
});
});
testWidgets
(
'up'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'up'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
home:
Scaffold
(
home:
Scaffold
(
...
...
packages/flutter/test/material/button_bar_test.dart
View file @
127b90e1
...
@@ -340,7 +340,7 @@ void main() {
...
@@ -340,7 +340,7 @@ void main() {
group
(
'layoutBehavior'
,
()
{
group
(
'layoutBehavior'
,
()
{
testWidgets
(
'ButtonBar has a min height of 52 when using ButtonBarLayoutBehavior.constrained'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'ButtonBar has a min height of 52 when using ButtonBarLayoutBehavior.constrained'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
const
SingleChildScrollView
(
const
SingleChildScrollView
(
child:
ListBody
(
child:
ListBody
(
...
@@ -363,7 +363,7 @@ void main() {
...
@@ -363,7 +363,7 @@ void main() {
expect
(
tester
.
getBottomRight
(
buttonBar
).
dy
-
tester
.
getTopRight
(
buttonBar
).
dy
,
52.0
);
expect
(
tester
.
getBottomRight
(
buttonBar
).
dy
-
tester
.
getTopRight
(
buttonBar
).
dy
,
52.0
);
});
});
testWidgets
(
'ButtonBar has padding applied when using ButtonBarLayoutBehavior.padded'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'ButtonBar has padding applied when using ButtonBarLayoutBehavior.padded'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
const
SingleChildScrollView
(
const
SingleChildScrollView
(
child:
ListBody
(
child:
ListBody
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment