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

Commit b63dc5e

Browse files
fix failing test
1 parent a08d4e3 commit b63dc5e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/web_ui/test/html/text/canvas_paragraph_test.dart

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,19 @@ Future<void> testMain() async {
776776
expect(paragraph.longestLine, 50.0);
777777
});
778778

779-
test('$CanvasParagraph.width should be a whole integer', () {
779+
test('$CanvasParagraph.width should be a whole integer when shouldDisableRoundingHack is false', () {
780+
if (ui.ParagraphBuilder.shouldDisableRoundingHack) {
781+
// Try applying the rounding hack if it's disabled. This may not work if
782+
// the 'SKPARAGRAPH_REMOVE_ROUNDING_HACK' dart environment declaration
783+
// is set to 'false'.
784+
ui.ParagraphBuilder.setDisableRoundingHack(false);
785+
addTearDown(() => ui.ParagraphBuilder.setDisableRoundingHack(true));
786+
}
787+
// The paragraph width is only rounded to a whole integer if
788+
// shouldDisableRoundingHack is false.
789+
if (ui.ParagraphBuilder.shouldDisableRoundingHack) {
790+
return;
791+
}
780792
final ui.Paragraph paragraph = plain(ahemStyle, 'abc');
781793
paragraph.layout(const ui.ParagraphConstraints(width: 30.8));
782794

0 commit comments

Comments
 (0)