diff --git a/dev/bots/test.dart b/dev/bots/test.dart index 3144cd2668..b9fb83498c 100644 --- a/dev/bots/test.dart +++ b/dev/bots/test.dart @@ -1162,11 +1162,6 @@ Future _runWebLongRunningTests() async { ), ], - // This test specifically tests how images are loaded in HTML mode, so we don't run it in CanvasKit mode. - () => _runWebE2eTest('image_loading_integration', buildMode: 'debug', renderer: 'html'), - () => _runWebE2eTest('image_loading_integration', buildMode: 'profile', renderer: 'html'), - () => _runWebE2eTest('image_loading_integration', buildMode: 'release', renderer: 'html'), - // This test doesn't do anything interesting w.r.t. rendering, so we don't run the full build mode x renderer matrix. () => _runWebE2eTest('platform_messages_integration', buildMode: 'debug', renderer: 'canvaskit'), () => _runWebE2eTest('platform_messages_integration', buildMode: 'profile', renderer: 'html'), diff --git a/dev/integration_tests/web_e2e_tests/lib/image_loading_main.dart b/dev/integration_tests/web_e2e_tests/lib/image_loading_main.dart deleted file mode 100644 index 3e515e855d..0000000000 --- a/dev/integration_tests/web_e2e_tests/lib/image_loading_main.dart +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2014 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; - -final Completer _assetImageCompleter = Completer(); -final Completer _networkImageCompleter = Completer(); - -/// Notifies that Image.asset used in the test app loaded the image. -@visibleForTesting -Future get whenAssetImageLoads => _assetImageCompleter.future; - -/// Notifies that Image.network used in the test app loaded the image. -@visibleForTesting -Future get whenNetworkImageLoads => _networkImageCompleter.future; - -Future main() async { - WidgetsFlutterBinding.ensureInitialized(); - const MethodChannel channel = - OptionalMethodChannel('flutter/web_test_e2e', JSONMethodCodec()); - - // Artificially override the device pixel ratio to force the framework to pick the 1.5x asset variants. - await channel.invokeMethod('setDevicePixelRatio', '1.5'); - runApp(const MyApp()); -} - -class MyApp extends StatefulWidget { - const MyApp({super.key}); - - @override - MyAppState createState() => MyAppState(); -} - -class MyAppState extends State { - @override - Widget build(BuildContext context) { - return MaterialApp( - key: const Key('mainapp'), - title: 'Integration Test App', - home: Column(children: [ - const Text('Asset image:'), - RepaintBoundary(child: Image.asset( - 'assets/icons/material/material.png', - package: 'flutter_gallery_assets', - frameBuilder: ( - BuildContext context, - Widget child, - int? frame, - bool wasSynchronouslyLoaded, - ) { - if (frame != null) { - _assetImageCompleter.complete(); - } - return child; - }, - )), - const Text('Network image:'), - RepaintBoundary(child: Image.network( - 'assets/packages/flutter_gallery_assets/assets/icons/material/material.png', - frameBuilder: ( - BuildContext context, - Widget child, - int? frame, - bool wasSynchronouslyLoaded, - ) { - if (frame != null) { - _networkImageCompleter.complete(); - } - return child; - }, - )), - ]) - ); - } -} diff --git a/dev/integration_tests/web_e2e_tests/test_driver/image_loading_integration.dart b/dev/integration_tests/web_e2e_tests/test_driver/image_loading_integration.dart deleted file mode 100644 index d81d18c75c..0000000000 --- a/dev/integration_tests/web_e2e_tests/test_driver/image_loading_integration.dart +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'dart:html' as html; -import 'package:flutter_test/flutter_test.dart'; -import 'package:integration_test/integration_test.dart'; -import 'package:web_e2e_tests/common.dart'; -import 'package:web_e2e_tests/image_loading_main.dart' as app; - -void main() { - IntegrationTestWidgetsFlutterBinding.ensureInitialized(); - - testWidgets('Image loads asset variant based on device pixel ratio', - (WidgetTester tester) async { - await app.main(); - await tester.pumpAndSettle(); - - // `pumpAndSettle` only waits until no more frames are scheduled, but the - // test must wait for the image network requests to finish. - await app.whenAssetImageLoads; - await app.whenNetworkImageLoads; - - // At the time the network requests are finished the engine may not have - // updated the DOM yet. Delay checking the DOM until the next event, which - // will guarantee that the current frame is done rendering. - await Future.delayed(Duration.zero); - - final List imageElements = findElements('img').cast(); - expect(imageElements.length, 2); - expect(imageElements[0].naturalWidth, 1.5 * 64); - expect(imageElements[0].naturalHeight, 1.5 * 64); - expect(imageElements[0].width, 64); - expect(imageElements[0].height, 64); - expect(imageElements[1].width, isNot(0)); - }); -} diff --git a/dev/integration_tests/web_e2e_tests/test_driver/image_loading_integration_test.dart b/dev/integration_tests/web_e2e_tests/test_driver/image_loading_integration_test.dart deleted file mode 100644 index b2d2a1770b..0000000000 --- a/dev/integration_tests/web_e2e_tests/test_driver/image_loading_integration_test.dart +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2014 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:integration_test/integration_test_driver.dart' as test; - -Future main() async => test.integrationDriver();