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
482b5f63
Unverified
Commit
482b5f63
authored
Mar 24, 2023
by
LongCatIsLooong
Committed by
GitHub
Mar 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unskip #62819 Fixes #12357 (#122945)
Unskip #62819 Fixes #12357
parent
2379b18f
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
59 additions
and
112 deletions
+59
-112
chip_test.dart
packages/flutter/test/material/chip_test.dart
+14
-31
navigation_rail_test.dart
packages/flutter/test/material/navigation_rail_test.dart
+6
-18
outlined_button_test.dart
packages/flutter/test/material/outlined_button_test.dart
+4
-11
text_button_test.dart
packages/flutter/test/material/text_button_test.dart
+5
-13
text_painter_test.dart
packages/flutter/test/painting/text_painter_test.dart
+17
-20
paragraph_test.dart
packages/flutter/test/rendering/paragraph_test.dart
+12
-18
text_test.dart
packages/flutter/test/widgets/text_test.dart
+1
-1
No files found.
packages/flutter/test/material/chip_test.dart
View file @
482b5f63
...
@@ -746,18 +746,16 @@ void main() {
...
@@ -746,18 +746,16 @@ void main() {
),
),
);
);
// TODO(gspencer): Update this test when the font metric bug is fixed to remove the anyOfs.
// https://github.com/flutter/flutter/issues/12357
expect
(
expect
(
tester
.
getSize
(
find
.
text
(
'Chip A'
)),
tester
.
getSize
(
find
.
text
(
'Chip A'
)),
anyOf
(
const
Size
(
84.0
,
14.0
),
const
Size
(
83.0
,
14.0
)
),
const
Size
(
84.0
,
14.0
),
);
);
expect
(
expect
(
tester
.
getSize
(
find
.
text
(
'Chip B'
)),
tester
.
getSize
(
find
.
text
(
'Chip B'
)),
anyOf
(
const
Size
(
84.0
,
14.0
),
const
Size
(
83.0
,
14.0
)
),
const
Size
(
84.0
,
14.0
),
);
);
expect
(
tester
.
getSize
(
find
.
byType
(
Chip
).
first
),
anyOf
(
const
Size
(
132.0
,
48.0
),
const
Size
(
131.0
,
48.0
)
));
expect
(
tester
.
getSize
(
find
.
byType
(
Chip
).
first
),
const
Size
(
132.0
,
48.0
));
expect
(
tester
.
getSize
(
find
.
byType
(
Chip
).
last
),
anyOf
(
const
Size
(
132.0
,
48.0
),
const
Size
(
131.0
,
48.0
)
));
expect
(
tester
.
getSize
(
find
.
byType
(
Chip
).
last
),
const
Size
(
132.0
,
48.0
));
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
wrapForChip
(
wrapForChip
(
...
@@ -777,14 +775,10 @@ void main() {
...
@@ -777,14 +775,10 @@ void main() {
),
),
);
);
// TODO(gspencer): Update this test when the font metric bug is fixed to remove the anyOfs.
expect
(
tester
.
getSize
(
find
.
text
(
'Chip A'
)),
const
Size
(
252.0
,
42.0
));
// https://github.com/flutter/flutter/issues/12357
expect
(
tester
.
getSize
(
find
.
text
(
'Chip B'
)),
const
Size
(
252.0
,
42.0
));
expect
(
tester
.
getSize
(
find
.
text
(
'Chip A'
)),
anyOf
(
const
Size
(
252.0
,
42.0
),
const
Size
(
251.0
,
42.0
)));
expect
(
tester
.
getSize
(
find
.
byType
(
Chip
).
first
),
const
Size
(
310.0
,
50.0
));
expect
(
tester
.
getSize
(
find
.
text
(
'Chip B'
)),
anyOf
(
const
Size
(
252.0
,
42.0
),
const
Size
(
251.0
,
42.0
)));
expect
(
tester
.
getSize
(
find
.
byType
(
Chip
).
last
),
const
Size
(
310.0
,
50.0
));
expect
(
tester
.
getSize
(
find
.
byType
(
Chip
).
first
).
width
,
anyOf
(
310.0
,
311.0
));
expect
(
tester
.
getSize
(
find
.
byType
(
Chip
).
first
).
height
,
equals
(
50.0
));
expect
(
tester
.
getSize
(
find
.
byType
(
Chip
).
last
).
width
,
anyOf
(
310.0
,
311.0
));
expect
(
tester
.
getSize
(
find
.
byType
(
Chip
).
last
).
height
,
equals
(
50.0
));
// Check that individual text scales are taken into account.
// Check that individual text scales are taken into account.
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
@@ -804,13 +798,10 @@ void main() {
...
@@ -804,13 +798,10 @@ void main() {
),
),
);
);
// TODO(gspencer): Update this test when the font metric bug is fixed to remove the anyOfs.
expect
(
tester
.
getSize
(
find
.
text
(
'Chip A'
)),
const
Size
(
252.0
,
42.0
));
// https://github.com/flutter/flutter/issues/12357
expect
(
tester
.
getSize
(
find
.
text
(
'Chip B'
)),
const
Size
(
84.0
,
14.0
));
expect
(
tester
.
getSize
(
find
.
text
(
'Chip A'
)),
anyOf
(
const
Size
(
252.0
,
42.0
),
const
Size
(
251.0
,
42.0
)));
expect
(
tester
.
getSize
(
find
.
byType
(
Chip
).
first
),
const
Size
(
318.0
,
50.0
));
expect
(
tester
.
getSize
(
find
.
text
(
'Chip B'
)),
anyOf
(
const
Size
(
84.0
,
14.0
),
const
Size
(
83.0
,
14.0
)));
expect
(
tester
.
getSize
(
find
.
byType
(
Chip
).
last
),
const
Size
(
132.0
,
48.0
));
expect
(
tester
.
getSize
(
find
.
byType
(
Chip
).
first
).
width
,
anyOf
(
318.0
,
319.0
));
expect
(
tester
.
getSize
(
find
.
byType
(
Chip
).
first
).
height
,
equals
(
50.0
));
expect
(
tester
.
getSize
(
find
.
byType
(
Chip
).
last
),
anyOf
(
const
Size
(
132.0
,
48.0
),
const
Size
(
131.0
,
48.0
)));
});
});
testWidgets
(
'Labels can be non-text widgets'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Labels can be non-text widgets'
,
(
WidgetTester
tester
)
async
{
...
@@ -833,17 +824,9 @@ void main() {
...
@@ -833,17 +824,9 @@ void main() {
),
),
);
);
// TODO(gspencer): Update this test when the font metric bug is fixed to remove the anyOfs.
expect
(
tester
.
getSize
(
find
.
byKey
(
keyA
)),
const
Size
(
84.0
,
14.0
));
// https://github.com/flutter/flutter/issues/12357
expect
(
tester
.
getSize
(
find
.
byKey
(
keyA
)),
anyOf
(
const
Size
(
84.0
,
14.0
),
const
Size
(
83.0
,
14.0
)),
);
expect
(
tester
.
getSize
(
find
.
byKey
(
keyB
)),
const
Size
(
10.0
,
10.0
));
expect
(
tester
.
getSize
(
find
.
byKey
(
keyB
)),
const
Size
(
10.0
,
10.0
));
expect
(
expect
(
tester
.
getSize
(
find
.
byType
(
Chip
).
first
),
const
Size
(
132.0
,
48.0
));
tester
.
getSize
(
find
.
byType
(
Chip
).
first
),
anyOf
(
const
Size
(
132.0
,
48.0
),
const
Size
(
131.0
,
48.0
)),
);
expect
(
tester
.
getSize
(
find
.
byType
(
Chip
).
last
),
const
Size
(
58.0
,
48.0
));
expect
(
tester
.
getSize
(
find
.
byType
(
Chip
).
last
),
const
Size
(
58.0
,
48.0
));
});
});
...
...
packages/flutter/test/material/navigation_rail_test.dart
View file @
482b5f63
...
@@ -577,9 +577,7 @@ void main() {
...
@@ -577,9 +577,7 @@ void main() {
),
),
),
),
);
);
},
});
skip:
isBrowser
,
// https://github.com/flutter/flutter/issues/99786
);
testWidgets
(
'Destination spacing is correct - [labelType]=selected, [textScaleFactor]=3.0'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Destination spacing is correct - [labelType]=selected, [textScaleFactor]=3.0'
,
(
WidgetTester
tester
)
async
{
// Padding at the top of the rail.
// Padding at the top of the rail.
...
@@ -671,9 +669,7 @@ void main() {
...
@@ -671,9 +669,7 @@ void main() {
),
),
),
),
);
);
},
});
skip:
isBrowser
,
// https://github.com/flutter/flutter/issues/99786
);
testWidgets
(
'Destination spacing is correct - [labelType]=selected, [textScaleFactor]=0.75'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Destination spacing is correct - [labelType]=selected, [textScaleFactor]=0.75'
,
(
WidgetTester
tester
)
async
{
// Padding at the top of the rail.
// Padding at the top of the rail.
...
@@ -765,9 +761,7 @@ void main() {
...
@@ -765,9 +761,7 @@ void main() {
),
),
),
),
);
);
},
});
skip:
isBrowser
,
// https://github.com/flutter/flutter/issues/99786
);
testWidgets
(
'Destination spacing is correct - [labelType]=all, [textScaleFactor]=1.0 (default)'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Destination spacing is correct - [labelType]=all, [textScaleFactor]=1.0 (default)'
,
(
WidgetTester
tester
)
async
{
// Padding at the top of the rail.
// Padding at the top of the rail.
...
@@ -858,9 +852,7 @@ void main() {
...
@@ -858,9 +852,7 @@ void main() {
),
),
),
),
);
);
},
});
skip:
isBrowser
,
// https://github.com/flutter/flutter/issues/99786
);
testWidgets
(
'Destination spacing is correct - [labelType]=all, [textScaleFactor]=3.0'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Destination spacing is correct - [labelType]=all, [textScaleFactor]=3.0'
,
(
WidgetTester
tester
)
async
{
// Padding at the top of the rail.
// Padding at the top of the rail.
...
@@ -952,9 +944,7 @@ void main() {
...
@@ -952,9 +944,7 @@ void main() {
),
),
),
),
);
);
},
});
skip:
isBrowser
,
// https://github.com/flutter/flutter/issues/99786
);
testWidgets
(
'Destination spacing is correct - [labelType]=all, [textScaleFactor]=0.75'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Destination spacing is correct - [labelType]=all, [textScaleFactor]=0.75'
,
(
WidgetTester
tester
)
async
{
// Padding at the top of the rail.
// Padding at the top of the rail.
...
@@ -1046,9 +1036,7 @@ void main() {
...
@@ -1046,9 +1036,7 @@ void main() {
),
),
),
),
);
);
},
});
skip:
isBrowser
,
// https://github.com/flutter/flutter/issues/99786
);
testWidgets
(
'Destination spacing is correct for a compact rail - [preferredWidth]=56, [textScaleFactor]=1.0 (default)'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Destination spacing is correct for a compact rail - [preferredWidth]=56, [textScaleFactor]=1.0 (default)'
,
(
WidgetTester
tester
)
async
{
// Padding at the top of the rail.
// Padding at the top of the rail.
...
...
packages/flutter/test/material/outlined_button_test.dart
View file @
482b5f63
...
@@ -1010,10 +1010,7 @@ void main() {
...
@@ -1010,10 +1010,7 @@ void main() {
);
);
expect
(
tester
.
getSize
(
find
.
byType
(
OutlinedButton
)),
equals
(
const
Size
(
88.0
,
48.0
)));
expect
(
tester
.
getSize
(
find
.
byType
(
OutlinedButton
)),
equals
(
const
Size
(
88.0
,
48.0
)));
// Scaled text rendering is different on Linux and Mac by one pixel.
expect
(
tester
.
getSize
(
find
.
byType
(
Text
)),
const
Size
(
55.0
,
18.0
));
// TODO(gspencergoog): Figure out why this is, and fix it. https://github.com/flutter/flutter/issues/12357
expect
(
tester
.
getSize
(
find
.
byType
(
Text
)).
width
,
isIn
(<
double
>[
54.0
,
55.0
]));
expect
(
tester
.
getSize
(
find
.
byType
(
Text
)).
height
,
isIn
(<
double
>[
18.0
,
19.0
]));
// Set text scale large enough to expand text and button.
// Set text scale large enough to expand text and button.
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
@@ -1035,13 +1032,9 @@ void main() {
...
@@ -1035,13 +1032,9 @@ void main() {
),
),
);
);
// Scaled text rendering is different on Linux and Mac by one pixel.
expect
(
tester
.
getSize
(
find
.
byType
(
OutlinedButton
)),
const
Size
(
134.0
,
48.0
));
// TODO(gspencergoog): Figure out why this is, and fix it. https://github.com/flutter/flutter/issues/12357
expect
(
tester
.
getSize
(
find
.
byType
(
Text
)),
const
Size
(
126.0
,
42.0
));
expect
(
tester
.
getSize
(
find
.
byType
(
OutlinedButton
)).
width
,
isIn
(<
double
>[
133.0
,
134.0
]));
},
skip:
kIsWeb
&&
!
isCanvasKit
);
// https://github.com/flutter/flutter/issues/122066
expect
(
tester
.
getSize
(
find
.
byType
(
OutlinedButton
)).
height
,
equals
(
48.0
));
expect
(
tester
.
getSize
(
find
.
byType
(
Text
)).
width
,
isIn
(<
double
>[
126.0
,
127.0
]));
expect
(
tester
.
getSize
(
find
.
byType
(
Text
)).
height
,
equals
(
42.0
));
});
testWidgets
(
'OutlinedButton onPressed and onLongPress callbacks are distinctly recognized'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'OutlinedButton onPressed and onLongPress callbacks are distinctly recognized'
,
(
WidgetTester
tester
)
async
{
bool
didPressButton
=
false
;
bool
didPressButton
=
false
;
...
...
packages/flutter/test/material/text_button_test.dart
View file @
482b5f63
...
@@ -568,12 +568,8 @@ void main() {
...
@@ -568,12 +568,8 @@ void main() {
),
),
);
);
// Scaled text rendering is different on Linux and Mac by one pixel.
expect
(
tester
.
getSize
(
find
.
byType
(
TextButton
)),
const
Size
(
71.0
,
48.0
));
// TODO(gspencergoog): Figure out why this is, and fix it. https://github.com/flutter/flutter/issues/12357
expect
(
tester
.
getSize
(
find
.
byType
(
Text
)),
const
Size
(
55.0
,
18.0
));
expect
(
tester
.
getSize
(
find
.
byType
(
TextButton
)).
width
,
isIn
(<
double
>[
70.0
,
71.0
]));
expect
(
tester
.
getSize
(
find
.
byType
(
TextButton
)).
height
,
isIn
(<
double
>[
47.0
,
48.0
]));
expect
(
tester
.
getSize
(
find
.
byType
(
Text
)).
width
,
isIn
(<
double
>[
54.0
,
55.0
]));
expect
(
tester
.
getSize
(
find
.
byType
(
Text
)).
height
,
isIn
(<
double
>[
18.0
,
19.0
]));
// Set text scale large enough to expand text and button.
// Set text scale large enough to expand text and button.
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
@@ -595,13 +591,9 @@ void main() {
...
@@ -595,13 +591,9 @@ void main() {
),
),
);
);
// Scaled text rendering is different on Linux and Mac by one pixel.
expect
(
tester
.
getSize
(
find
.
byType
(
TextButton
)),
const
Size
(
134.0
,
48.0
));
// TODO(gspencergoog): Figure out why this is, and fix it. https://github.com/flutter/flutter/issues/12357
expect
(
tester
.
getSize
(
find
.
byType
(
Text
)),
const
Size
(
126.0
,
42.0
));
expect
(
tester
.
getSize
(
find
.
byType
(
TextButton
)).
width
,
isIn
(<
double
>[
133.0
,
134.0
]));
},
skip:
kIsWeb
&&
!
isCanvasKit
);
// https://github.com/flutter/flutter/issues/61016
expect
(
tester
.
getSize
(
find
.
byType
(
TextButton
)).
height
,
equals
(
48.0
));
expect
(
tester
.
getSize
(
find
.
byType
(
Text
)).
width
,
isIn
(<
double
>[
126.0
,
127.0
]));
expect
(
tester
.
getSize
(
find
.
byType
(
Text
)).
height
,
equals
(
42.0
));
});
testWidgets
(
'TextButton size is configurable by ThemeData.materialTapTargetSize'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'TextButton size is configurable by ThemeData.materialTapTargetSize'
,
(
WidgetTester
tester
)
async
{
Widget
buildFrame
(
MaterialTapTargetSize
tapTargetSize
,
Key
key
)
{
Widget
buildFrame
(
MaterialTapTargetSize
tapTargetSize
,
Key
key
)
{
...
...
packages/flutter/test/painting/text_painter_test.dart
View file @
482b5f63
...
@@ -8,9 +8,6 @@ import 'package:flutter/foundation.dart';
...
@@ -8,9 +8,6 @@ import 'package:flutter/foundation.dart';
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
const
bool
isCanvasKit
=
bool
.
fromEnvironment
(
'FLUTTER_WEB_USE_SKIA'
);
void
main
(
)
{
void
main
(
)
{
test
(
'TextPainter caret test'
,
()
{
test
(
'TextPainter caret test'
,
()
{
final
TextPainter
painter
=
TextPainter
()
final
TextPainter
painter
=
TextPainter
()
...
@@ -818,25 +815,25 @@ void main() {
...
@@ -818,25 +815,25 @@ void main() {
expect
(
lines
[
2
].
hardBreak
,
true
);
expect
(
lines
[
2
].
hardBreak
,
true
);
expect
(
lines
[
3
].
hardBreak
,
true
);
expect
(
lines
[
3
].
hardBreak
,
true
);
expect
(
lines
[
0
].
ascent
,
1
1.199999809265137
);
expect
(
lines
[
0
].
ascent
,
1
0.5
);
expect
(
lines
[
1
].
ascent
,
1
1.199999809265137
);
expect
(
lines
[
1
].
ascent
,
1
0.5
);
expect
(
lines
[
2
].
ascent
,
1
1.199999809265137
);
expect
(
lines
[
2
].
ascent
,
1
0.5
);
expect
(
lines
[
3
].
ascent
,
1
1.199999809265137
);
expect
(
lines
[
3
].
ascent
,
1
0.5
);
expect
(
lines
[
0
].
descent
,
2.799999952316284
);
expect
(
lines
[
0
].
descent
,
3.5
);
expect
(
lines
[
1
].
descent
,
2.799999952316284
);
expect
(
lines
[
1
].
descent
,
3.5
);
expect
(
lines
[
2
].
descent
,
2.799999952316284
);
expect
(
lines
[
2
].
descent
,
3.5
);
expect
(
lines
[
3
].
descent
,
2.799999952316284
);
expect
(
lines
[
3
].
descent
,
3.5
);
expect
(
lines
[
0
].
unscaledAscent
,
1
1.199999809265137
);
expect
(
lines
[
0
].
unscaledAscent
,
1
0.5
);
expect
(
lines
[
1
].
unscaledAscent
,
1
1.199999809265137
);
expect
(
lines
[
1
].
unscaledAscent
,
1
0.5
);
expect
(
lines
[
2
].
unscaledAscent
,
1
1.199999809265137
);
expect
(
lines
[
2
].
unscaledAscent
,
1
0.5
);
expect
(
lines
[
3
].
unscaledAscent
,
1
1.199999809265137
);
expect
(
lines
[
3
].
unscaledAscent
,
1
0.5
);
expect
(
lines
[
0
].
baseline
,
1
1.200000047683716
);
expect
(
lines
[
0
].
baseline
,
1
0.5
);
expect
(
lines
[
1
].
baseline
,
2
5.200000047683716
);
expect
(
lines
[
1
].
baseline
,
2
4.5
);
expect
(
lines
[
2
].
baseline
,
3
9.200000047683716
);
expect
(
lines
[
2
].
baseline
,
3
8.5
);
expect
(
lines
[
3
].
baseline
,
5
3.200000047683716
);
expect
(
lines
[
3
].
baseline
,
5
2.5
);
expect
(
lines
[
0
].
height
,
14
);
expect
(
lines
[
0
].
height
,
14
);
expect
(
lines
[
1
].
height
,
14
);
expect
(
lines
[
1
].
height
,
14
);
...
@@ -858,7 +855,7 @@ void main() {
...
@@ -858,7 +855,7 @@ void main() {
expect
(
lines
[
2
].
lineNumber
,
2
);
expect
(
lines
[
2
].
lineNumber
,
2
);
expect
(
lines
[
3
].
lineNumber
,
3
);
expect
(
lines
[
3
].
lineNumber
,
3
);
painter
.
dispose
();
painter
.
dispose
();
},
skip:
true
);
// https://github.com/flutter/flutter/issues/62819
},
skip:
kIsWeb
&&
!
isCanvasKit
);
// https://github.com/flutter/flutter/issues/122066
test
(
'TextPainter caret height and line height'
,
()
{
test
(
'TextPainter caret height and line height'
,
()
{
final
TextPainter
painter
=
TextPainter
()
final
TextPainter
painter
=
TextPainter
()
...
...
packages/flutter/test/rendering/paragraph_test.dart
View file @
482b5f63
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
import
'dart:ui'
as
ui
show
BoxHeightStyle
,
BoxWidthStyle
,
Paragraph
,
TextBox
;
import
'dart:ui'
as
ui
show
BoxHeightStyle
,
BoxWidthStyle
,
Paragraph
,
TextBox
;
import
'package:flutter/foundation.dart'
show
isCanvasKit
,
kIsWeb
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
...
@@ -12,7 +13,6 @@ import 'package:flutter_test/flutter_test.dart';
...
@@ -12,7 +13,6 @@ import 'package:flutter_test/flutter_test.dart';
import
'rendering_tester.dart'
;
import
'rendering_tester.dart'
;
const
String
_kText
=
"I polished up that handle so carefullee
\n
That now I am the Ruler of the Queen's Navee!"
;
const
String
_kText
=
"I polished up that handle so carefullee
\n
That now I am the Ruler of the Queen's Navee!"
;
const
bool
isCanvasKit
=
bool
.
fromEnvironment
(
'FLUTTER_WEB_USE_SKIA'
);
// A subclass of RenderParagraph that returns an empty list in getBoxesForSelection
// A subclass of RenderParagraph that returns an empty list in getBoxesForSelection
// for a given TextSelection.
// for a given TextSelection.
...
@@ -148,7 +148,7 @@ void main() {
...
@@ -148,7 +148,7 @@ void main() {
final
RenderParagraph
paragraph
=
RenderParagraph
(
final
RenderParagraph
paragraph
=
RenderParagraph
(
const
TextSpan
(
const
TextSpan
(
text:
'First '
,
text:
'First '
,
style:
TextStyle
(
font
Family:
'FlutterTest'
,
font
Size:
10.0
),
style:
TextStyle
(
fontSize:
10.0
),
children:
<
InlineSpan
>[
children:
<
InlineSpan
>[
TextSpan
(
text:
'smallsecond '
,
style:
TextStyle
(
fontSize:
5.0
)),
TextSpan
(
text:
'smallsecond '
,
style:
TextStyle
(
fontSize:
5.0
)),
TextSpan
(
text:
'third fourth fifth'
),
TextSpan
(
text:
'third fourth fifth'
),
...
@@ -187,7 +187,7 @@ void main() {
...
@@ -187,7 +187,7 @@ void main() {
expect
(
boxes
[
2
],
const
TextBox
.
fromLTRBD
(
0.0
,
10.0
,
130.0
,
20.0
,
TextDirection
.
ltr
));
expect
(
boxes
[
2
],
const
TextBox
.
fromLTRBD
(
0.0
,
10.0
,
130.0
,
20.0
,
TextDirection
.
ltr
));
// 'fifth':
// 'fifth':
expect
(
boxes
[
3
],
const
TextBox
.
fromLTRBD
(
0.0
,
20.0
,
50.0
,
30.0
,
TextDirection
.
ltr
));
expect
(
boxes
[
3
],
const
TextBox
.
fromLTRBD
(
0.0
,
20.0
,
50.0
,
30.0
,
TextDirection
.
ltr
));
},
skip:
!
isLinux
);
// mac typography values can differ https://github.com/flutter/flutter/issues/12357
},
skip:
kIsWeb
&&
!
isCanvasKit
);
// https://github.com/flutter/flutter/issues/61016
test
(
'getBoxesForSelection test with boxHeightStyle and boxWidthStyle set to max'
,
()
{
test
(
'getBoxesForSelection test with boxHeightStyle and boxWidthStyle set to max'
,
()
{
final
RenderParagraph
paragraph
=
RenderParagraph
(
final
RenderParagraph
paragraph
=
RenderParagraph
(
...
@@ -414,10 +414,7 @@ void main() {
...
@@ -414,10 +414,7 @@ void main() {
textScaleFactor:
1.3
,
textScaleFactor:
1.3
,
);
);
paragraph
.
layout
(
const
BoxConstraints
());
paragraph
.
layout
(
const
BoxConstraints
());
// anyOf is needed here because Linux and Mac have different text
expect
(
paragraph
.
size
.
width
,
78.0
);
// rendering widths in tests.
// TODO(gspencergoog): Figure out why this is, and fix it. https://github.com/flutter/flutter/issues/12357
expect
(
paragraph
.
size
.
width
,
anyOf
(
79.0
,
78.0
));
expect
(
paragraph
.
size
.
height
,
26.0
);
expect
(
paragraph
.
size
.
height
,
26.0
);
// Test the sizes of nested spans.
// Test the sizes of nested spans.
...
@@ -430,17 +427,14 @@ void main() {
...
@@ -430,17 +427,14 @@ void main() {
];
];
expect
(
boxes
.
length
,
equals
(
4
));
expect
(
boxes
.
length
,
equals
(
4
));
// anyOf is needed here and below because Linux and Mac have different text
expect
(
boxes
[
0
].
toRect
().
width
,
13.0
);
// rendering widths in tests.
expect
(
boxes
[
0
].
toRect
().
height
,
13.0
);
// TODO(gspencergoog): Figure out why this is, and fix it. https://github.com/flutter/flutter/issues/12357
expect
(
boxes
[
1
].
toRect
().
width
,
26.0
);
expect
(
boxes
[
0
].
toRect
().
width
,
anyOf
(
14.0
,
13.0
));
expect
(
boxes
[
1
].
toRect
().
height
,
26.0
);
expect
(
boxes
[
0
].
toRect
().
height
,
moreOrLessEquals
(
13.0
,
epsilon:
0.0001
));
expect
(
boxes
[
2
].
toRect
().
width
,
26.0
);
expect
(
boxes
[
1
].
toRect
().
width
,
anyOf
(
27.0
,
26.0
));
expect
(
boxes
[
2
].
toRect
().
height
,
26.0
);
expect
(
boxes
[
1
].
toRect
().
height
,
moreOrLessEquals
(
26.0
,
epsilon:
0.0001
));
expect
(
boxes
[
3
].
toRect
().
width
,
13.0
);
expect
(
boxes
[
2
].
toRect
().
width
,
anyOf
(
27.0
,
26.0
));
expect
(
boxes
[
3
].
toRect
().
height
,
13.0
);
expect
(
boxes
[
2
].
toRect
().
height
,
moreOrLessEquals
(
26.0
,
epsilon:
0.0001
));
expect
(
boxes
[
3
].
toRect
().
width
,
anyOf
(
14.0
,
13.0
));
expect
(
boxes
[
3
].
toRect
().
height
,
moreOrLessEquals
(
13.0
,
epsilon:
0.0001
));
});
});
test
(
'toStringDeep'
,
()
{
test
(
'toStringDeep'
,
()
{
...
...
packages/flutter/test/widgets/text_test.dart
View file @
482b5f63
...
@@ -92,7 +92,7 @@ void main() {
...
@@ -92,7 +92,7 @@ void main() {
expect
(
text
,
isNotNull
);
expect
(
text
,
isNotNull
);
expect
(
text
.
textScaleFactor
,
1.3
);
expect
(
text
.
textScaleFactor
,
1.3
);
final
Size
largeSize
=
tester
.
getSize
(
find
.
byType
(
RichText
));
final
Size
largeSize
=
tester
.
getSize
(
find
.
byType
(
RichText
));
expect
(
largeSize
.
width
,
anyOf
(
131.0
,
130.0
)
);
expect
(
largeSize
.
width
,
130.0
);
expect
(
largeSize
.
height
,
equals
(
26.0
));
expect
(
largeSize
.
height
,
equals
(
26.0
));
});
});
...
...
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