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
f2d5f1f6
Unverified
Commit
f2d5f1f6
authored
Oct 14, 2020
by
xubaolin
Committed by
GitHub
Oct 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test case for AndroidView clipBehavior (#67913)
parent
a82807d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
platform_view_test.dart
packages/flutter/test/widgets/platform_view_test.dart
+38
-0
No files found.
packages/flutter/test/widgets/platform_view_test.dart
View file @
f2d5f1f6
...
...
@@ -1149,6 +1149,44 @@ void main() {
expect
(
renderObject
.
clipBehavior
,
clip
);
}
});
testWidgets
(
'clip is handled correctly during resizing'
,
(
WidgetTester
tester
)
async
{
// Regressing test for https://github.com/flutter/flutter/issues/67343
Widget
buildView
(
double
width
,
double
height
,
Clip
clipBehavior
)
{
return
Center
(
child:
SizedBox
(
width:
width
,
height:
height
,
child:
AndroidView
(
viewType:
'webview'
,
layoutDirection:
TextDirection
.
ltr
,
clipBehavior:
clipBehavior
,
),
),
);
}
await
tester
.
pumpWidget
(
buildView
(
200.0
,
200.0
,
Clip
.
none
));
// Resize the view.
await
tester
.
pumpWidget
(
buildView
(
100.0
,
100.0
,
Clip
.
none
));
// No clip happen when the clip behavior is `Clip.none` .
expect
(
tester
.
layers
.
whereType
<
ClipRectLayer
>(),
hasLength
(
0
));
// No clip when only the clip behavior changes while the size remains the same.
await
tester
.
pumpWidget
(
buildView
(
100.0
,
100.0
,
Clip
.
hardEdge
));
expect
(
tester
.
layers
.
whereType
<
ClipRectLayer
>(),
hasLength
(
0
));
// Resize trigger clip when the clip behavior is not `Clip.none` .
await
tester
.
pumpWidget
(
buildView
(
50.0
,
100.0
,
Clip
.
hardEdge
));
expect
(
tester
.
layers
.
whereType
<
ClipRectLayer
>(),
hasLength
(
1
));
ClipRectLayer
clipRectLayer
=
tester
.
layers
.
whereType
<
ClipRectLayer
>().
first
;
expect
(
clipRectLayer
.
clipRect
,
const
Rect
.
fromLTWH
(
0.0
,
0.0
,
50.0
,
100.0
));
await
tester
.
pumpWidget
(
buildView
(
50.0
,
50.0
,
Clip
.
hardEdge
));
expect
(
tester
.
layers
.
whereType
<
ClipRectLayer
>(),
hasLength
(
1
));
clipRectLayer
=
tester
.
layers
.
whereType
<
ClipRectLayer
>().
first
;
expect
(
clipRectLayer
.
clipRect
,
const
Rect
.
fromLTWH
(
0.0
,
0.0
,
50.0
,
50.0
));
});
});
group
(
'AndroidViewSurface'
,
()
{
...
...
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