Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit eb26d3c

Browse files
canvaskit tests
1 parent e4188c6 commit eb26d3c

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

lib/web_ui/test/canvaskit/text_test.dart

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,42 @@ void testMain() {
9494
expect(await matchImage(tabImage, tofuImage), isFalse);
9595
});
9696

97+
test('kTextHeightNone unsets the height multiplier', () {
98+
const double fontSize = 10;
99+
const String text = 'A';
100+
final ui.ParagraphBuilder builder = ui.ParagraphBuilder(ui.ParagraphStyle(fontSize: fontSize, height: 10));
101+
builder.pushStyle(ui.TextStyle(height: ui.kTextHeightNone));
102+
builder.addText(text);
103+
final ui.Paragraph paragraph = builder.build()
104+
..layout(const ui.ParagraphConstraints(width: 1000));
105+
expect(paragraph.height, fontSize);
106+
});
107+
108+
test('kTextHeightNone ParagraphStyle', () {
109+
const double fontSize = 10;
110+
final ui.ParagraphBuilder builder = ui.ParagraphBuilder(
111+
ui.ParagraphStyle(fontSize: fontSize, height: ui.kTextHeightNone),
112+
);
113+
builder.addText('A');
114+
final ui.Paragraph paragraph = builder.build()
115+
..layout(const ui.ParagraphConstraints(width: 1000));
116+
expect(paragraph.height, fontSize);
117+
});
118+
119+
test('kTextHeightNone StrutStyle', () {
120+
const double fontSize = 10;
121+
final ui.ParagraphBuilder builder = ui.ParagraphBuilder(
122+
ui.ParagraphStyle(
123+
fontSize: 100,
124+
strutStyle: ui.StrutStyle(forceStrutHeight: true, height: ui.KTextHeightNone, fontSize: fontSize),
125+
),
126+
);
127+
builder.addText('A');
128+
final ui.Paragraph paragraph = builder.build()
129+
..layout(const ui.ParagraphConstraints(width: 1000));
130+
expect(paragraph.height, fontSize);
131+
});
132+
97133
group('test fonts in flutterTester environment', () {
98134
final bool resetValue = ui_web.debugEmulateFlutterTesterEnvironment;
99135
ui_web.debugEmulateFlutterTesterEnvironment = true;

0 commit comments

Comments
 (0)