-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/engine
#40188Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: typographyText rendering, possibly libtxtText rendering, possibly libtxtengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 3.3Found to occur in 3.3Found to occur in 3.3found in release: 3.6Found to occur in 3.6Found to occur in 3.6has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work on
Description
This test does not reliably pass on all platforms. It should give reliably the same numbers on every platform. (The numbers belowe might not be the right ones.)
test('TextPainter line metrics', () {
final TextPainter painter = TextPainter()
..textDirection = TextDirection.ltr;
const String text = 'test1\nhello line two really long for soft break\nfinal line 4';
painter.text = const TextSpan(
text: text,
);
painter.layout(maxWidth: 300);
expect(painter.text, const TextSpan(text: text));
expect(painter.preferredLineHeight, 14);
final List<ui.LineMetrics> lines = painter.computeLineMetrics();
expect(lines.length, 4);
expect(lines[0].hardBreak, true);
expect(lines[1].hardBreak, false);
expect(lines[2].hardBreak, true);
expect(lines[3].hardBreak, true);
expect(lines[0].ascent, 11.199999809265137);
expect(lines[1].ascent, 11.199999809265137);
expect(lines[2].ascent, 11.199999809265137);
expect(lines[3].ascent, 11.199999809265137);
expect(lines[0].descent, 2.799999952316284);
expect(lines[1].descent, 2.799999952316284);
expect(lines[2].descent, 2.799999952316284);
expect(lines[3].descent, 2.799999952316284);
expect(lines[0].unscaledAscent, 11.199999809265137);
expect(lines[1].unscaledAscent, 11.199999809265137);
expect(lines[2].unscaledAscent, 11.199999809265137);
expect(lines[3].unscaledAscent, 11.199999809265137);
expect(lines[0].baseline, 11.200000047683716);
expect(lines[1].baseline, 25.200000047683716);
expect(lines[2].baseline, 39.200000047683716);
expect(lines[3].baseline, 53.200000047683716);
expect(lines[0].height, 14);
expect(lines[1].height, 14);
expect(lines[2].height, 14);
expect(lines[3].height, 14);
expect(lines[0].width, 70);
expect(lines[1].width, 294);
expect(lines[2].width, 266);
expect(lines[3].width, 168);
expect(lines[0].left, 0);
expect(lines[1].left, 0);
expect(lines[2].left, 0);
expect(lines[3].left, 0);
expect(lines[0].lineNumber, 0);
expect(lines[1].lineNumber, 1);
expect(lines[2].lineNumber, 2);
expect(lines[3].lineNumber, 3);
});
(we already have this test in our library, it's in text_test.dart)
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: typographyText rendering, possibly libtxtText rendering, possibly libtxtengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 3.3Found to occur in 3.3Found to occur in 3.3found in release: 3.6Found to occur in 3.6Found to occur in 3.6has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work on