From 51e70fa16bfddd94b95aaaf84db9ca3d5bed58d8 Mon Sep 17 00:00:00 2001 From: Jackson Gardner Date: Tue, 9 Apr 2024 12:35:07 -0700 Subject: [PATCH] Fix skwasm tests (#145570) Skwasm tests are now running as `bringup: true` in postsubmit, but failing. Let's get them fixed. --- .ci.yaml | 8 --- dev/bots/test.dart | 11 ++++ .../lib/src/foundation/_capabilities_io.dart | 7 +++ .../lib/src/foundation/_capabilities_web.dart | 10 +++- .../lib/src/foundation/capabilities.dart | 10 ++++ .../flutter/lib/src/foundation/constants.dart | 12 ++++ .../lib/src/foundation/stack_frame.dart | 4 +- .../lib/src/painting/_network_image_web.dart | 2 +- .../lib/src/painting/shader_warm_up.dart | 2 +- .../lib/src/painting/text_painter.dart | 2 +- .../flutter/test/cupertino/dialog_test.dart | 2 +- .../foundation/service_extensions_test.dart | 2 +- .../test/foundation/stack_frame_test.dart | 19 ++++-- .../flutter/test/material/about_test.dart | 6 +- .../test/material/app_bar_sliver_test.dart | 8 +-- .../flutter/test/material/badge_test.dart | 6 +- .../flutter/test/material/banner_test.dart | 8 +-- .../material/bottom_navigation_bar_test.dart | 8 +-- packages/flutter/test/material/chip_test.dart | 32 +++++----- .../test/material/date_picker_test.dart | 10 ++-- .../test/material/date_range_picker_test.dart | 6 +- .../test/material/dialog_theme_test.dart | 2 +- .../test/material/filter_chip_test.dart | 2 +- .../flutter/test/material/ink_paint_test.dart | 4 +- .../test/material/ink_splash_test.dart | 4 +- .../flutter/test/material/list_tile_test.dart | 8 +-- .../test/material/menu_style_test.dart | 2 +- .../test/material/navigation_bar_test.dart | 14 ++--- .../test/material/navigation_drawer_test.dart | 2 +- .../test/material/navigation_rail_test.dart | 58 +++++++++---------- .../test/material/outlined_button_test.dart | 2 +- .../flutter/test/material/snack_bar_test.dart | 2 +- .../test/material/text_button_test.dart | 2 +- .../test/material/toggle_buttons_test.dart | 2 +- .../flutter/test/material/tooltip_test.dart | 12 ++-- .../test/painting/shader_warm_up_test.dart | 2 +- .../test/painting/text_painter_test.dart | 42 +++++++------- .../rendering/editable_intrinsics_test.dart | 2 +- .../flutter/test/rendering/layers_test.dart | 4 +- .../rendering/paragraph_intrinsics_test.dart | 2 +- .../test/rendering/paragraph_test.dart | 4 +- .../widgets/editable_text_cursor_test.dart | 2 +- .../selectable_region_context_menu_test.dart | 16 ++--- packages/flutter_goldens/lib/skia_client.dart | 23 +++++--- .../flutter_test/lib/src/_matchers_web.dart | 4 +- packages/flutter_test/lib/src/platform.dart | 4 +- .../lib/src/test/flutter_web_goldens.dart | 2 +- .../lib/src/test/web_test_compiler.dart | 9 +-- 48 files changed, 230 insertions(+), 177 deletions(-) diff --git a/.ci.yaml b/.ci.yaml index 669bbd99582..541a156c4a2 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -1730,7 +1730,6 @@ targets: - .ci.yaml - name: Linux web_skwasm_tests_0 - bringup: true recipe: flutter/flutter_drone timeout: 60 properties: @@ -1753,7 +1752,6 @@ targets: - .ci.yaml - name: Linux web_skwasm_tests_1 - bringup: true recipe: flutter/flutter_drone timeout: 60 properties: @@ -1776,7 +1774,6 @@ targets: - .ci.yaml - name: Linux web_skwasm_tests_2 - bringup: true recipe: flutter/flutter_drone timeout: 60 properties: @@ -1799,7 +1796,6 @@ targets: - .ci.yaml - name: Linux web_skwasm_tests_3 - bringup: true recipe: flutter/flutter_drone timeout: 60 properties: @@ -1822,7 +1818,6 @@ targets: - .ci.yaml - name: Linux web_skwasm_tests_4 - bringup: true recipe: flutter/flutter_drone timeout: 60 properties: @@ -1845,7 +1840,6 @@ targets: - .ci.yaml - name: Linux web_skwasm_tests_5 - bringup: true recipe: flutter/flutter_drone timeout: 60 properties: @@ -1868,7 +1862,6 @@ targets: - .ci.yaml - name: Linux web_skwasm_tests_6 - bringup: true recipe: flutter/flutter_drone timeout: 60 properties: @@ -1891,7 +1884,6 @@ targets: - .ci.yaml - name: Linux web_skwasm_tests_7_last - bringup: true recipe: flutter/flutter_drone timeout: 60 properties: diff --git a/dev/bots/test.dart b/dev/bots/test.dart index a3348ac2dec..ef899785180 100644 --- a/dev/bots/test.dart +++ b/dev/bots/test.dart @@ -171,6 +171,17 @@ const Map> kWebTestFileKnownFailures = [ + // These tests are not compilable on the web due to dependencies on + // VM-specific functionality. + 'test/services/message_codecs_vm_test.dart', + 'test/examples/sector_layout_test.dart', + + // These tests are broken and need to be fixed. + // TODO(jacksongardner): https://github.com/flutter/flutter/issues/71604 + 'test/material/text_field_test.dart', + 'test/widgets/performance_overlay_test.dart', + ], }; const String kTestHarnessShardName = 'test_harness_tests'; diff --git a/packages/flutter/lib/src/foundation/_capabilities_io.dart b/packages/flutter/lib/src/foundation/_capabilities_io.dart index 202dc7ba00d..6f554978a23 100644 --- a/packages/flutter/lib/src/foundation/_capabilities_io.dart +++ b/packages/flutter/lib/src/foundation/_capabilities_io.dart @@ -8,3 +8,10 @@ bool get isCanvasKit { throw UnimplementedError('isCanvasKit is not implemented for dart:io.'); } + +/// The dart:io implementation of [isSkwasm]. +/// +/// This bool shouldn't be used outside of web. +bool get isSkwasm { + throw UnimplementedError('isSkwasm is not implemented for dart:io.'); +} diff --git a/packages/flutter/lib/src/foundation/_capabilities_web.dart b/packages/flutter/lib/src/foundation/_capabilities_web.dart index a71c517d8ef..35ac3df45e0 100644 --- a/packages/flutter/lib/src/foundation/_capabilities_web.dart +++ b/packages/flutter/lib/src/foundation/_capabilities_web.dart @@ -4,10 +4,16 @@ import 'dart:js_interop'; -// This value is set by the engine. It is used to determine if the application is -// using canvaskit. +// These values are set by the engine. They are used to determine if the +// application is using canvaskit or skwasm. @JS('window.flutterCanvasKit') external JSAny? get _windowFlutterCanvasKit; +@JS('window._flutter_skwasmInstance') +external JSAny? get _skwasmInstance; + /// The web implementation of [isCanvasKit] bool get isCanvasKit => _windowFlutterCanvasKit != null; + +/// The web implementation of [isSkwasm] +bool get isSkwasm => _skwasmInstance != null; diff --git a/packages/flutter/lib/src/foundation/capabilities.dart b/packages/flutter/lib/src/foundation/capabilities.dart index d2d6d81b70c..719c8ecedb1 100644 --- a/packages/flutter/lib/src/foundation/capabilities.dart +++ b/packages/flutter/lib/src/foundation/capabilities.dart @@ -9,3 +9,13 @@ import '_capabilities_io.dart' /// /// Only to be used for web. bool get isCanvasKit => capabilities.isCanvasKit; + +/// Returns true if the application is using Skwasm. +/// +/// Only to be used for web. +bool get isSkwasm => capabilities.isSkwasm; + +/// Returns true if the application is using CanvasKit or Skwasm. +/// +/// Only to be used for web. +bool get isSkiaWeb => isCanvasKit || isSkwasm; diff --git a/packages/flutter/lib/src/foundation/constants.dart b/packages/flutter/lib/src/foundation/constants.dart index ec42df6425e..277a6acf61e 100644 --- a/packages/flutter/lib/src/foundation/constants.dart +++ b/packages/flutter/lib/src/foundation/constants.dart @@ -78,3 +78,15 @@ const double precisionErrorTolerance = 1e-10; /// * [dart:io.Platform], a way to find out the browser's platform that is not /// overridable in tests. const bool kIsWeb = bool.fromEnvironment('dart.library.js_util'); + +/// A constant that is true if the application was compiled to WebAssembly. +/// +/// See also: +/// +/// * [defaultTargetPlatform], which is used by themes to find out which +/// platform the application is running on (or, in the case of a web app, +/// which platform the application's browser is running in). Can be overridden +/// in tests with [debugDefaultTargetPlatformOverride]. +/// * [dart:io.Platform], a way to find out the browser's platform that is not +/// overridable in tests. +const bool kIsWasm = kIsWeb && bool.fromEnvironment('dart.library.ffi'); diff --git a/packages/flutter/lib/src/foundation/stack_frame.dart b/packages/flutter/lib/src/foundation/stack_frame.dart index b45c82fb731..72239a88b3a 100644 --- a/packages/flutter/lib/src/foundation/stack_frame.dart +++ b/packages/flutter/lib/src/foundation/stack_frame.dart @@ -89,7 +89,9 @@ class StackFrame { /// /// Returns null if format is not as expected. static StackFrame? _tryParseWebFrame(String line) { - if (kDebugMode) { + // dart2wasm doesn't emit stack frames in the same way DDC does, so we need + // to do the less clever non-debug path here when compiled to wasm. + if (kDebugMode && !kIsWasm) { return _tryParseWebDebugFrame(line); } else { return _tryParseWebNonDebugFrame(line); diff --git a/packages/flutter/lib/src/painting/_network_image_web.dart b/packages/flutter/lib/src/painting/_network_image_web.dart index 5e2cc90213e..257e48e0478 100644 --- a/packages/flutter/lib/src/painting/_network_image_web.dart +++ b/packages/flutter/lib/src/painting/_network_image_web.dart @@ -117,7 +117,7 @@ class NetworkImage // We use a different method when headers are set because the // `ui_web.createImageCodecFromUrl` method is not capable of handling headers. - if (isCanvasKit || containsNetworkImageHeaders) { + if (isSkiaWeb || containsNetworkImageHeaders) { final Completer completer = Completer(); final web.XMLHttpRequest request = httpRequestFactory(); diff --git a/packages/flutter/lib/src/painting/shader_warm_up.dart b/packages/flutter/lib/src/painting/shader_warm_up.dart index 48a5bf0edfd..2bee9d760e7 100644 --- a/packages/flutter/lib/src/painting/shader_warm_up.dart +++ b/packages/flutter/lib/src/painting/shader_warm_up.dart @@ -87,7 +87,7 @@ abstract class ShaderWarmUp { await warmUpOnCanvas(canvas); final ui.Picture picture = recorder.endRecording(); assert(debugCaptureShaderWarmUpPicture(picture)); - if (!kIsWeb || isCanvasKit) { // Picture.toImage is not yet implemented on the web. + if (!kIsWeb || isSkiaWeb) { // Picture.toImage is not implemented on the html renderer. TimelineTask? debugShaderWarmUpTask; if (!kReleaseMode) { debugShaderWarmUpTask = TimelineTask()..start('Warm-up shader'); diff --git a/packages/flutter/lib/src/painting/text_painter.dart b/packages/flutter/lib/src/painting/text_painter.dart index ae5907dd558..097379f19ea 100644 --- a/packages/flutter/lib/src/painting/text_painter.dart +++ b/packages/flutter/lib/src/painting/text_painter.dart @@ -1476,7 +1476,7 @@ class TextPainter { ); } else { // Fall back to glyphInfo. This should only happen when using the HTML renderer. - assert(kIsWeb && !isCanvasKit); + assert(kIsWeb && !isSkiaWeb); final Rect graphemeBounds = glyphInfo.graphemeClusterLayoutBounds; final double dx = switch (glyphInfo.writingDirection) { TextDirection.ltr => anchorToLeadingEdge ? graphemeBounds.left : graphemeBounds.right, diff --git a/packages/flutter/test/cupertino/dialog_test.dart b/packages/flutter/test/cupertino/dialog_test.dart index 24bacd2ffa8..fd25b3640be 100644 --- a/packages/flutter/test/cupertino/dialog_test.dart +++ b/packages/flutter/test/cupertino/dialog_test.dart @@ -346,7 +346,7 @@ void main() { // regular font. However, when using the test font, "Cancel" becomes 2 lines which // is why the height we're verifying for "Cancel" is larger than "OK". - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(tester.getSize(find.text('The Title')), equals(const Size(270.0, 132.0))); } expect(tester.getTopLeft(find.text('The Title')), equals(const Offset(265.0, 80.0 + 24.0))); diff --git a/packages/flutter/test/foundation/service_extensions_test.dart b/packages/flutter/test/foundation/service_extensions_test.dart index 14db86f397f..b146f5595d1 100644 --- a/packages/flutter/test/foundation/service_extensions_test.dart +++ b/packages/flutter/test/foundation/service_extensions_test.dart @@ -278,7 +278,7 @@ void main() { r'TransformLayer#[0-9a-f]{5}\n' r' owner: RenderView#[0-9a-f]{5}\n' r' creator: RenderView\n' - r' engine layer: (TransformEngineLayer|PersistedTransform)#[0-9a-f]{5}\n' + r' engine layer: (TransformLayer|TransformEngineLayer|PersistedTransform)#[0-9a-f]{5}\n' r' handles: 1\n' r' offset: Offset\(0\.0, 0\.0\)\n' r' transform:\n' diff --git a/packages/flutter/test/foundation/stack_frame_test.dart b/packages/flutter/test/foundation/stack_frame_test.dart index e3052188cb8..0ddae757cbd 100644 --- a/packages/flutter/test/foundation/stack_frame_test.dart +++ b/packages/flutter/test/foundation/stack_frame_test.dart @@ -41,12 +41,19 @@ void main() { ); }); - test('Parses web stack', () { - expect( - StackFrame.fromStackString(webStackTrace), - webStackTraceFrames, - ); - }); + test( + 'Parses web stack', + // Wasm stacks are not reliable, even in debug mode, so the stack + // parser doesn't do the standard debug stack parsing this test is + // expecting here. + skip: kIsWasm, // [intended] See comments above + () { + expect( + StackFrame.fromStackString(webStackTrace), + webStackTraceFrames, + ); + } + ); test('Parses ...', () { expect( diff --git a/packages/flutter/test/material/about_test.dart b/packages/flutter/test/material/about_test.dart index 49d1a2b3f64..afa52d2a251 100644 --- a/packages/flutter/test/material/about_test.dart +++ b/packages/flutter/test/material/about_test.dart @@ -565,7 +565,7 @@ void main() { tester.getTopLeft(find.text('Licenses')), const Offset(16.0 + safeareaPadding, 14.0 + safeareaPadding), ); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('LicensePage returns early if unmounted', (WidgetTester tester) async { final Completer licenseCompleter = Completer(); @@ -1560,7 +1560,7 @@ void main() { // If the layout width is less than 840.0 pixels, nested layout is // used which positions license page title at the top center. Offset titleOffset = tester.getCenter(find.text(title)); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(titleOffset, Offset(defaultSize.width / 2, 96.0)); } expect(tester.getCenter(find.byType(ListView)), Offset(defaultSize.width / 2, 328.0)); @@ -1692,7 +1692,7 @@ void main() { // If the layout width is less than 840.0 pixels, nested layout is // used which positions license page title at the top center. Offset titleOffset = tester.getCenter(find.text(title)); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(titleOffset, Offset(defaultSize.width / 2, 96.0)); } expect(tester.getCenter(find.byType(ListView)), Offset(defaultSize.width / 2, 328.0)); diff --git a/packages/flutter/test/material/app_bar_sliver_test.dart b/packages/flutter/test/material/app_bar_sliver_test.dart index 1c053863099..cef0f0f5bf2 100644 --- a/packages/flutter/test/material/app_bar_sliver_test.dart +++ b/packages/flutter/test/material/app_bar_sliver_test.dart @@ -273,7 +273,7 @@ void main() { await tester.pumpWidget(buildAppBar(textScaleFactor: 3.0)); expect(tester.getRect(expandedTitle).height, 43.0); verifyTextNotClipped(expandedTitle, tester); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('SliverAppBar.large expanded title has upper limit on text scaling', (WidgetTester tester) async { const String title = 'Large AppBar'; @@ -312,7 +312,7 @@ void main() { await tester.pumpWidget(buildAppBar(textScaleFactor: 3.0)); expect(tester.getRect(expandedTitle).height, closeTo(48.0, 0.1)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('SliverAppBar.medium expanded title position is adjusted with textScaleFactor', (WidgetTester tester) async { const String title = 'Medium AppBar'; @@ -354,7 +354,7 @@ void main() { await tester.pumpWidget(buildAppBar(textScaleFactor: 3.0)); expect(tester.getBottomLeft(expandedTitle).dy, 107.0); verifyTextNotClipped(expandedTitle, tester); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('SliverAppBar.large expanded title position is adjusted with textScaleFactor', (WidgetTester tester) async { const String title = 'Large AppBar'; @@ -1361,7 +1361,7 @@ void main() { // Test the expanded title is positioned correctly. final Offset titleOffset = tester.getBottomLeft(expandedTitle); expect(titleOffset.dx, 16.0); - if (!kIsWeb || isCanvasKit) { + if (!kIsWeb || isSkiaWeb) { expect(titleOffset.dy, 96.0); } diff --git a/packages/flutter/test/material/badge_test.dart b/packages/flutter/test/material/badge_test.dart index 2841525045f..23cf465e235 100644 --- a/packages/flutter/test/material/badge_test.dart +++ b/packages/flutter/test/material/badge_test.dart @@ -46,7 +46,7 @@ void main() { expect(tester.getSize(find.byType(Badge)), const Size(24, 24)); // default Icon size expect(tester.getTopLeft(find.byType(Badge)), Offset.zero); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(tester.getTopLeft(find.text('0')), const Offset(16, -4)); } @@ -88,7 +88,7 @@ void main() { expect(tester.getSize(find.byType(Badge)), const Size(24, 24)); // default Icon size expect(tester.getTopLeft(find.byType(Badge)), Offset.zero); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(tester.getTopLeft(find.text('0')), const Offset(0, -4)); } @@ -140,7 +140,7 @@ void main() { // x = alignment.start + padding.left // y = alignment.top - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(tester.getTopLeft(find.text('0')), const Offset(16, -4)); } diff --git a/packages/flutter/test/material/banner_test.dart b/packages/flutter/test/material/banner_test.dart index 65bb5a8ef46..ca68ffb84c2 100644 --- a/packages/flutter/test/material/banner_test.dart +++ b/packages/flutter/test/material/banner_test.dart @@ -261,23 +261,23 @@ void main() { await tester.pumpWidget(buildApp(textScaler: TextScaler.noScaling)); expect(find.text(label), findsOneWidget); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(tester.getSize(find.text(label)), const Size(14.25, 20.0)); } await tester.pumpWidget(buildApp(textScaler: const TextScaler.linear(1.1))); await tester.pumpAndSettle(); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(_sizeAlmostEqual(tester.getSize(find.text(label)), const Size(15.65, 22.0)), true); } await tester.pumpWidget(buildApp(textScaler: const TextScaler.linear(1.5))); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(_sizeAlmostEqual(tester.getSize(find.text(label)), const Size(21.25, 30)), true); } await tester.pumpWidget(buildApp(textScaler: const TextScaler.linear(4))); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(_sizeAlmostEqual(tester.getSize(find.text(label)), const Size(21.25, 30)), true); } }); diff --git a/packages/flutter/test/material/bottom_navigation_bar_test.dart b/packages/flutter/test/material/bottom_navigation_bar_test.dart index b9fc12edeea..dfe20d9e2e8 100644 --- a/packages/flutter/test/material/bottom_navigation_bar_test.dart +++ b/packages/flutter/test/material/bottom_navigation_bar_test.dart @@ -1882,7 +1882,7 @@ void main() { expect(find.text(label), findsOneWidget); await tester.longPress(find.text(label)); expect(tester.getSize(find.text(label).last).height, equals(80.0)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Different behaviour of tool tip in BottomNavigationBarItem', (WidgetTester tester) async { await tester.pumpWidget( @@ -2889,7 +2889,7 @@ void main() { ); expect(tester.getRect(find.byKey(icon0)), Rect.fromLTRB(100.0, iconTop, 300.0, iconTop + iconHeight)); expect(tester.getRect(find.byKey(icon1)), Rect.fromLTRB(500.0, iconTop, 700.0, iconTop + iconHeight)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Material2 - BottomNavigationBar centered landscape layout', (WidgetTester tester) async { final Key icon0 = UniqueKey(); @@ -3008,7 +3008,7 @@ void main() { ); expect(tester.getRect(find.byKey(icon0)), Rect.fromLTRB(150.0, iconTop, 350.0, iconTop + iconHeight)); expect(tester.getRect(find.byKey(icon1)), Rect.fromLTRB(450.0, iconTop, 650.0, iconTop + iconHeight)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Material2 - BottomNavigationBar linear landscape layout', (WidgetTester tester) async { final Key icon0 = UniqueKey(); @@ -3123,7 +3123,7 @@ void main() { ); expect(tester.getRect(find.byKey(icon0)), Rect.fromLTRB(firstItemLeft, iconTop, firstItemLeft + iconWidth, iconTop + iconHeight)); expect(tester.getRect(find.byKey(icon1)), Rect.fromLTRB(secondItemLeft, iconTop, secondItemLeft + iconWidth, iconTop + iconHeight)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('BottomNavigationBar linear landscape layout label RenderFlex overflow',(WidgetTester tester) async { //Regression test for https://github.com/flutter/flutter/issues/112163 diff --git a/packages/flutter/test/material/chip_test.dart b/packages/flutter/test/material/chip_test.dart index f3a115edfcf..e53908a9347 100644 --- a/packages/flutter/test/material/chip_test.dart +++ b/packages/flutter/test/material/chip_test.dart @@ -662,7 +662,7 @@ void main() { expect(tester.getSize(find.byType(Text)).width, closeTo(40.4, 0.01)); expect(tester.getSize(find.byType(Text)).height, equals(14.0)); expect(tester.getSize(find.byType(Chip)), const Size(800.0, 48.0)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Material2 - Chip responds to materialTapTargetSize', (WidgetTester tester) async { await tester.pumpWidget( @@ -708,7 +708,7 @@ void main() { expect(tester.getSize(find.byType(Chip).first).height, equals(48.0)); expect(tester.getSize(find.byType(Chip).last).width, closeTo(48.1, 0.01)); expect(tester.getSize(find.byType(Chip).last).height, equals(38.0)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Delete button tap target is the right proportion of the chip', (WidgetTester tester) async { final UniqueKey deleteKey = UniqueKey(); @@ -962,7 +962,7 @@ void main() { expect(tester.getSize(find.byType(Chip).first).height, equals(78.0)); expect(tester.getSize(find.byType(Chip).last).width, closeTo(138.59, 0.01)); expect(tester.getSize(find.byType(Chip).last).height, equals(48.0)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Material2 - Labels can be non-text widgets', (WidgetTester tester) async { final Key keyA = GlobalKey(); @@ -1017,7 +1017,7 @@ void main() { expect(tester.getSize(find.byType(Chip).first).width, moreOrLessEquals(138.5, epsilon: 0.1)); expect(tester.getSize(find.byType(Chip).first).height, equals(48.0)); expect(tester.getSize(find.byType(Chip).last), const Size(60.0, 48.0)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Avatars can be non-circle avatar widgets', (WidgetTester tester) async { final Key keyA = GlobalKey(); @@ -1381,7 +1381,7 @@ void main() { expect(tester.getSize(find.byType(RawChip)).height, equals(48.0)); expect(tester.getTopLeft(find.byKey(labelKey)), equals(const Offset(17.0, 14.0))); expect(find.byKey(avatarKey), findsNothing); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Material2 - Delete button drawer works as expected on RawChip', (WidgetTester tester) async { const Key labelKey = Key('label'); @@ -1628,7 +1628,7 @@ void main() { expect(tester.getSize(find.byType(RawChip)).height, equals(48.0)); expect(tester.getTopLeft(find.byKey(labelKey)), equals(const Offset(17.0, 14.0))); expect(find.byKey(deleteButtonKey), findsNothing); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Delete button takes up at most half of the chip', (WidgetTester tester) async { final UniqueKey chipKey = UniqueKey(); @@ -2283,7 +2283,7 @@ void main() { // Simulate a tap on the label to select the chip. await tester.tap(find.byKey(labelKey)); expect(selected, equals(true)); - expect(SchedulerBinding.instance.transientCallbackCount, equals(kIsWeb && isCanvasKit ? 3 : 1)); + expect(SchedulerBinding.instance.transientCallbackCount, equals(kIsWeb && isSkiaWeb ? 3 : 1)); await tester.pump(); await tester.pump(const Duration(milliseconds: 50)); expect(getSelectProgress(tester), moreOrLessEquals(0.002, epsilon: 0.01)); @@ -2302,7 +2302,7 @@ void main() { // Simulate another tap on the label to deselect the chip. await tester.tap(find.byKey(labelKey)); expect(selected, equals(false)); - expect(SchedulerBinding.instance.transientCallbackCount, equals(kIsWeb && isCanvasKit ? 3 : 1)); + expect(SchedulerBinding.instance.transientCallbackCount, equals(kIsWeb && isSkiaWeb ? 3 : 1)); await tester.pump(); await tester.pump(const Duration(milliseconds: 20)); expect(getSelectProgress(tester), moreOrLessEquals(0.875, epsilon: 0.01)); @@ -2316,7 +2316,7 @@ void main() { expect(getSelectProgress(tester), equals(0.0)); expect(getAvatarDrawerProgress(tester), equals(1.0)); expect(getDeleteDrawerProgress(tester), equals(0.0)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Material2 - Selection without avatar works as expected on RawChip', (WidgetTester tester) async { bool selected = false; @@ -2435,7 +2435,7 @@ void main() { // Simulate a tap on the label to select the chip. await tester.tap(find.byKey(labelKey)); expect(selected, equals(true)); - expect(SchedulerBinding.instance.transientCallbackCount, equals(kIsWeb && isCanvasKit ? 3 : 1)); + expect(SchedulerBinding.instance.transientCallbackCount, equals(kIsWeb && isSkiaWeb ? 3 : 1)); await tester.pump(); await tester.pump(const Duration(milliseconds: 50)); expect(getSelectProgress(tester), moreOrLessEquals(0.002, epsilon: 0.01)); @@ -2455,7 +2455,7 @@ void main() { // Simulate another tap on the label to deselect the chip. await tester.tap(find.byKey(labelKey)); expect(selected, equals(false)); - expect(SchedulerBinding.instance.transientCallbackCount, equals(kIsWeb && isCanvasKit ? 3 : 1)); + expect(SchedulerBinding.instance.transientCallbackCount, equals(kIsWeb && isSkiaWeb ? 3 : 1)); await tester.pump(); await tester.pump(const Duration(milliseconds: 20)); expect(getSelectProgress(tester), moreOrLessEquals(0.875, epsilon: 0.01)); @@ -2469,7 +2469,7 @@ void main() { expect(getSelectProgress(tester), equals(0.0)); expect(getAvatarDrawerProgress(tester), equals(0.0)); expect(getDeleteDrawerProgress(tester), equals(0.0)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Material2 - Activation works as expected on RawChip', (WidgetTester tester) async { bool selected = false; @@ -2569,7 +2569,7 @@ void main() { await tester.tap(find.byKey(labelKey)); expect(selected, equals(true)); - expect(SchedulerBinding.instance.transientCallbackCount, equals(kIsWeb && isCanvasKit ? 3 : 1)); + expect(SchedulerBinding.instance.transientCallbackCount, equals(kIsWeb && isSkiaWeb ? 3 : 1)); await tester.pump(); await tester.pump(const Duration(milliseconds: 50)); expect(getSelectProgress(tester), moreOrLessEquals(0.002, epsilon: 0.01)); @@ -2584,7 +2584,7 @@ void main() { expect(getAvatarDrawerProgress(tester), equals(1.0)); expect(getDeleteDrawerProgress(tester), equals(0.0)); await tester.pumpAndSettle(); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Chip uses ThemeData chip theme if present', (WidgetTester tester) async { final ThemeData theme = ThemeData(chipTheme: const ChipThemeData(backgroundColor: Color(0xffff0000))); @@ -2755,7 +2755,7 @@ void main() { expect(tester.getSize(find.byKey(key2)).width, moreOrLessEquals(90.4, epsilon: 0.1)); expect(tester.getSize(find.byKey(key2)).height, equals(38.0)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Chip uses the right theme colors for the right components', (WidgetTester tester) async { final ThemeData themeData = ThemeData( @@ -4656,7 +4656,7 @@ void main() { box = tester.getRect(find.byKey(key)); expect(box.size.width, moreOrLessEquals(130.4, epsilon: 0.1)); expect(box.size.height, equals(24.0 + 16.0)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Chip delete button tooltip is disabled if deleteButtonTooltipMessage is empty', (WidgetTester tester) async { final UniqueKey deleteButtonKey = UniqueKey(); diff --git a/packages/flutter/test/material/date_picker_test.dart b/packages/flutter/test/material/date_picker_test.dart index 926e4598600..fb2df82557a 100644 --- a/packages/flutter/test/material/date_picker_test.dart +++ b/packages/flutter/test/material/date_picker_test.dart @@ -886,7 +886,7 @@ void main() { final Offset subHeaderTextTopLeft = tester.getTopLeft(subHeaderText); final Offset dividerTopRight = tester.getTopRight(divider); expect(subHeaderTextTopLeft.dx, dividerTopRight.dx + 24.0); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(subHeaderTextTopLeft.dy, dialogTopLeft.dy + 16.0); } @@ -902,7 +902,7 @@ void main() { final Offset calendarPageViewTopLeft = tester.getTopLeft(calendarPageView); final Offset subHeaderTextBottomLeft = tester.getBottomLeft(subHeaderText); expect(calendarPageViewTopLeft.dx, dividerTopRight.dx); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(calendarPageViewTopLeft.dy, subHeaderTextBottomLeft.dy + 16.0); } @@ -964,7 +964,7 @@ void main() { final Offset headerTextTextTopLeft = tester.getTopLeft(headerText); final Offset helpTextBottomLeft = tester.getBottomLeft(helpText); expect(headerTextTextTopLeft.dx, dialogTopLeft.dx + 24.0); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(headerTextTextTopLeft.dy, helpTextBottomLeft.dy + 28.0); } @@ -986,7 +986,7 @@ void main() { final Offset subHeaderTextTopLeft = tester.getTopLeft(subHeaderText); final Offset dividerBottomLeft = tester.getBottomLeft(divider); expect(subHeaderTextTopLeft.dx, dialogTopLeft.dx + 24.0); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(subHeaderTextTopLeft.dy, dividerBottomLeft.dy + 16.0); } @@ -1011,7 +1011,7 @@ void main() { final Offset calendarPageViewTopLeft = tester.getTopLeft(calendarPageView); final Offset subHeaderTextBottomLeft = tester.getBottomLeft(subHeaderText); expect(calendarPageViewTopLeft.dx, dialogTopLeft.dx); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(calendarPageViewTopLeft.dy, subHeaderTextBottomLeft.dy + 16.0); } diff --git a/packages/flutter/test/material/date_range_picker_test.dart b/packages/flutter/test/material/date_range_picker_test.dart index 44b9a7611b3..1fcc7aa8e61 100644 --- a/packages/flutter/test/material/date_range_picker_test.dart +++ b/packages/flutter/test/material/date_range_picker_test.dart @@ -135,18 +135,18 @@ void main() { find.widgetWithIcon(IconButton, Icons.edit_outlined), ); expect(saveButtonBottomLeft.dx, moreOrLessEquals(711.6, epsilon: 1e-5)); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(saveButtonBottomLeft.dy, helpTextTopLeft.dy); } expect(entryButtonBottomLeft.dx, saveButtonBottomLeft.dx - 48.0); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(entryButtonBottomLeft.dy, helpTextTopLeft.dy); } // Test help text position. final Offset helpTextBottomLeft = tester.getBottomLeft(helpText); expect(helpTextBottomLeft.dx, 72.0); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(helpTextBottomLeft.dy, closeButtonBottomRight.dy + 20.0); } diff --git a/packages/flutter/test/material/dialog_theme_test.dart b/packages/flutter/test/material/dialog_theme_test.dart index 04c2bcb9cf7..cc9a5661e4d 100644 --- a/packages/flutter/test/material/dialog_theme_test.dart +++ b/packages/flutter/test/material/dialog_theme_test.dart @@ -196,7 +196,7 @@ void main() { find.descendant(of: find.byType(Dialog), matching: find.byType(Material)), ); expect(bottomLeft.dx, 480.0); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(bottomLeft.dy, 124.0); } }); diff --git a/packages/flutter/test/material/filter_chip_test.dart b/packages/flutter/test/material/filter_chip_test.dart index 3de2be76e4d..535879c94fa 100644 --- a/packages/flutter/test/material/filter_chip_test.dart +++ b/packages/flutter/test/material/filter_chip_test.dart @@ -905,7 +905,7 @@ void main() { // Test the delete button icon. expect(tester.getSize(find.byIcon(Icons.clear)), const Size(18.0, 18.0)); expect(getIconData(tester).color, theme.colorScheme.onSurfaceVariant); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Material2 - FilterChip supports delete button', (WidgetTester tester) async { final ThemeData theme = ThemeData(useMaterial3: false); diff --git a/packages/flutter/test/material/ink_paint_test.dart b/packages/flutter/test/material/ink_paint_test.dart index be55444f488..7922c4e15ee 100644 --- a/packages/flutter/test/material/ink_paint_test.dart +++ b/packages/flutter/test/material/ink_paint_test.dart @@ -130,7 +130,7 @@ void main() { await tester.pump(const Duration(milliseconds: 200)); // wait for splash to be well under way final RenderBox box = Material.of(tester.element(find.byType(InkWell))) as RenderBox; - if (kIsWeb && isCanvasKit) { + if (kIsWeb && isSkiaWeb) { expect( box, paints @@ -164,7 +164,7 @@ void main() { ); await gesture.up(); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('The InkWell widget renders an ink ripple', (WidgetTester tester) async { const Color highlightColor = Color(0xAAFF0000); diff --git a/packages/flutter/test/material/ink_splash_test.dart b/packages/flutter/test/material/ink_splash_test.dart index 372ea3a07cb..505068a1219 100644 --- a/packages/flutter/test/material/ink_splash_test.dart +++ b/packages/flutter/test/material/ink_splash_test.dart @@ -134,11 +134,11 @@ void main() { final TestGesture gesture = await tester.startGesture(tester.getCenter(find.text('test'))); final MaterialInkController material = Material.of(tester.element(find.text('test'))); await tester.pump(const Duration(milliseconds: 200)); - expect(material, paintsExactlyCountTimes(#drawRect, (kIsWeb && isCanvasKit ? 1 : 2))); + expect(material, paintsExactlyCountTimes(#drawRect, (kIsWeb && isSkiaWeb ? 1 : 2))); await gesture.up(); await tester.pumpAndSettle(); } - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 // Regression test for https://github.com/flutter/flutter/issues/136441. testWidgets('PageView item can dispose when widget with NoSplash.splashFactory is tapped', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/list_tile_test.dart b/packages/flutter/test/material/list_tile_test.dart index 019ad142e88..26390a7d986 100644 --- a/packages/flutter/test/material/list_tile_test.dart +++ b/packages/flutter/test/material/list_tile_test.dart @@ -154,7 +154,7 @@ void main() { await tester.pumpWidget(buildFrame(isTwoLine: true, textScaler: const TextScaler.linear(4.0))); testChildren(); testHorizontalGeometry(); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 testVerticalGeometry(192.0); } @@ -162,14 +162,14 @@ void main() { await tester.pumpWidget(buildFrame(isTwoLine: true, textScaler: const TextScaler.linear(0.5), subtitleScaler: const TextScaler.linear(4.0))); testChildren(); testHorizontalGeometry(); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 testVerticalGeometry(108.0); } await tester.pumpWidget(buildFrame(isThreeLine: true, textScaler: const TextScaler.linear(4.0))); testChildren(); testHorizontalGeometry(); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 testVerticalGeometry(192.0); } }); @@ -505,7 +505,7 @@ void main() { ), ); - if (kIsWeb && !isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (kIsWeb && !isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 return; } const double height = 300; diff --git a/packages/flutter/test/material/menu_style_test.dart b/packages/flutter/test/material/menu_style_test.dart index 8ebacf66323..68119a69a5c 100644 --- a/packages/flutter/test/material/menu_style_test.dart +++ b/packages/flutter/test/material/menu_style_test.dart @@ -81,7 +81,7 @@ void main() { expect(tester.getRect(findMenuPanels().first).size, equals(const Size(600.0, 60.0))); // MenuTheme affects menus. - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(tester.getRect(findMenuPanels().at(1)), equals(const Rect.fromLTRB(104.0, 54.0, 204.0, 154.0))); expect(tester.getRect(findMenuPanels().at(1)).size, equals(const Size(100.0, 100.0))); } diff --git a/packages/flutter/test/material/navigation_bar_test.dart b/packages/flutter/test/material/navigation_bar_test.dart index 1974e259059..f4676d597f6 100644 --- a/packages/flutter/test/material/navigation_bar_test.dart +++ b/packages/flutter/test/material/navigation_bar_test.dart @@ -410,7 +410,7 @@ void main() { await tester.longPress(find.text(label)); expect(find.text(label), findsNWidgets(2)); - if (!kIsWeb || isCanvasKit) { + if (!kIsWeb || isSkiaWeb) { expect(tester.getSize(find.text(label).last), const Size(14.25, 20.0)); } // The duration is needed to ensure the tooltip disappears. @@ -420,7 +420,7 @@ void main() { expect(find.text(label), findsOneWidget); await tester.longPress(find.text(label)); - if (!kIsWeb || isCanvasKit) { + if (!kIsWeb || isSkiaWeb) { expect(tester.getSize(find.text(label).last), const Size(56.25, 80.0)); } }); @@ -467,25 +467,25 @@ void main() { await tester.pumpWidget(buildApp(textScaler: TextScaler.noScaling)); expect(find.text(label), findsOneWidget); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( _sizeAlmostEqual(tester.getSize(find.text(label)), const Size(12.5, 16.0)), true); } await tester.pumpWidget(buildApp(textScaler: const TextScaler.linear(1.1))); await tester.pumpAndSettle(); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( _sizeAlmostEqual(tester.getSize(find.text(label)), const Size(13.7, 18.0)), true); } await tester.pumpWidget(buildApp(textScaler: const TextScaler.linear(1.3))); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( _sizeAlmostEqual(tester.getSize(find.text(label)), const Size(16.1, 21.0)), true); } await tester.pumpWidget(buildApp(textScaler: const TextScaler.linear(4))); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( _sizeAlmostEqual(tester.getSize(find.text(label)), const Size(16.1, 21.0)), true); } }); @@ -891,7 +891,7 @@ void main() { color: const Color(0x0a000000), ) ); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Material3 - Navigation indicator ripple golden test', (WidgetTester tester) async { // This is a regression test for https://github.com/flutter/flutter/issues/117420. diff --git a/packages/flutter/test/material/navigation_drawer_test.dart b/packages/flutter/test/material/navigation_drawer_test.dart index 849ce1fe60d..35c39f918d3 100644 --- a/packages/flutter/test/material/navigation_drawer_test.dart +++ b/packages/flutter/test/material/navigation_drawer_test.dart @@ -481,7 +481,7 @@ void main() { await tester.tap(find.text('Accessible')); expect(selectedIndex, 1); - tester.pumpAndSettle(); + await tester.pumpAndSettle(); }); } diff --git a/packages/flutter/test/material/navigation_rail_test.dart b/packages/flutter/test/material/navigation_rail_test.dart index dea6254965c..3f4f3947e54 100644 --- a/packages/flutter/test/material/navigation_rail_test.dart +++ b/packages/flutter/test/material/navigation_rail_test.dart @@ -540,7 +540,7 @@ void main() { // The second destination is below the first with some spacing. nextDestinationY += destinationHeightWithLabel + destinationSpacing; final RenderBox secondIconRenderBox = _iconRenderBox(tester, Icons.bookmark_border); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( secondIconRenderBox.localToGlobal(Offset.zero), equals( @@ -555,7 +555,7 @@ void main() { // The third destination is below the second with some spacing. nextDestinationY += destinationHeight + destinationSpacing; final RenderBox thirdIconRenderBox = _iconRenderBox(tester, Icons.star_border); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( thirdIconRenderBox.localToGlobal(Offset.zero), equals( @@ -570,7 +570,7 @@ void main() { // The fourth destination is below the third with some spacing. nextDestinationY += destinationHeight + destinationSpacing; final RenderBox fourthIconRenderBox = _iconRenderBox(tester, Icons.hotel); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( fourthIconRenderBox.localToGlobal(Offset.zero), equals( @@ -638,7 +638,7 @@ void main() { // The second destination is below the first with some spacing. nextDestinationY += destinationHeightWithLabel + destinationSpacing; final RenderBox secondIconRenderBox = _iconRenderBox(tester, Icons.bookmark_border); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( secondIconRenderBox.localToGlobal(Offset.zero), equals( @@ -653,7 +653,7 @@ void main() { // The third destination is below the second with some spacing. nextDestinationY += destinationHeight + destinationSpacing; final RenderBox thirdIconRenderBox = _iconRenderBox(tester, Icons.star_border); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( thirdIconRenderBox.localToGlobal(Offset.zero), equals( @@ -668,7 +668,7 @@ void main() { // The fourth destination is below the third with some spacing. nextDestinationY += destinationHeight + destinationSpacing; final RenderBox fourthIconRenderBox = _iconRenderBox(tester, Icons.hotel); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( fourthIconRenderBox.localToGlobal(Offset.zero), equals( @@ -736,7 +736,7 @@ void main() { // The second destination is below the first with some spacing. nextDestinationY += destinationHeightWithLabel + destinationSpacing; final RenderBox secondIconRenderBox = _iconRenderBox(tester, Icons.bookmark_border); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( secondIconRenderBox.localToGlobal(Offset.zero), equals( @@ -751,7 +751,7 @@ void main() { // The third destination is below the second with some spacing. nextDestinationY += destinationHeight + destinationSpacing; final RenderBox thirdIconRenderBox = _iconRenderBox(tester, Icons.star_border); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( thirdIconRenderBox.localToGlobal(Offset.zero), equals( @@ -766,7 +766,7 @@ void main() { // The fourth destination is below the third with some spacing. nextDestinationY += destinationHeight + destinationSpacing; final RenderBox fourthIconRenderBox = _iconRenderBox(tester, Icons.hotel); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( fourthIconRenderBox.localToGlobal(Offset.zero), equals( @@ -833,7 +833,7 @@ void main() { // The second destination is below the first with some spacing. nextDestinationY += destinationHeightWithLabel + destinationSpacing; final RenderBox secondIconRenderBox = _iconRenderBox(tester, Icons.bookmark_border); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( secondIconRenderBox.localToGlobal(Offset.zero), equals( @@ -848,7 +848,7 @@ void main() { // The third destination is below the second with some spacing. nextDestinationY += destinationHeightWithLabel + destinationSpacing; final RenderBox thirdIconRenderBox = _iconRenderBox(tester, Icons.star_border); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( thirdIconRenderBox.localToGlobal(Offset.zero), equals( @@ -863,7 +863,7 @@ void main() { // The fourth destination is below the third with some spacing. nextDestinationY += destinationHeightWithLabel + destinationSpacing; final RenderBox fourthIconRenderBox = _iconRenderBox(tester, Icons.hotel); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( fourthIconRenderBox.localToGlobal(Offset.zero), equals( @@ -931,7 +931,7 @@ void main() { // The second destination is below the first with some spacing. nextDestinationY += destinationHeightWithLabel + destinationSpacing; final RenderBox secondIconRenderBox = _iconRenderBox(tester, Icons.bookmark_border); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( secondIconRenderBox.localToGlobal(Offset.zero), equals( @@ -946,7 +946,7 @@ void main() { // The third destination is below the second with some spacing. nextDestinationY += destinationHeightWithLabel + destinationSpacing; final RenderBox thirdIconRenderBox = _iconRenderBox(tester, Icons.star_border); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( thirdIconRenderBox.localToGlobal(Offset.zero), equals( @@ -961,7 +961,7 @@ void main() { // The fourth destination is below the third with some spacing. nextDestinationY += destinationHeightWithLabel + destinationSpacing; final RenderBox fourthIconRenderBox = _iconRenderBox(tester, Icons.hotel); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( fourthIconRenderBox.localToGlobal(Offset.zero), equals( @@ -1029,7 +1029,7 @@ void main() { // The second destination is below the first with some spacing. nextDestinationY += destinationHeightWithLabel + destinationSpacing; final RenderBox secondIconRenderBox = _iconRenderBox(tester, Icons.bookmark_border); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( secondIconRenderBox.localToGlobal(Offset.zero), equals( @@ -1044,7 +1044,7 @@ void main() { // The third destination is below the second with some spacing. nextDestinationY += destinationHeightWithLabel + destinationSpacing; final RenderBox thirdIconRenderBox = _iconRenderBox(tester, Icons.star_border); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( thirdIconRenderBox.localToGlobal(Offset.zero), equals( @@ -1059,7 +1059,7 @@ void main() { // The fourth destination is below the third with some spacing. nextDestinationY += destinationHeightWithLabel + destinationSpacing; final RenderBox fourthIconRenderBox = _iconRenderBox(tester, Icons.hotel); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect( fourthIconRenderBox.localToGlobal(Offset.zero), equals( @@ -2072,7 +2072,7 @@ void main() { expect(selectedIndex, 2); // Wait for any pending shader compilation. - tester.pumpAndSettle(); + await tester.pumpAndSettle(); }); testWidgets('onDestinationSelected is not called if null', (WidgetTester tester) async { @@ -2090,7 +2090,7 @@ void main() { expect(selectedIndex, 0); // Wait for any pending shader compilation. - tester.pumpAndSettle(); + await tester.pumpAndSettle(); }); testWidgets('Changing destinations animate when [labelType]=selected', (WidgetTester tester) async { @@ -2823,7 +2823,7 @@ void main() { color: const Color(0xffe8def8), ), ); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('NavigationRail indicator renders ripple - extended', (WidgetTester tester) async { // This is a regression test for https://github.com/flutter/flutter/issues/117126 @@ -3171,7 +3171,7 @@ void main() { color: const Color(0xffe8def8), ), ); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('NavigationRail indicator renders properly with large icon', (WidgetTester tester) async { // This is a regression test for https://github.com/flutter/flutter/issues/133799. @@ -3274,7 +3274,7 @@ void main() { color: const Color(0xffe8def8), ), ); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('NavigationRail indicator renders properly when text direction is rtl', (WidgetTester tester) async { // This is a regression test for https://github.com/flutter/flutter/issues/134361. @@ -3373,7 +3373,7 @@ void main() { color: const Color(0xffe8def8), ), ); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('NavigationRail indicator scale transform', (WidgetTester tester) async { int selectedIndex = 0; @@ -3504,7 +3504,7 @@ void main() { expect(selectedIndex, 1); // Wait for any pending shader compilation. - tester.pumpAndSettle(); + await tester.pumpAndSettle(); }); testWidgets("Destination's label with the right opacity while disabled", (WidgetTester tester) async { @@ -3603,7 +3603,7 @@ void main() { inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures'); expect(inkFeatures, paints..circle(color: Colors.transparent)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Navigation rail can have expanded widgets inside', (WidgetTester tester) async { await _pumpNavigationRail( @@ -3745,7 +3745,7 @@ void main() { ), ), ); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Destination spacing is correct - [labelType]=none (default), [textScaleFactor]=3.0', (WidgetTester tester) async { // Since the rail is icon only, its destinations should not be affected by @@ -3815,7 +3815,7 @@ void main() { ), ), ); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Destination spacing is correct - [labelType]=none (default), [textScaleFactor]=0.75', (WidgetTester tester) async { // Since the rail is icon only, its destinations should not be affected by @@ -3885,7 +3885,7 @@ void main() { ), ), ); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Destination spacing is correct - [labelType]=selected, [textScaleFactor]=1.0 (default)', (WidgetTester tester) async { await _pumpNavigationRail( diff --git a/packages/flutter/test/material/outlined_button_test.dart b/packages/flutter/test/material/outlined_button_test.dart index 8fb94679ed6..b4b0ea3788f 100644 --- a/packages/flutter/test/material/outlined_button_test.dart +++ b/packages/flutter/test/material/outlined_button_test.dart @@ -1172,7 +1172,7 @@ void main() { expect(tester.getSize(find.byType(OutlinedButton)), const Size(134.0, 48.0)); expect(tester.getSize(find.byType(Text)), const Size(126.0, 42.0)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/122066 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/122066 testWidgets('OutlinedButton onPressed and onLongPress callbacks are distinctly recognized', (WidgetTester tester) async { bool didPressButton = false; diff --git a/packages/flutter/test/material/snack_bar_test.dart b/packages/flutter/test/material/snack_bar_test.dart index 55723991df1..c35f1e26d5b 100644 --- a/packages/flutter/test/material/snack_bar_test.dart +++ b/packages/flutter/test/material/snack_bar_test.dart @@ -2965,7 +2965,7 @@ void main() { await expectLater(find.byType(MaterialApp), matchesGoldenFile('m3_snack_bar.scaffold.nested.png')); final Offset snackBarTopRight = tester.getTopRight(find.byType(SnackBar)); - if (!kIsWeb || isCanvasKit) { // https://github.com/flutter/flutter/issues/99933 + if (!kIsWeb || isSkiaWeb) { // https://github.com/flutter/flutter/issues/99933 expect(snackBarTopRight.dy, 465.0); } }); diff --git a/packages/flutter/test/material/text_button_test.dart b/packages/flutter/test/material/text_button_test.dart index dad9b2771dc..3f8a5b5e4b7 100644 --- a/packages/flutter/test/material/text_button_test.dart +++ b/packages/flutter/test/material/text_button_test.dart @@ -695,7 +695,7 @@ void main() { expect(tester.getSize(find.byType(TextButton)), const Size(134.0, 48.0)); expect(tester.getSize(find.byType(Text)), const Size(126.0, 42.0)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/61016 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/61016 testWidgets('TextButton size is configurable by ThemeData.materialTapTargetSize', (WidgetTester tester) async { Widget buildFrame(MaterialTapTargetSize tapTargetSize, Key key) { diff --git a/packages/flutter/test/material/toggle_buttons_test.dart b/packages/flutter/test/material/toggle_buttons_test.dart index c9bea29d648..1681ca3a801 100644 --- a/packages/flutter/test/material/toggle_buttons_test.dart +++ b/packages/flutter/test/material/toggle_buttons_test.dart @@ -1370,7 +1370,7 @@ void main() { expect(firstToggleButtonDy, secondToggleButtonDy); expect(firstToggleButtonDy, closeTo(elevatedButtonDy - 1.7, 0.1)); expect(firstToggleButtonDy, closeTo(textDy - 9.7, 0.1)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Directionality test', (WidgetTester tester) async { await tester.pumpWidget( diff --git a/packages/flutter/test/material/tooltip_test.dart b/packages/flutter/test/material/tooltip_test.dart index d038bf99d3f..b0b9ef344b9 100644 --- a/packages/flutter/test/material/tooltip_test.dart +++ b/packages/flutter/test/material/tooltip_test.dart @@ -192,7 +192,7 @@ void main() { ); expect(tip.size.height, equals(24.0)); // 14.0 height + 5.0 padding * 2 (top, bottom) expect(tip.localToGlobal(tip.size.topLeft(Offset.zero)), equals(const Offset(10.0, 20.0))); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Material3 - Does tooltip end up in the right place - top left', (WidgetTester tester) async { final GlobalKey tooltipKey = GlobalKey(); @@ -245,7 +245,7 @@ void main() { ); expect(tip.size.height, equals(30.0)); // 20.0 height + 5.0 padding * 2 (top, bottom) expect(tip.localToGlobal(tip.size.topLeft(Offset.zero)), equals(const Offset(10.0, 20.0))); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Does tooltip end up in the right place - center prefer above fits', (WidgetTester tester) async { final GlobalKey tooltipKey = GlobalKey(); @@ -533,7 +533,7 @@ void main() { expect(tip.localToGlobal(tip.size.topLeft(Offset.zero)).dy, equals(310.0)); expect(tip.localToGlobal(tip.size.bottomRight(Offset.zero)).dx, equals(790.0)); expect(tip.localToGlobal(tip.size.bottomRight(Offset.zero)).dy, equals(330.0)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Material2 - Does tooltip end up in the right place - near the edge', (WidgetTester tester) async { final GlobalKey tooltipKey = GlobalKey(); @@ -646,7 +646,7 @@ void main() { expect(tip.localToGlobal(tip.size.topLeft(Offset.zero)).dy, equals(310.0)); expect(tip.localToGlobal(tip.size.bottomRight(Offset.zero)).dx, equals(790.0)); expect(tip.localToGlobal(tip.size.bottomRight(Offset.zero)).dy, equals(330.0)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Tooltip should be fully visible when MediaQuery.viewInsets > 0', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/23666 @@ -1125,7 +1125,7 @@ void main() { final Container tooltipContainer = tester.firstWidget(_findTooltipContainer(tooltipText)); expect(tooltipContainer.padding, const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0)); }, variant: const TargetPlatformVariant({TargetPlatform.macOS, TargetPlatform.linux, TargetPlatform.windows}), - skip: kIsWeb && !isCanvasKit, // https://github.com/flutter/flutter/issues/99933 + skip: kIsWeb && !isSkiaWeb, // https://github.com/flutter/flutter/issues/99933 ); testWidgets('Material2 - Can tooltip decoration be customized', (WidgetTester tester) async { @@ -2109,7 +2109,7 @@ void main() { _findTooltipContainer(tooltipText), ); expect(tip.size.height, equals(88.0)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/99933 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 testWidgets('Tooltip text displays with richMessage', (WidgetTester tester) async { final GlobalKey tooltipKey = GlobalKey(); diff --git a/packages/flutter/test/painting/shader_warm_up_test.dart b/packages/flutter/test/painting/shader_warm_up_test.dart index 8028dd0b6cc..403a8e28240 100644 --- a/packages/flutter/test/painting/shader_warm_up_test.dart +++ b/packages/flutter/test/painting/shader_warm_up_test.dart @@ -15,7 +15,7 @@ Future main() async { debugCaptureShaderWarmUpImage = expectAsync1((ui.Image image) => true); WidgetsFlutterBinding.ensureInitialized(); expect(shaderWarmUp.ranWarmUp, true); - }, skip: kIsWeb && !isCanvasKit); // [intended] Testing only for canvasKit + }, skip: kIsWeb && !isSkiaWeb); // [intended] Testing only for canvasKit } class FakeShaderWarmUp extends ShaderWarmUp { diff --git a/packages/flutter/test/painting/text_painter_test.dart b/packages/flutter/test/painting/text_painter_test.dart index b6ee9f0c56a..f8feb2afd8b 100644 --- a/packages/flutter/test/painting/text_painter_test.dart +++ b/packages/flutter/test/painting/text_painter_test.dart @@ -164,7 +164,7 @@ void main() { final Offset caretOffset = painter.getOffsetForCaret(ui.TextPosition(offset: painter.text!.toPlainText().length), ui.Rect.zero); expect(caretOffset.dx, painter.width); painter.dispose(); - }, skip: isBrowser && !isCanvasKit); // https://github.com/flutter/flutter/issues/56308 + }, skip: isBrowser && !isSkiaWeb); // https://github.com/flutter/flutter/issues/56308 test('TextPainter null text test', () { final TextPainter painter = TextPainter() @@ -259,7 +259,7 @@ void main() { caretOffset = painter.getOffsetForCaret(const ui.TextPosition(offset: 23), ui.Rect.zero); expect(caretOffset.dx, 126); // end of string painter.dispose(); - }, skip: isBrowser && !isCanvasKit); // https://github.com/flutter/flutter/issues/56308 + }, skip: isBrowser && !isSkiaWeb); // https://github.com/flutter/flutter/issues/56308 test('TextPainter caret emoji tests: single, long emoji', () { // Regression test for https://github.com/flutter/flutter/issues/50563 @@ -277,7 +277,7 @@ void main() { // their lengths in code units are powers of 2, namely 4 and 8). checkCaretOffsetsLtr('🇺🇳'); checkCaretOffsetsLtr('👩‍❤️‍👨'); - }, skip: isBrowser && !isCanvasKit); // https://github.com/flutter/flutter/issues/56308 + }, skip: isBrowser && !isSkiaWeb); // https://github.com/flutter/flutter/issues/56308 test('TextPainter caret emoji test: letters, then 1 emoji of 5 code units', () { // Regression test for https://github.com/flutter/flutter/issues/50563 @@ -285,18 +285,18 @@ void main() { checkCaretOffsetsLtr('ab👩‍🚀'); checkCaretOffsetsLtr('abc👩‍🚀'); checkCaretOffsetsLtr('abcd👩‍🚀'); - }, skip: isBrowser && !isCanvasKit); // https://github.com/flutter/flutter/issues/56308 + }, skip: isBrowser && !isSkiaWeb); // https://github.com/flutter/flutter/issues/56308 test('TextPainter caret zalgo test', () { // Regression test for https://github.com/flutter/flutter/issues/98516 checkCaretOffsetsLtr('Z͉̳̺ͥͬ̾a̴͕̲̒̒͌̋ͪl̨͎̰̘͉̟ͤ̀̈̚͜g͕͔̤͖̟̒͝ͅo̵̡̡̼͚̐ͯ̅ͪ̆ͣ̚'); - }, skip: isBrowser && !isCanvasKit); // https://github.com/flutter/flutter/issues/56308 + }, skip: isBrowser && !isSkiaWeb); // https://github.com/flutter/flutter/issues/56308 test('TextPainter caret Devanagari test', () { // Regression test for https://github.com/flutter/flutter/issues/118403 checkCaretOffsetsLtrFromPieces( ['प्रा', 'प्त', ' ', 'व', 'र्ण', 'न', ' ', 'प्र', 'व्रु', 'ति']); - }, skip: isBrowser && !isCanvasKit); // https://github.com/flutter/flutter/issues/56308 + }, skip: isBrowser && !isSkiaWeb); // https://github.com/flutter/flutter/issues/56308 test('TextPainter caret Devanagari test, full strength', () { // Regression test for https://github.com/flutter/flutter/issues/118403 @@ -325,7 +325,7 @@ void main() { TextSpan(text: '👩‍🚀', style: TextStyle()), ])), [0, 14, 28, 42, 56, 70, 84, 112, 112, 112, 112, 112]); - }, skip: isBrowser && !isCanvasKit); // https://github.com/flutter/flutter/issues/56308 + }, skip: isBrowser && !isSkiaWeb); // https://github.com/flutter/flutter/issues/56308 test('TextPainter caret emoji test RTL: letters next to emoji, as separate TextBoxes', () { // Regression test for https://github.com/flutter/flutter/issues/122477 @@ -343,7 +343,7 @@ void main() { TextSpan(text: '👩‍🚀', style: TextStyle()), ])), [112, 98, 84, 70, 56, 42, 28, 0, 0, 0, 0, 0]); - }, skip: isBrowser && !isCanvasKit); // https://github.com/flutter/flutter/issues/56308 + }, skip: isBrowser && !isSkiaWeb); // https://github.com/flutter/flutter/issues/56308 test('TextPainter caret center space test', () { final TextPainter painter = TextPainter() @@ -366,7 +366,7 @@ void main() { caretOffset = painter.getOffsetForCaret(const ui.TextPosition(offset: 2), ui.Rect.zero); expect(caretOffset.dx, 49); painter.dispose(); - }, skip: isBrowser && !isCanvasKit); // https://github.com/flutter/flutter/issues/56308 + }, skip: isBrowser && !isSkiaWeb); // https://github.com/flutter/flutter/issues/56308 test('TextPainter caret height and line height', () { final TextPainter painter = TextPainter() @@ -383,7 +383,7 @@ void main() { ); expect(caretHeight, 50.0); painter.dispose(); - }, skip: isBrowser && !isCanvasKit); // https://github.com/flutter/flutter/issues/56308 + }, skip: isBrowser && !isSkiaWeb); // https://github.com/flutter/flutter/issues/56308 test('upstream downstream makes no difference in the same line within the same bidi run', () { final TextPainter painter = TextPainter(textDirection: TextDirection.ltr) @@ -420,7 +420,7 @@ void main() { painter.getOffsetForCaret(TextPosition(offset: text.length), largeRect).dx, 1000 - text.length * fontSize - largeRect.width, ); - }, skip: isBrowser && !isCanvasKit); // https://github.com/flutter/flutter/issues/56308 + }, skip: isBrowser && !isSkiaWeb); // https://github.com/flutter/flutter/issues/56308 test('End of text caret when the text ends with +1 bidi level', () { const double fontSize = 14.0; @@ -444,7 +444,7 @@ void main() { painter.getOffsetForCaret(const TextPosition(offset: 2), largeRect).dx, fontSize * 2, ); - }, skip: isBrowser && !isCanvasKit); // https://github.com/flutter/flutter/issues/56308 + }, skip: isBrowser && !isSkiaWeb); // https://github.com/flutter/flutter/issues/56308 test('handles newlines properly', () { final TextPainter painter = TextPainter() @@ -1056,7 +1056,7 @@ void main() { expect(painter.inlinePlaceholderBoxes![12], const TextBox.fromLTRBD(300, 30, 351, 60, TextDirection.ltr)); expect(painter.inlinePlaceholderBoxes![13], const TextBox.fromLTRBD(351, 30, 401, 60, TextDirection.ltr)); painter.dispose(); - }, skip: isBrowser && !isCanvasKit); // https://github.com/flutter/flutter/issues/87540 + }, skip: isBrowser && !isSkiaWeb); // https://github.com/flutter/flutter/issues/87540 // Null values are valid. See https://github.com/flutter/flutter/pull/48346#issuecomment-584839221 test('TextPainter set TextHeightBehavior null test', () { @@ -1131,7 +1131,7 @@ void main() { expect(lines[2].lineNumber, 2); expect(lines[3].lineNumber, 3); painter.dispose(); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/122066 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/122066 group('TextPainter line-height', () { test('half-leading', () { @@ -1253,7 +1253,7 @@ void main() { expect(glyphBox, newGlyphBox); painter.dispose(); }); - }, skip: isBrowser && !isCanvasKit); // https://github.com/flutter/flutter/issues/87543 + }, skip: isBrowser && !isSkiaWeb); // https://github.com/flutter/flutter/issues/87543 test('TextPainter handles invalid UTF-16', () { FlutterErrorDetails? error; @@ -1290,7 +1290,7 @@ void main() { ui.Rect.zero); expect(caretOffset.dx, painter.width); painter.dispose(); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/87545 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/87545 test('TextPainter line metrics update after layout', () { final TextPainter painter = TextPainter() @@ -1311,7 +1311,7 @@ void main() { lines = painter.computeLineMetrics(); expect(lines.length, 1); painter.dispose(); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/62819 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/62819 test('TextPainter throws with stack trace when accessing text layout', () { final TextPainter painter = TextPainter() @@ -1383,7 +1383,7 @@ void main() { )), ); painter.dispose(); - }, skip: isBrowser && !isCanvasKit); // https://github.com/flutter/flutter/issues/56308 + }, skip: isBrowser && !isSkiaWeb); // https://github.com/flutter/flutter/issues/56308 test('TextPainter does not require layout after providing identical placeholder dimensions', () { final TextPainter painter = TextPainter() @@ -1420,7 +1420,7 @@ void main() { ))), ); painter.dispose(); - }, skip: isBrowser && !isCanvasKit); // https://github.com/flutter/flutter/issues/56308 + }, skip: isBrowser && !isSkiaWeb); // https://github.com/flutter/flutter/issues/56308 test('TextPainter - debugDisposed', () { final TextPainter painter = TextPainter(); @@ -1613,7 +1613,7 @@ void main() { case final List metrics: expect(metrics, hasLength(1)); } - }, skip: kIsWeb && !isCanvasKit); // [intended] Browsers seem to always round font/glyph metrics. + }, skip: kIsWeb && !isSkiaWeb); // [intended] Browsers seem to always round font/glyph metrics. group('strut style', () { test('strut style applies when the span has no style', () { @@ -1680,7 +1680,7 @@ void main() { ..layout(); expect(painter.height, 100); }); - }, skip: kIsWeb && !isCanvasKit); // [intended] strut spport for HTML renderer https://github.com/flutter/flutter/issues/32243. + }, skip: kIsWeb && !isSkiaWeb); // [intended] strut spport for HTML renderer https://github.com/flutter/flutter/issues/32243. test('TextPainter dispatches memory events', () async { await expectLater( diff --git a/packages/flutter/test/rendering/editable_intrinsics_test.dart b/packages/flutter/test/rendering/editable_intrinsics_test.dart index 3990a8a9fa0..280aacb8c44 100644 --- a/packages/flutter/test/rendering/editable_intrinsics_test.dart +++ b/packages/flutter/test/rendering/editable_intrinsics_test.dart @@ -111,7 +111,7 @@ void main() { editable.strutStyle = const StrutStyle(fontSize: 100, forceStrutHeight: true); expect(editable.getMaxIntrinsicHeight(double.infinity), 100); - }, skip: kIsWeb && !isCanvasKit); // [intended] strut spport for HTML renderer https://github.com/flutter/flutter/issues/32243. + }, skip: kIsWeb && !isSkiaWeb); // [intended] strut support for HTML renderer https://github.com/flutter/flutter/issues/32243. } class _FakeEditableTextState with TextSelectionDelegate { diff --git a/packages/flutter/test/rendering/layers_test.dart b/packages/flutter/test/rendering/layers_test.dart index d74521a5af4..f69b6644e04 100644 --- a/packages/flutter/test/rendering/layers_test.dart +++ b/packages/flutter/test/rendering/layers_test.dart @@ -534,7 +534,7 @@ void main() { // Ensure we can render the same scene again after rendering an interior // layer. parent.buildScene(SceneBuilder()); - }, skip: isBrowser && !isCanvasKit); // TODO(yjbanov): `toImage` doesn't work in HTML: https://github.com/flutter/flutter/issues/49857 + }, skip: isBrowser && !isSkiaWeb); // TODO(yjbanov): `toImage` doesn't work in HTML: https://github.com/flutter/flutter/issues/49857 test('ContainerLayer.toImageSync can render interior layer', () { final OffsetLayer parent = OffsetLayer(); @@ -552,7 +552,7 @@ void main() { // Ensure we can render the same scene again after rendering an interior // layer. parent.buildScene(SceneBuilder()); - }, skip: isBrowser && !isCanvasKit); // TODO(yjbanov): `toImage` doesn't work in HTML: https://github.com/flutter/flutter/issues/49857 + }, skip: isBrowser && !isSkiaWeb); // TODO(yjbanov): `toImage` doesn't work in HTML: https://github.com/flutter/flutter/issues/49857 test('PictureLayer does not let you call dispose unless refcount is 0', () { PictureLayer layer = PictureLayer(Rect.zero); diff --git a/packages/flutter/test/rendering/paragraph_intrinsics_test.dart b/packages/flutter/test/rendering/paragraph_intrinsics_test.dart index a4032835f0b..f74f026bcb0 100644 --- a/packages/flutter/test/rendering/paragraph_intrinsics_test.dart +++ b/packages/flutter/test/rendering/paragraph_intrinsics_test.dart @@ -111,5 +111,5 @@ void main() { paragraph.strutStyle = const StrutStyle(fontSize: 100, forceStrutHeight: true); expect(paragraph.getMaxIntrinsicHeight(double.infinity), 100); - }, skip: kIsWeb && !isCanvasKit); // [intended] strut spport for HTML renderer https://github.com/flutter/flutter/issues/32243. + }, skip: kIsWeb && !isSkiaWeb); // [intended] strut spport for HTML renderer https://github.com/flutter/flutter/issues/32243. } diff --git a/packages/flutter/test/rendering/paragraph_test.dart b/packages/flutter/test/rendering/paragraph_test.dart index 91137007d09..78c4fec369d 100644 --- a/packages/flutter/test/rendering/paragraph_test.dart +++ b/packages/flutter/test/rendering/paragraph_test.dart @@ -4,7 +4,7 @@ import 'dart:ui' as ui show BoxHeightStyle, BoxWidthStyle, Paragraph, TextBox; -import 'package:flutter/foundation.dart' show isCanvasKit, kIsWeb; +import 'package:flutter/foundation.dart' show isSkiaWeb, kIsWeb; import 'package:flutter/gestures.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; @@ -206,7 +206,7 @@ void main() { expect(boxes[2], const TextBox.fromLTRBD(0.0, 10.0, 130.0, 20.0, TextDirection.ltr)); // 'fifth': expect(boxes[3], const TextBox.fromLTRBD(0.0, 20.0, 50.0, 30.0, TextDirection.ltr)); - }, skip: kIsWeb && !isCanvasKit); // https://github.com/flutter/flutter/issues/61016 + }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/61016 test('getBoxesForSelection test with boxHeightStyle and boxWidthStyle set to max', () { final RenderParagraph paragraph = RenderParagraph( diff --git a/packages/flutter/test/widgets/editable_text_cursor_test.dart b/packages/flutter/test/widgets/editable_text_cursor_test.dart index c4b34703e8d..08962fe8dfa 100644 --- a/packages/flutter/test/widgets/editable_text_cursor_test.dart +++ b/packages/flutter/test/widgets/editable_text_cursor_test.dart @@ -1264,7 +1264,7 @@ void main() { paints..rect(color: cursorColor, rect: caretRect), ); }, - skip: isBrowser && !isCanvasKit, // https://github.com/flutter/flutter/issues/56308 + skip: isBrowser && !isSkiaWeb, // https://github.com/flutter/flutter/issues/56308 ); testWidgets( diff --git a/packages/flutter/test/widgets/selectable_region_context_menu_test.dart b/packages/flutter/test/widgets/selectable_region_context_menu_test.dart index e4f29d6b005..0c87f13ea7e 100644 --- a/packages/flutter/test/widgets/selectable_region_context_menu_test.dart +++ b/packages/flutter/test/widgets/selectable_region_context_menu_test.dart @@ -14,15 +14,10 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:web/web.dart' as web; extension on web.HTMLCollection { - Iterable get iterable => _genIterable(this); + Iterable get iterable => Iterable.generate(length, (int index) => item(index)); } extension on web.CSSRuleList { - Iterable get iterable => _genIterable(this); -} - -Iterable _genIterable(dynamic jsCollection) { - // ignore: avoid_dynamic_calls - return Iterable.generate(jsCollection.length as int, (int index) => jsCollection.item(index) as T,); + Iterable get iterable => Iterable.generate(length, (int index) => item(index)); } void main() { @@ -46,13 +41,14 @@ void main() { expect(web.document.head!.children.iterable, isNotEmpty); bool foundStyle = false; - for (final web.Element element in web.document.head!.children.iterable) { - if (element.tagName != 'STYLE') { + for (final web.Element? element in web.document.head!.children.iterable) { + expect(element, isNotNull); + if (element!.tagName != 'STYLE') { continue; } final web.CSSRuleList? rules = (element as web.HTMLStyleElement).sheet?.rules; if (rules != null) { - foundStyle = rules.iterable.any((web.CSSRule rule) => rule.cssText.contains(className)); + foundStyle = rules.iterable.any((web.CSSRule? rule) => rule!.cssText.contains(className)); } if (foundStyle) { break; diff --git a/packages/flutter_goldens/lib/skia_client.dart b/packages/flutter_goldens/lib/skia_client.dart index 7b0bc9bf736..624665a83d2 100644 --- a/packages/flutter_goldens/lib/skia_client.dart +++ b/packages/flutter_goldens/lib/skia_client.dart @@ -387,7 +387,7 @@ class SkiaGoldClient { // differences are very small (typically not noticeable to human eye). List _getPixelMatchingArguments() { // Only use fuzzy pixel matching in the HTML renderer. - if (!_isBrowserTest || _isBrowserCanvasKitTest) { + if (!_isBrowserTest || _isBrowserSkiaTest) { return const []; } @@ -499,6 +499,7 @@ class SkiaGoldClient { /// image was rendered on, and for web tests, the browser the image was /// rendered on. String _getKeysJSON() { + final String? webRenderer = _webRendererValue; final Map keys = { 'Platform' : platform.operatingSystem, 'Abi': abi.toString(), @@ -509,8 +510,8 @@ class SkiaGoldClient { if (_isBrowserTest) { keys['Browser'] = _browserKey; keys['Platform'] = '${keys['Platform']}-browser'; - if (_isBrowserCanvasKitTest) { - keys['WebRenderer'] = 'canvaskit'; + if (webRenderer != null) { + keys['WebRenderer'] = webRenderer; } } return json.encode(keys); @@ -556,8 +557,15 @@ class SkiaGoldClient { return platform.environment[_kTestBrowserKey] != null; } - bool get _isBrowserCanvasKitTest { - return _isBrowserTest && platform.environment[_kWebRendererKey] == 'canvaskit'; + bool get _isBrowserSkiaTest { + return _isBrowserTest && switch (platform.environment[_kWebRendererKey]) { + 'canvaskit' || 'skwasm' => true, + _ => false, + }; + } + + String? get _webRendererValue { + return _isBrowserSkiaTest ? platform.environment[_kWebRendererKey] : null; } bool get _isImpeller { @@ -573,11 +581,12 @@ class SkiaGoldClient { /// the latest positive digest on Flutter Gold with a hex-encoded md5 hash of /// the image keys. String getTraceID(String testName) { + final String? webRenderer = _webRendererValue; final Map keys = { if (_isBrowserTest) 'Browser' : _browserKey, - if (_isBrowserCanvasKitTest) - 'WebRenderer' : 'canvaskit', + if (webRenderer != null) + 'WebRenderer' : webRenderer, 'CI' : 'luci', 'Platform' : platform.operatingSystem, 'Abi': abi.toString(), diff --git a/packages/flutter_test/lib/src/_matchers_web.dart b/packages/flutter_test/lib/src/_matchers_web.dart index bb40a8ebd0f..db368b6a12b 100644 --- a/packages/flutter_test/lib/src/_matchers_web.dart +++ b/packages/flutter_test/lib/src/_matchers_web.dart @@ -62,8 +62,8 @@ class MatchesGoldenFile extends AsyncMatcher { final ui.FlutterView view = binding.platformDispatcher.implicitView!; final RenderView renderView = binding.renderViews.firstWhere((RenderView r) => r.flutterView == view); - if (isCanvasKit) { - // In CanvasKit, use Layer.toImage to generate the screenshot. + if (isSkiaWeb) { + // In CanvasKit and Skwasm, use Layer.toImage to generate the screenshot. final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.instance; return binding.runAsync(() async { assert(element.renderObject != null); diff --git a/packages/flutter_test/lib/src/platform.dart b/packages/flutter_test/lib/src/platform.dart index 7731c9e22b8..fb963aebc7b 100644 --- a/packages/flutter_test/lib/src/platform.dart +++ b/packages/flutter_test/lib/src/platform.dart @@ -4,12 +4,12 @@ import 'dart:io'; -/// Whether the test is running in a web browser compiled to JavaScript. +/// Whether the test is running in a web browser compiled to JavaScript or WebAssembly. /// /// See also: /// /// * [kIsWeb], the equivalent constant in the `foundation` library. -const bool isBrowser = identical(0, 0.0); +const bool isBrowser = bool.fromEnvironment('dart.library.js_interop'); /// Whether the test is running on the Windows operating system. /// diff --git a/packages/flutter_tools/lib/src/test/flutter_web_goldens.dart b/packages/flutter_tools/lib/src/test/flutter_web_goldens.dart index ce7175569ca..049714c9efd 100644 --- a/packages/flutter_tools/lib/src/test/flutter_web_goldens.dart +++ b/packages/flutter_tools/lib/src/test/flutter_web_goldens.dart @@ -93,7 +93,7 @@ class TestGoldenComparator { final Map environment = { // Chrome is the only supported browser currently. 'FLUTTER_TEST_BROWSER': 'chrome', - 'FLUTTER_WEB_RENDERER': webRenderer == WebRendererMode.html ? 'html' : 'canvaskit', + 'FLUTTER_WEB_RENDERER': webRenderer.name, }; return _processManager.start(command, environment: environment); } diff --git a/packages/flutter_tools/lib/src/test/web_test_compiler.dart b/packages/flutter_tools/lib/src/test/web_test_compiler.dart index f8ac6d2d9bb..1d2a3bcbccc 100644 --- a/packages/flutter_tools/lib/src/test/web_test_compiler.dart +++ b/packages/flutter_tools/lib/src/test/web_test_compiler.dart @@ -238,15 +238,17 @@ class WebTestCompiler { '--extra-compiler-option=--multi-root-scheme=org-dartlang-app', '--extra-compiler-option=--multi-root=${projectDirectory.childDirectory('test').path}', '--extra-compiler-option=--multi-root=${outputDirectory.path}', + '--extra-compiler-option=--enable-asserts', + '--extra-compiler-option=--no-inlining', if (webRenderer == WebRendererMode.skwasm) ...[ '--extra-compiler-option=--import-shared-memory', '--extra-compiler-option=--shared-memory-max-pages=32768', - ], + ], ...buildInfo.extraFrontEndOptions, for (final String dartDefine in dartDefines) '-D$dartDefine', - '-O1', + '-O0', '-o', outputWasmFile.path, testFile.path, // dartfile @@ -257,8 +259,7 @@ class WebTestCompiler { processManager: _processManager, ); - await processUtils.run( - throwOnError: true, + await processUtils.stream( compilationArgs, );