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
25f44bb2
Unverified
Commit
25f44bb2
authored
Oct 01, 2020
by
Dan Field
Committed by
GitHub
Oct 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test (#67021)
parent
19e07d2b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
0 deletions
+83
-0
scrollable_test.dart
packages/flutter/test/widgets/scrollable_test.dart
+83
-0
No files found.
packages/flutter/test/widgets/scrollable_test.dart
View file @
25f44bb2
...
...
@@ -834,6 +834,89 @@ void main() {
expect
(
expensiveWidgets
,
0
);
expect
(
cheapWidgets
,
58
);
});
testWidgets
(
'ensureVisible does not move PageViews'
,
(
WidgetTester
tester
)
async
{
final
PageController
controller
=
PageController
();
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
PageView
(
controller:
controller
,
children:
List
<
ListView
>.
generate
(
3
,
(
int
pageIndex
)
{
return
ListView
(
key:
Key
(
'list_
$pageIndex
'
),
children:
List
<
Widget
>.
generate
(
100
,
(
int
listIndex
)
{
return
Row
(
children:
<
Widget
>[
Container
(
key:
Key
(
'
${pageIndex}
_
${listIndex}
_0'
),
color:
Colors
.
red
,
width:
200
,
height:
10
,
),
Container
(
key:
Key
(
'
${pageIndex}
_
${listIndex}
_1'
),
color:
Colors
.
blue
,
width:
200
,
height:
10
,
),
Container
(
key:
Key
(
'
${pageIndex}
_
${listIndex}
_2'
),
color:
Colors
.
green
,
width:
200
,
height:
10
,
),
]
);
}
),
);
}
)
),
),
);
final
Finder
targetMidRightPage0
=
find
.
byKey
(
const
Key
(
'0_25_2'
));
final
Finder
targetMidRightPage1
=
find
.
byKey
(
const
Key
(
'1_25_2'
));
final
Finder
targetMidLeftPage1
=
find
.
byKey
(
const
Key
(
'1_25_0'
));
expect
(
find
.
byKey
(
const
Key
(
'list_0'
)),
findsOneWidget
);
expect
(
find
.
byKey
(
const
Key
(
'list_1'
)),
findsNothing
);
expect
(
targetMidRightPage0
,
findsOneWidget
);
expect
(
targetMidRightPage1
,
findsNothing
);
expect
(
targetMidLeftPage1
,
findsNothing
);
await
tester
.
ensureVisible
(
targetMidRightPage0
);
await
tester
.
pumpAndSettle
();
expect
(
targetMidRightPage0
,
findsOneWidget
);
expect
(
targetMidRightPage1
,
findsNothing
);
expect
(
targetMidLeftPage1
,
findsNothing
);
controller
.
jumpToPage
(
1
);
await
tester
.
pumpAndSettle
();
expect
(
find
.
byKey
(
const
Key
(
'list_0'
)),
findsNothing
);
expect
(
find
.
byKey
(
const
Key
(
'list_1'
)),
findsOneWidget
);
await
tester
.
ensureVisible
(
targetMidRightPage1
);
await
tester
.
pumpAndSettle
();
expect
(
targetMidRightPage0
,
findsNothing
);
expect
(
targetMidRightPage1
,
findsOneWidget
);
expect
(
targetMidLeftPage1
,
findsOneWidget
);
await
tester
.
ensureVisible
(
targetMidLeftPage1
);
await
tester
.
pumpAndSettle
();
expect
(
targetMidRightPage0
,
findsNothing
);
expect
(
targetMidRightPage1
,
findsOneWidget
);
expect
(
targetMidLeftPage1
,
findsOneWidget
);
});
}
// ignore: must_be_immutable
...
...
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