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
25d2f90a
Unverified
Commit
25d2f90a
authored
May 23, 2023
by
Tomasz Gucio
Committed by
GitHub
May 23, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid catching errors in TextPainter tests (#127307)
parent
11cb2917
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
24 deletions
+19
-24
text_painter_test.dart
packages/flutter/test/painting/text_painter_test.dart
+19
-24
No files found.
packages/flutter/test/painting/text_painter_test.dart
View file @
25d2f90a
...
...
@@ -368,15 +368,14 @@ void main() {
test
(
'TextPainter error test'
,
()
{
final
TextPainter
painter
=
TextPainter
(
textDirection:
TextDirection
.
ltr
);
Object
?
e
;
try
{
painter
.
paint
(
MockCanvas
(),
Offset
.
zero
);
}
catch
(
exception
)
{
e
=
exception
;
}
expect
(
e
.
toString
(),
contains
(
'TextPainter.paint called when text geometry was not yet calculated'
),
()
=>
painter
.
paint
(
MockCanvas
(),
Offset
.
zero
),
throwsA
(
isA
<
StateError
>().
having
(
(
StateError
error
)
=>
error
.
message
,
'message'
,
contains
(
'TextPainter.paint called when text geometry was not yet calculated'
),
)),
);
painter
.
dispose
();
});
...
...
@@ -1310,15 +1309,13 @@ void main() {
PlaceholderDimensions
(
size:
Size
(
50
,
30
),
alignment:
ui
.
PlaceholderAlignment
.
bottom
),
]);
Object
?
e
;
try
{
painter
.
paint
(
MockCanvas
(),
Offset
.
zero
);
}
catch
(
exception
)
{
e
=
exception
;
}
expect
(
e
.
toString
(),
contains
(
'TextPainter.paint called when text geometry was not yet calculated'
),
()
=>
painter
.
paint
(
MockCanvas
(),
Offset
.
zero
),
throwsA
(
isA
<
StateError
>().
having
(
(
StateError
error
)
=>
error
.
message
,
'message'
,
contains
(
'TextPainter.paint called when text geometry was not yet calculated'
),
)),
);
painter
.
dispose
();
},
skip:
isBrowser
&&
!
isCanvasKit
);
// https://github.com/flutter/flutter/issues/56308
...
...
@@ -1348,16 +1345,14 @@ void main() {
PlaceholderDimensions
(
size:
Size
(
50
,
30
),
alignment:
ui
.
PlaceholderAlignment
.
bottom
),
]);
Object
?
e
;
try
{
painter
.
paint
(
MockCanvas
(),
Offset
.
zero
);
}
catch
(
exception
)
{
e
=
exception
;
}
// In tests, paint() will throw an UnimplementedError due to missing drawParagraph method.
expect
(
e
.
toString
(),
isNot
(
contains
(
'TextPainter.paint called when text geometry was not yet calculated'
)),
()
=>
painter
.
paint
(
MockCanvas
(),
Offset
.
zero
),
isNot
(
throwsA
(
isA
<
StateError
>().
having
(
(
StateError
error
)
=>
error
.
message
,
'message'
,
contains
(
'TextPainter.paint called when text geometry was not yet calculated'
),
))),
);
painter
.
dispose
();
},
skip:
isBrowser
&&
!
isCanvasKit
);
// https://github.com/flutter/flutter/issues/56308
...
...
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