diff --git a/engine/src/flutter/lib/web_ui/test/canvaskit/text_test.dart b/engine/src/flutter/lib/web_ui/test/canvaskit/text_test.dart new file mode 100644 index 0000000000..34313930cb --- /dev/null +++ b/engine/src/flutter/lib/web_ui/test/canvaskit/text_test.dart @@ -0,0 +1,60 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:test/bootstrap/browser.dart'; +import 'package:test/test.dart'; +import 'package:ui/ui.dart' as ui; + +import 'common.dart'; + +void main() { + internalBootstrapBrowserTest(() => testMain); +} + +void testMain() { + group('CanvasKit text', () { + setUpCanvasKitTest(); + + test("doesn't crash when using shadows", () { + final ui.TextStyle textStyleWithShadows = ui.TextStyle( + fontSize: 16, + shadows: [ + ui.Shadow( + color: ui.Color.fromARGB(255, 0, 0, 0), + blurRadius: 3.0, + offset: ui.Offset(3.0, 3.0), + ), + ui.Shadow( + color: ui.Color.fromARGB(255, 0, 0, 0), + blurRadius: 3.0, + offset: ui.Offset(-3.0, 3.0), + ), + ui.Shadow( + color: ui.Color.fromARGB(255, 0, 0, 0), + blurRadius: 3.0, + offset: ui.Offset(3.0, -3.0), + ), + ui.Shadow( + color: ui.Color.fromARGB(255, 0, 0, 0), + blurRadius: 3.0, + offset: ui.Offset(-3.0, -3.0), + ), + ], + fontFamily: 'Roboto', + ); + + for (int i = 0; i < 10; i++) { + ui.ParagraphBuilder builder = + ui.ParagraphBuilder(ui.ParagraphStyle(fontSize: 16)); + builder.pushStyle(textStyleWithShadows); + builder.addText('test'); + final ui.Paragraph paragraph = builder.build(); + expect(paragraph, isNotNull); + } + }); + // This test fails with "memory access out of bounds" + // See https://github.com/flutter/flutter/issues/80140 + // Unskip this once this fix lands: https://skia-review.googlesource.com/c/skia/+/416687 + }, skip: true); +}