diff --git a/lib/web_ui/test/golden_tests/engine/backdrop_filter_golden_test.dart b/lib/web_ui/test/golden_tests/engine/backdrop_filter_golden_test.dart index 41f6cd56fbc7e894096814143e887d5aa6b91f16..1cb6e423c5c6eafbeffd9eb2da7d5bd666fb17ff 100644 --- a/lib/web_ui/test/golden_tests/engine/backdrop_filter_golden_test.dart +++ b/lib/web_ui/test/golden_tests/engine/backdrop_filter_golden_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.6 import 'dart:html' as html; import 'package:test/bootstrap/browser.dart'; @@ -56,9 +55,9 @@ void testMain() async { builder.pop(); builder.pop(); - html.document.body.append(builder + html.document.body!.append(builder .build() - .webOnlyRootElement); + .webOnlyRootElement!); await matchGoldenFile('backdrop_filter_clip.png', region: region, maxDiffRatePercent: 0.8); @@ -107,9 +106,9 @@ void testMain() async { builder2.pop(); builder2.pop(); - html.document.body.append(builder2 + html.document.body!.append(builder2 .build() - .webOnlyRootElement); + .webOnlyRootElement!); await matchGoldenFile('backdrop_filter_clip_moved.png', region: region, maxDiffRatePercent: 0.8); @@ -139,9 +138,9 @@ void testMain() async { builder.pop(); builder.pop(); - html.document.body.append(builder + html.document.body!.append(builder .build() - .webOnlyRootElement); + .webOnlyRootElement!); await matchGoldenFile('backdrop_filter_no_child_rendering.png', region: region, maxDiffRatePercent: 0.8); @@ -149,39 +148,39 @@ void testMain() async { } Picture _drawTestPictureWithCircles(Rect region, double offsetX, double offsetY) { - final EnginePictureRecorder recorder = PictureRecorder(); + final EnginePictureRecorder recorder = PictureRecorder() as EnginePictureRecorder; final RecordingCanvas canvas = recorder.beginRecording(region); canvas.drawCircle( - Offset(offsetX + 10, offsetY + 10), 10, Paint()..style = PaintingStyle.fill); + Offset(offsetX + 10, offsetY + 10), 10, SurfacePaint()..style = PaintingStyle.fill); canvas.drawCircle( Offset(offsetX + 60, offsetY + 10), 10, - Paint() + SurfacePaint() ..style = PaintingStyle.fill ..color = const Color.fromRGBO(255, 0, 0, 1)); canvas.drawCircle( Offset(offsetX + 10, offsetY + 60), 10, - Paint() + SurfacePaint() ..style = PaintingStyle.fill ..color = const Color.fromRGBO(0, 255, 0, 1)); canvas.drawCircle( Offset(offsetX + 60, offsetY + 60), 10, - Paint() + SurfacePaint() ..style = PaintingStyle.fill ..color = const Color.fromRGBO(0, 0, 255, 1)); return recorder.endRecording(); } Picture _drawBackground(Rect region) { - final EnginePictureRecorder recorder = PictureRecorder(); + final EnginePictureRecorder recorder = PictureRecorder() as EnginePictureRecorder; final RecordingCanvas canvas = recorder.beginRecording(region); canvas.drawRect( region.deflate(8.0), - Paint() + SurfacePaint() ..style = PaintingStyle.fill ..color = Color(0xFFE0FFE0) ); diff --git a/lib/web_ui/test/golden_tests/engine/canvas_arc_golden_test.dart b/lib/web_ui/test/golden_tests/engine/canvas_arc_golden_test.dart index b9dfbf1f117b4229511bf3b02d561ae925efdfde..8ba1f47873cac02fcadad28810eb7b8f059edddd 100644 --- a/lib/web_ui/test/golden_tests/engine/canvas_arc_golden_test.dart +++ b/lib/web_ui/test/golden_tests/engine/canvas_arc_golden_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.6 import 'dart:html' as html; import 'dart:math' as math; import 'package:test/bootstrap/browser.dart'; @@ -19,7 +18,7 @@ void main() { void testMain() async { final Rect region = Rect.fromLTWH(0, 0, 400, 600); - BitmapCanvas canvas; + late BitmapCanvas canvas; setUp(() { canvas = BitmapCanvas(region, RenderStrategy()); @@ -48,7 +47,7 @@ void testMain() async { largeArc: true, clockwise: true, distance: -20); - html.document.body.append(canvas.rootElement); + html.document.body!.append(canvas.rootElement); await matchGoldenFile('canvas_arc_to_point.png', region: region); }); @@ -63,7 +62,7 @@ void testMain() async { ..color = Color(0xFFFF9800) // orange ..style = PaintingStyle.fill); - html.document.body.append(canvas.rootElement); + html.document.body!.append(canvas.rootElement); await matchGoldenFile('canvas_addarc.png', region: region); }); @@ -81,7 +80,7 @@ void testMain() async { ..color = Color(0xFFFF9800) // orange ..style = PaintingStyle.fill); - html.document.body.append(canvas.rootElement); + html.document.body!.append(canvas.rootElement); await matchGoldenFile('canvas_addarc_ccw.png', region: region); }); } diff --git a/lib/web_ui/test/golden_tests/engine/canvas_blend_golden_test.dart b/lib/web_ui/test/golden_tests/engine/canvas_blend_golden_test.dart index 9082e404a99af65ebf51319fcd34c7d5c45a0e02..64b01b7273120cdbc9788545f3af16e0039699a3 100644 --- a/lib/web_ui/test/golden_tests/engine/canvas_blend_golden_test.dart +++ b/lib/web_ui/test/golden_tests/engine/canvas_blend_golden_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.6 import 'dart:html' as html; import 'dart:js_util' as js_util; @@ -35,7 +34,7 @@ void testMain() async { final html.Element sceneElement = html.Element.tag('flt-scene'); try { sceneElement.append(engineCanvas.rootElement); - html.document.body.append(sceneElement); + html.document.body!.append(sceneElement); await matchGoldenFile('$fileName.png', region: region, maxDiffRatePercent: maxDiffRatePercent, write: write); } finally { @@ -58,13 +57,13 @@ void testMain() async { rc.save(); rc.drawRect( Rect.fromLTRB(0, 0, 400, 400), - Paint() + SurfacePaint() ..style = PaintingStyle.fill ..color = const Color.fromARGB(255, 255, 255, 255)); rc.drawCircle( Offset(100, 100), 80.0, - Paint() + SurfacePaint() ..style = PaintingStyle.fill ..color = const Color.fromARGB(128, 255, 0, 0) ..blendMode = BlendMode.difference); @@ -72,7 +71,7 @@ void testMain() async { rc.drawCircle( Offset(170, 100), 80.0, - Paint() + SurfacePaint() ..style = PaintingStyle.fill ..blendMode = BlendMode.color ..color = const Color.fromARGB(128, 0, 255, 0)); @@ -80,7 +79,7 @@ void testMain() async { rc.drawCircle( Offset(135, 170), 80.0, - Paint() + SurfacePaint() ..style = PaintingStyle.fill ..color = const Color.fromARGB(128, 255, 0, 0)); rc.restore(); @@ -95,20 +94,20 @@ void testMain() async { rc.save(); rc.drawRect( Rect.fromLTRB(0, 0, 400, 400), - Paint() + SurfacePaint() ..style = PaintingStyle.fill ..color = const Color.fromARGB(255, 255, 255, 255)); rc.drawCircle( Offset(100, 100), 80.0, - Paint() + SurfacePaint() ..style = PaintingStyle.fill ..color = const Color.fromARGB(128, 255, 0, 0) ..blendMode = BlendMode.difference); rc.drawCircle( Offset(170, 100), 80.0, - Paint() + SurfacePaint() ..style = PaintingStyle.fill ..blendMode = BlendMode.color ..color = const Color.fromARGB(128, 0, 255, 0)); @@ -116,11 +115,11 @@ void testMain() async { rc.drawCircle( Offset(135, 170), 80.0, - Paint() + SurfacePaint() ..style = PaintingStyle.fill ..color = const Color.fromARGB(128, 255, 0, 0)); rc.drawImage(createTestImage(), Offset(135.0, 130.0), - Paint()..blendMode = BlendMode.multiply); + SurfacePaint()..blendMode = BlendMode.multiply); rc.restore(); await _checkScreenshot(rc, 'canvas_blend_image_multiply', maxDiffRatePercent: operatingSystem == OperatingSystem.macOs ? 2.95 : diff --git a/lib/web_ui/test/golden_tests/engine/canvas_clip_path_test.dart b/lib/web_ui/test/golden_tests/engine/canvas_clip_path_test.dart index 88dc7fe169eb4451699fc2ee80b4a781604c9994..981e966501d4c83283f7cb2eafbe2066ba674fdc 100644 --- a/lib/web_ui/test/golden_tests/engine/canvas_clip_path_test.dart +++ b/lib/web_ui/test/golden_tests/engine/canvas_clip_path_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.6 import 'dart:html' as html; import 'dart:js_util' as js_util; @@ -42,7 +41,7 @@ void testMain() async { path.addOval(Rect.fromLTWH(100, 30, testWidth, testHeight)); rc.clipPath(path); rc.drawImageRect(testImage, Rect.fromLTRB(0, 0, testWidth, testHeight), - Rect.fromLTWH(100, 30, testWidth, testHeight), Paint()); + Rect.fromLTWH(100, 30, testWidth, testHeight), engine.SurfacePaint()); rc.restore(); await canvasScreenshot(rc, 'image_clipped_by_oval', region: screenRect); @@ -65,7 +64,7 @@ void testMain() async { paintPath.close(); rc.drawPath( paintPath, - Paint() + engine.SurfacePaint() ..color = Color(0xFF00FF00) ..style = PaintingStyle.fill); rc.restore(); @@ -85,7 +84,7 @@ void testMain() async { paintPath.addRect(Rect.fromLTWH(-50, 0, testWidth, testHeight)); paintPath.close(); rc.drawPath(paintPath, - Paint() + engine.SurfacePaint() ..color = Color(0xFF000000) ..style = PaintingStyle.stroke); @@ -96,7 +95,7 @@ void testMain() async { path.close(); rc.clipPath(path); rc.drawImageRect(createTestImage(), Rect.fromLTRB(0, 0, testWidth, testHeight), - Rect.fromLTWH(-50, 0, testWidth, testHeight), Paint()); + Rect.fromLTWH(-50, 0, testWidth, testHeight), engine.SurfacePaint()); rc.restore(); await canvasScreenshot(rc, 'image_clipped_by_triangle_off_screen'); }); @@ -113,7 +112,7 @@ void testMain() async { paintPath.addRect(Rect.fromLTWH(-50, 0, testWidth, testHeight)); paintPath.close(); rc.drawPath(paintPath, - Paint() + engine.SurfacePaint() ..color = Color(0xFF000000) ..style = PaintingStyle.stroke); @@ -121,7 +120,7 @@ void testMain() async { path.addOval(Rect.fromLTRB(-200, 0, 100, 150)); rc.clipPath(path); rc.drawImageRect(createTestImage(), Rect.fromLTRB(0, 0, testWidth, testHeight), - Rect.fromLTWH(-50, 0, testWidth, testHeight), Paint()); + Rect.fromLTWH(-50, 0, testWidth, testHeight), engine.SurfacePaint()); rc.restore(); await canvasScreenshot(rc, 'image_clipped_by_oval_path'); }); diff --git a/lib/web_ui/test/golden_tests/engine/canvas_context_test.dart b/lib/web_ui/test/golden_tests/engine/canvas_context_test.dart index 85350e03c83abf30de99f956fc5a6570ec8de469..395d546eed1b2fb26e679c79dc41353fd7de389f 100644 --- a/lib/web_ui/test/golden_tests/engine/canvas_context_test.dart +++ b/lib/web_ui/test/golden_tests/engine/canvas_context_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.6 import 'dart:html' as html; import 'package:test/bootstrap/browser.dart'; @@ -35,7 +34,7 @@ void testMain() async { final html.Element sceneElement = html.Element.tag('flt-scene'); try { sceneElement.append(engineCanvas.rootElement); - html.document.body.append(sceneElement); + html.document.body!.append(sceneElement); // TODO(yjbanov): 10% diff rate is excessive. Update goldens. await matchGoldenFile('$fileName.png', region: region, maxDiffRatePercent: 10); } finally { @@ -57,7 +56,7 @@ void testMain() async { test('Clips image with oval clip path', () async { final engine.RecordingCanvas rc = engine.RecordingCanvas(const Rect.fromLTRB(0, 0, 400, 300)); - final Paint paint = Paint() + final engine.SurfacePaint paint = Paint() as engine.SurfacePaint ..color = Color(0xFF00FF00) ..style = PaintingStyle.fill; rc.save(); @@ -98,11 +97,11 @@ void testMain() async { rc.save(); rc.restore(); // The rectangle should be clipped against oval. - rc.drawRect(Rect.fromLTWH(0, 0, 300, 300), badPaint); + rc.drawRect(Rect.fromLTWH(0, 0, 300, 300), badPaint as engine.SurfacePaint); rc.restore(); // The rectangle should paint without clipping since we restored // context. - rc.drawRect(Rect.fromLTWH(0, 0, 200, 200), goodPaint); + rc.drawRect(Rect.fromLTWH(0, 0, 200, 200), goodPaint as engine.SurfacePaint); await _checkScreenshot(rc, 'context_save_restore_clip'); }); } diff --git a/lib/web_ui/test/golden_tests/engine/screenshot.dart b/lib/web_ui/test/golden_tests/engine/screenshot.dart index b1b62756c961dc238114c1e05433e22676911e52..88372f8a4462c07de6233f4237b570c9e61842ff 100644 --- a/lib/web_ui/test/golden_tests/engine/screenshot.dart +++ b/lib/web_ui/test/golden_tests/engine/screenshot.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.6 import 'dart:html' as html; import 'package:ui/ui.dart' as ui; import 'package:ui/src/engine.dart'; @@ -23,7 +22,7 @@ Future canvasScreenshot(RecordingCanvas rc, String fileName, final html.Element sceneElement = html.Element.tag('flt-scene'); try { sceneElement.append(engineCanvas.rootElement); - html.document.body.append(sceneElement); + html.document.body!.append(sceneElement); await matchGoldenFile('$fileName.png', region: region, maxDiffRatePercent: maxDiffRatePercent, write: write); } finally { diff --git a/lib/web_ui/test/golden_tests/golden_failure_smoke_test.dart b/lib/web_ui/test/golden_tests/golden_failure_smoke_test.dart index 7a0cfc7c621e03dcdcc5a6ebc95b9386eaf631c6..a7d20db6c83ff645ed1e9909713ca1ab8e29c2b5 100644 --- a/lib/web_ui/test/golden_tests/golden_failure_smoke_test.dart +++ b/lib/web_ui/test/golden_tests/golden_failure_smoke_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.6 import 'dart:html' as html; import 'package:test/bootstrap/browser.dart'; @@ -16,7 +15,7 @@ void main() { void testMain() { test('screenshot test reports failure', () async { - html.document.body.innerHtml = 'Text that does not appear on the screenshot!'; + html.document.body!.innerHtml = 'Text that does not appear on the screenshot!'; await matchGoldenFile('__local__/smoke_test.png', region: Rect.fromLTWH(0, 0, 320, 200)); }); } diff --git a/lib/web_ui/test/golden_tests/golden_success_smoke_test.dart b/lib/web_ui/test/golden_tests/golden_success_smoke_test.dart index dc28497e962d616ef949a51f945816a4cb219449..048afefef05c6baea210c63b9ad0c4e854a36f56 100644 --- a/lib/web_ui/test/golden_tests/golden_success_smoke_test.dart +++ b/lib/web_ui/test/golden_tests/golden_success_smoke_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.6 import 'dart:html' as html; import 'package:test/bootstrap/browser.dart'; @@ -20,8 +19,8 @@ void testMain() async { await webOnlyInitializePlatform(assetManager: WebOnlyMockAssetManager()); test('screenshot test reports success', () async { - html.document.body.style.fontFamily = 'Roboto'; - html.document.body.innerHtml = 'Hello world!'; + html.document.body!.style.fontFamily = 'Roboto'; + html.document.body!.innerHtml = 'Hello world!'; // TODO: https://github.com/flutter/flutter/issues/74702 , reduce webkit percentage. await matchGoldenFile('__local__/smoke_test.png', region: Rect.fromLTWH(0, 0, 320, 200), maxDiffRatePercent: browserEngine == BrowserEngine.webkit ? 3.0 : 0.28);