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
Hide 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() {
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
TextEditingController
controller
=
TextEditingController
();
final
FocusNode
focusNode
=
FocusNode
();
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
...
...
@@ -120,9 +122,9 @@ void main() {
child:
SizedBox
(
width:
400
,
child:
EditableText
(
controller:
TextEditingController
()
,
controller:
controller
,
backgroundCursorColor:
const
Color
(
0xff00ffff
),
focusNode:
FocusNode
()
,
focusNode:
focusNode
,
style:
const
TextStyle
(),
cursorColor:
const
Color
(
0xff00ffff
),
selectionControls:
materialTextSelectionHandleControls
,
...
...
@@ -170,6 +172,8 @@ void main() {
case
TargetPlatform
.
macOS
:
expect
(
find
.
byType
(
CupertinoDesktopTextSelectionToolbarButton
),
findsOneWidget
);
}
controller
.
dispose
();
focusNode
.
dispose
();
},
skip:
kIsWeb
,
// [intended] on web the browser handles the context menu.
variant:
TargetPlatformVariant
.
all
(),
...
...
@@ -233,13 +237,14 @@ void main() {
);
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
// selection menu.
await
Clipboard
.
setData
(
const
ClipboardData
(
text:
'Clipboard data'
));
Set
<
ContextMenuButtonType
>
buttonTypes
=
<
ContextMenuButtonType
>{};
final
TextEditingController
controller
=
TextEditingController
();
final
FocusNode
focusNode
=
FocusNode
();
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -248,7 +253,7 @@ void main() {
child:
EditableText
(
controller:
controller
,
backgroundCursorColor:
Colors
.
grey
,
focusNode:
FocusNode
()
,
focusNode:
focusNode
,
style:
const
TextStyle
(),
cursorColor:
Colors
.
red
,
selectionControls:
materialTextSelectionHandleControls
,
...
...
@@ -323,12 +328,15 @@ void main() {
case
TargetPlatform
.
macOS
:
expect
(
buttonTypes
,
isNot
(
contains
(
ContextMenuButtonType
.
selectAll
)));
}
focusNode
.
dispose
();
controller
.
dispose
();
},
variant:
TargetPlatformVariant
.
all
(),
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'
;
await
tester
.
pumpWidget
(
...
...
packages/flutter/test/material/app_bar_test.dart
View file @
127b90e1
...
...
@@ -3360,7 +3360,7 @@ void main() {
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
(
home:
Scaffold
(
appBar:
AppBar
(),
...
...
packages/flutter/test/material/autocomplete_test.dart
View file @
127b90e1
...
...
@@ -47,7 +47,6 @@ void main() {
];
testWidgetsWithLeakTracking
(
'can filter and select a list of string options'
,
(
WidgetTester
tester
)
async
{
late
String
lastSelection
;
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -107,7 +106,7 @@ void main() {
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
(
MaterialApp
(
home:
Scaffold
(
...
...
@@ -161,7 +160,7 @@ void main() {
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
(
MaterialApp
(
home:
Scaffold
(
...
...
@@ -204,7 +203,7 @@ void main() {
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
();
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -228,7 +227,7 @@ void main() {
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
();
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -257,7 +256,7 @@ void main() {
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
(
body:
Autocomplete
<
String
>(
optionsBuilder:
(
TextEditingValue
textEditingValue
)
{
...
...
@@ -278,7 +277,7 @@ void main() {
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
;
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
...
...
@@ -307,7 +306,7 @@ void main() {
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
// after the provided text had been entered into the [Autocomplete] field.
Future
<
double
>
getDefaultOptionsHeight
(
...
...
@@ -355,7 +354,7 @@ void main() {
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
;
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -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
);
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -455,7 +454,7 @@ void main() {
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
);
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -519,7 +518,7 @@ void main() {
});
group
(
'optionsViewOpenDirection'
,
()
{
testWidgets
(
'default (down)'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'default (down)'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
...
...
@@ -534,7 +533,7 @@ void main() {
expect
(
actual
,
equals
(
OptionsViewOpenDirection
.
down
));
});
testWidgets
(
'down'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'down'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
...
...
@@ -550,7 +549,7 @@ void main() {
expect
(
actual
,
equals
(
OptionsViewOpenDirection
.
down
));
});
testWidgets
(
'up'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'up'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
...
...
packages/flutter/test/material/button_bar_test.dart
View file @
127b90e1
...
...
@@ -340,7 +340,7 @@ void main() {
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
(
const
SingleChildScrollView
(
child:
ListBody
(
...
...
@@ -363,7 +363,7 @@ void main() {
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
(
const
SingleChildScrollView
(
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