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
d0a72752
Commit
d0a72752
authored
Feb 06, 2018
by
Amir Hardon
Committed by
amirh
Feb 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update buttons_test to expect clipPath instead of clipRRect
parent
c90983dd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
2 deletions
+31
-2
buttons_test.dart
packages/flutter/test/material/buttons_test.dart
+14
-2
mock_canvas.dart
packages/flutter/test/rendering/mock_canvas.dart
+17
-0
No files found.
packages/flutter/test/material/buttons_test.dart
View file @
d0a72752
...
...
@@ -200,10 +200,19 @@ void main() {
await
tester
.
pump
();
// start gesture
await
tester
.
pump
(
const
Duration
(
milliseconds:
200
));
// wait for splash to be well under way
final
Rect
expectedClipRect
=
new
Rect
.
fromLTRB
(
356.0
,
282.0
,
444.0
,
318.0
);
final
Path
expectedClipPath
=
new
Path
()
..
addRRect
(
new
RRect
.
fromRectAndRadius
(
expectedClipRect
,
const
Radius
.
circular
(
2.0
),
));
expect
(
Material
.
of
(
tester
.
element
(
find
.
byType
(
MaterialButton
))),
paints
..
clipRRect
(
rrect:
new
RRect
.
fromLTRBR
(
356.0
,
282.0
,
444.0
,
318.0
,
const
Radius
.
circular
(
2.0
)))
..
clipPath
(
pathMatcher:
coversSameAreaAs
(
expectedClipPath
,
areaToCompare:
expectedClipRect
.
inflate
(
10.0
),
))
..
circle
(
color:
directSplashColor
)
..
rect
(
color:
directHighlightColor
)
);
...
...
@@ -235,7 +244,10 @@ void main() {
expect
(
Material
.
of
(
tester
.
element
(
find
.
byType
(
MaterialButton
))),
paints
..
clipRRect
(
rrect:
new
RRect
.
fromLTRBR
(
356.0
,
282.0
,
444.0
,
318.0
,
const
Radius
.
circular
(
2.0
)))
..
clipPath
(
pathMatcher:
coversSameAreaAs
(
expectedClipPath
,
areaToCompare:
expectedClipRect
.
inflate
(
10.0
),
))
..
circle
(
color:
themeSplashColor1
)
..
rect
(
color:
themeHighlightColor1
)
);
...
...
packages/flutter/test/rendering/mock_canvas.dart
View file @
d0a72752
...
...
@@ -148,6 +148,18 @@ abstract class PaintPattern {
/// [Canvas.clipRect] call are ignored.
void
clipRect
({
Rect
rect
});
/// Indicates that a path clip is expected next.
///
/// The next path clip is examined.
/// The path that is passed to the actual [Canvas.clipPath] call is matched
/// using [pathMatcher].
///
/// If no call to [Canvas.clipPath] was made, then this results in failure.
///
/// Any calls made between the last matched call (if any) and the
/// [Canvas.clipPath] call are ignored.
void
clipPath
({
Matcher
pathMatcher
});
/// Indicates that a rectangle is expected next.
///
/// The next rectangle is examined. Any arguments that are passed to this
...
...
@@ -629,6 +641,11 @@ class _TestRecordingCanvasPatternMatcher extends _TestRecordingCanvasMatcher imp
_predicates
.
add
(
new
_FunctionPaintPredicate
(
#clipRect
,
<
dynamic
>[
rect
]));
}
@override
void
clipPath
({
Matcher
pathMatcher
})
{
_predicates
.
add
(
new
_FunctionPaintPredicate
(
#clipPath
,
<
dynamic
>[
pathMatcher
]));
}
@override
void
rect
({
Rect
rect
,
Color
color
,
double
strokeWidth
,
bool
hasMaskFilter
,
PaintingStyle
style
})
{
_predicates
.
add
(
new
_RectPaintPredicate
(
rect:
rect
,
color:
color
,
strokeWidth:
strokeWidth
,
hasMaskFilter:
hasMaskFilter
,
style:
style
));
...
...
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