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
715916fe
Unverified
Commit
715916fe
authored
Dec 12, 2017
by
Ian Hickson
Committed by
GitHub
Dec 12, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests for TextPainter.minIntrinsicWidth (#13515)
parent
8f65fec5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
86 additions
and
0 deletions
+86
-0
text_painter_test.dart
packages/flutter/test/painting/text_painter_test.dart
+86
-0
No files found.
packages/flutter/test/painting/text_painter_test.dart
View file @
715916fe
...
...
@@ -93,4 +93,90 @@ void main() {
expect
(
painter
.
preferredLineHeight
,
100.0
);
expect
(
painter
.
size
,
const
Size
(
100.0
,
100.0
));
});
test
(
'TextPainter intrinsic dimensions'
,
()
{
const
TextStyle
style
=
const
TextStyle
(
inherit:
false
,
fontFamily:
'Ahem'
,
fontSize:
10.0
,
);
TextPainter
painter
;
painter
=
new
TextPainter
(
text:
const
TextSpan
(
text:
'X X X'
,
style:
style
,
),
textDirection:
TextDirection
.
ltr
,
);
painter
.
layout
();
expect
(
painter
.
size
,
const
Size
(
50.0
,
10.0
));
expect
(
painter
.
minIntrinsicWidth
,
10.0
);
expect
(
painter
.
maxIntrinsicWidth
,
50.0
);
painter
=
new
TextPainter
(
text:
const
TextSpan
(
text:
'X X X'
,
style:
style
,
),
textDirection:
TextDirection
.
ltr
,
ellipsis:
'e'
,
);
painter
.
layout
();
expect
(
painter
.
size
,
const
Size
(
50.0
,
10.0
));
expect
(
painter
.
minIntrinsicWidth
,
50.0
);
expect
(
painter
.
maxIntrinsicWidth
,
50.0
);
painter
=
new
TextPainter
(
text:
const
TextSpan
(
text:
'X X XXXX'
,
style:
style
,
),
textDirection:
TextDirection
.
ltr
,
maxLines:
2
,
);
painter
.
layout
();
expect
(
painter
.
size
,
const
Size
(
80.0
,
10.0
));
expect
(
painter
.
minIntrinsicWidth
,
40.0
);
expect
(
painter
.
maxIntrinsicWidth
,
80.0
);
painter
=
new
TextPainter
(
text:
const
TextSpan
(
text:
'X X XXXX XX'
,
style:
style
,
),
textDirection:
TextDirection
.
ltr
,
maxLines:
2
,
);
painter
.
layout
();
expect
(
painter
.
size
,
const
Size
(
110.0
,
10.0
));
expect
(
painter
.
minIntrinsicWidth
,
70.0
);
expect
(
painter
.
maxIntrinsicWidth
,
110.0
);
painter
=
new
TextPainter
(
text:
const
TextSpan
(
text:
'XXXXXXXX XXXX XX X'
,
style:
style
,
),
textDirection:
TextDirection
.
ltr
,
maxLines:
2
,
);
painter
.
layout
();
expect
(
painter
.
size
,
const
Size
(
180.0
,
10.0
));
expect
(
painter
.
minIntrinsicWidth
,
90.0
);
expect
(
painter
.
maxIntrinsicWidth
,
180.0
);
painter
=
new
TextPainter
(
text:
const
TextSpan
(
text:
'X XX XXXX XXXXXXXX'
,
style:
style
,
),
textDirection:
TextDirection
.
ltr
,
maxLines:
2
,
);
painter
.
layout
();
expect
(
painter
.
size
,
const
Size
(
180.0
,
10.0
));
expect
(
painter
.
minIntrinsicWidth
,
90.0
);
expect
(
painter
.
maxIntrinsicWidth
,
180.0
);
},
skip:
true
);
// https://github.com/flutter/flutter/issues/13512
}
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