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
e7fbee66
Commit
e7fbee66
authored
Sep 11, 2017
by
Ian Hickson
Committed by
GitHub
Sep 11, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix clip debugPaint (TextPainter RTL fallout) (#12026)
parent
4262c1e9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
21 deletions
+58
-21
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+1
-0
mock_canvas.dart
packages/flutter/test/rendering/mock_canvas.dart
+33
-21
clip_test.dart
packages/flutter/test/widgets/clip_test.dart
+24
-0
No files found.
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
e7fbee66
...
...
@@ -1039,6 +1039,7 @@ abstract class _RenderCustomClip<T> extends RenderProxyBox {
fontSize:
14.0
,
),
),
textDirection:
TextDirection
.
rtl
,
// doesn't matter, it's one character
)
..
layout
();
return
true
;
...
...
packages/flutter/test/rendering/mock_canvas.dart
View file @
e7fbee66
...
...
@@ -260,34 +260,46 @@ abstract class _TestRecordingCanvasMatcher extends Matcher {
bool
matches
(
Object
object
,
Map
<
dynamic
,
dynamic
>
matchState
)
{
final
TestRecordingCanvas
canvas
=
new
TestRecordingCanvas
();
final
TestRecordingPaintingContext
context
=
new
TestRecordingPaintingContext
(
canvas
);
if
(
object
is
_ContextPainterFunction
)
{
final
_ContextPainterFunction
function
=
object
;
function
(
context
,
Offset
.
zero
);
}
else
if
(
object
is
_CanvasPainterFunction
)
{
final
_CanvasPainterFunction
function
=
object
;
function
(
canvas
);
}
else
{
if
(
object
is
Finder
)
{
TestAsyncUtils
.
guardSync
();
final
Finder
finder
=
object
;
object
=
finder
.
evaluate
().
single
.
renderObject
;
}
if
(
object
is
RenderObject
)
{
final
RenderObject
renderObject
=
object
;
renderObject
.
paint
(
context
,
Offset
.
zero
);
final
StringBuffer
description
=
new
StringBuffer
();
String
prefixMessage
=
'unexpectedly failed.'
;
bool
result
=
false
;
try
{
if
(
object
is
_ContextPainterFunction
)
{
final
_ContextPainterFunction
function
=
object
;
function
(
context
,
Offset
.
zero
);
}
else
if
(
object
is
_CanvasPainterFunction
)
{
final
_CanvasPainterFunction
function
=
object
;
function
(
canvas
);
}
else
{
matchState
[
this
]
=
'was not one of the supported objects for the "paints" matcher.'
;
return
false
;
if
(
object
is
Finder
)
{
TestAsyncUtils
.
guardSync
();
final
Finder
finder
=
object
;
object
=
finder
.
evaluate
().
single
.
renderObject
;
}
if
(
object
is
RenderObject
)
{
final
RenderObject
renderObject
=
object
;
renderObject
.
paint
(
context
,
Offset
.
zero
);
}
else
{
matchState
[
this
]
=
'was not one of the supported objects for the "paints" matcher.'
;
return
false
;
}
}
result
=
_evaluatePredicates
(
canvas
.
invocations
,
description
);
if
(!
result
)
prefixMessage
=
'did not match the pattern.'
;
}
catch
(
error
,
stack
)
{
prefixMessage
=
'threw the following exception:'
;
description
.
writeln
(
error
.
toString
());
description
.
write
(
stack
.
toString
());
result
=
false
;
}
final
StringBuffer
description
=
new
StringBuffer
();
final
bool
result
=
_evaluatePredicates
(
canvas
.
invocations
,
description
);
if
(!
result
)
{
if
(
canvas
.
invocations
.
isNotEmpty
)
if
(
canvas
.
invocations
.
isNotEmpty
)
{
description
.
write
(
'The complete display list was:'
);
for
(
RecordedInvocation
call
in
canvas
.
invocations
)
description
.
write
(
'
\n
*
$call
'
);
matchState
[
this
]
=
'did not match the pattern.
\n
$description
'
;
}
matchState
[
this
]
=
'
$prefixMessage
\n
$description
'
;
}
return
result
;
}
...
...
packages/flutter/test/widgets/clip_test.dart
View file @
e7fbee66
...
...
@@ -4,6 +4,9 @@
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'../rendering/mock_canvas.dart'
;
final
List
<
String
>
log
=
<
String
>[];
...
...
@@ -223,4 +226,25 @@ void main() {
expect
(
log
,
equals
(<
String
>[
'a'
,
'tap'
,
'a'
,
'b'
,
'c'
,
'tap'
]));
});
testWidgets
(
'debugPaintSizeEnabled'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
ClipRect
(
child:
const
Placeholder
(),
),
);
expect
(
tester
.
renderObject
(
find
.
byType
(
ClipRect
)).
paint
,
paints
..
save
()
..
clipRect
(
rect:
new
Rect
.
fromLTRB
(
0.0
,
0.0
,
800.0
,
600.0
))
..
save
()
..
path
()
// Placeholder
..
restore
()
..
restore
()
);
debugPaintSizeEnabled
=
true
;
expect
(
tester
.
renderObject
(
find
.
byType
(
ClipRect
)).
debugPaint
,
paints
// ignore: INVALID_USE_OF_PROTECTED_MEMBER
..
rect
(
rect:
new
Rect
.
fromLTRB
(
0.0
,
0.0
,
800.0
,
600.0
))
..
paragraph
()
);
debugPaintSizeEnabled
=
false
;
});
}
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