From bb1c7a6ccbf8261cfaca8fc35a395734a4b99925 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Fri, 16 Feb 2024 17:18:33 -0800 Subject: [PATCH] [framework] Skip 5 failing framework tests. (#143618) Part of https://github.com/flutter/flutter/issues/143616 --- .../flutter/test/impeller_test_helpers.dart | 19 +++++++++++++++++++ .../test/widgets/default_colors_test.dart | 8 +++++--- .../test/widgets/snapshot_widget_test.dart | 4 +++- .../test/widgets/widget_inspector_test.dart | 11 ++++++----- 4 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 packages/flutter/test/impeller_test_helpers.dart diff --git a/packages/flutter/test/impeller_test_helpers.dart b/packages/flutter/test/impeller_test_helpers.dart new file mode 100644 index 000000000000..28e924cdd13b --- /dev/null +++ b/packages/flutter/test/impeller_test_helpers.dart @@ -0,0 +1,19 @@ +// 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:io' as io; +import 'package:flutter/foundation.dart'; + +/// Whether or not Flutter CI has configured Impeller for this test run. +/// +/// This is intended only to be used for a migration effort to enable Impeller +/// on Flutter CI. +/// +/// See also: https://github.com/flutter/flutter/issues/143616 +bool get impellerEnabled { + if (kIsWeb) { + return false; + } + return io.Platform.environment.containsKey('FLUTTER_TEST_IMPELLER'); +} diff --git a/packages/flutter/test/widgets/default_colors_test.dart b/packages/flutter/test/widgets/default_colors_test.dart index 1a410f572b3c..916fba0aa3b8 100644 --- a/packages/flutter/test/widgets/default_colors_test.dart +++ b/packages/flutter/test/widgets/default_colors_test.dart @@ -8,6 +8,8 @@ import 'dart:ui' as ui; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; +import '../impeller_test_helpers.dart'; + const double _crispText = 100.0; // this font size is selected to avoid needing any antialiasing. const String _expText = 'Éxp'; // renders in the test font as: @@ -38,7 +40,7 @@ void main() { const Offset(799, 599): const Color(0x00000000), // the background }, ); - }, skip: !canCaptureImage); // [intended] Test relies on captureImage, which is not supported on web currently. + }, skip: !canCaptureImage || impellerEnabled); // [intended] Test relies on captureImage, which is not supported on web currently. testWidgets('Default text color', (WidgetTester tester) async { await tester.pumpWidget(const ColoredBox( @@ -63,7 +65,7 @@ void main() { const Offset(799, 599): const Color(0xFFABCDEF), // the background }, ); - }, skip: !canCaptureImage); // [intended] Test relies on captureImage, which is not supported on web currently. + }, skip: !canCaptureImage || impellerEnabled); // [intended] Test relies on captureImage, which is not supported on web currently. testWidgets('Default text selection color', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); @@ -118,7 +120,7 @@ void main() { const Offset(799, 599): const Color(0xFFFFFFFF), // the background }, ); - }, skip: !canCaptureImage); // [intended] Test relies on captureImage, which is not supported on web currently. + }, skip: !canCaptureImage || impellerEnabled); // [intended] Test relies on captureImage, which is not supported on web currently. } Color _getPixel(ByteData bytes, int x, int y, int width) { diff --git a/packages/flutter/test/widgets/snapshot_widget_test.dart b/packages/flutter/test/widgets/snapshot_widget_test.dart index f2e35095d88c..704a34cffd90 100644 --- a/packages/flutter/test/widgets/snapshot_widget_test.dart +++ b/packages/flutter/test/widgets/snapshot_widget_test.dart @@ -15,6 +15,8 @@ import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; +import '../impeller_test_helpers.dart'; + void main() { testWidgets('SnapshotWidget can rasterize child', (WidgetTester tester) async { final SnapshotController controller = SnapshotController(allowSnapshotting: true); @@ -325,7 +327,7 @@ void main() { await expectLater(find.byKey(repaintBoundaryKey), matchesReferenceImage(imageWhenDisabled)); }, - skip: kIsWeb); // TODO(jonahwilliams): https://github.com/flutter/flutter/issues/106689 + skip: kIsWeb || impellerEnabled); // TODO(jonahwilliams): https://github.com/flutter/flutter/issues/106689 test('SnapshotPainter dispatches memory events', () async { await expectLater( diff --git a/packages/flutter/test/widgets/widget_inspector_test.dart b/packages/flutter/test/widgets/widget_inspector_test.dart index 8e5345419c9b..d6933efe1013 100644 --- a/packages/flutter/test/widgets/widget_inspector_test.dart +++ b/packages/flutter/test/widgets/widget_inspector_test.dart @@ -21,6 +21,7 @@ import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:leak_tracker/leak_tracker.dart'; +import '../impeller_test_helpers.dart'; import 'widget_inspector_test_utils.dart'; // Start of block of code where widget creation location line numbers and @@ -3869,7 +3870,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { _CreationLocation location = knownLocations[id]!; expect(location.file, equals(file)); // ClockText widget. - expect(location.line, equals(56)); + expect(location.line, equals(57)); expect(location.column, equals(9)); expect(location.name, equals('ClockText')); expect(count, equals(1)); @@ -3879,7 +3880,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { location = knownLocations[id]!; expect(location.file, equals(file)); // Text widget in _ClockTextState build method. - expect(location.line, equals(94)); + expect(location.line, equals(95)); expect(location.column, equals(12)); expect(location.name, equals('Text')); expect(count, equals(1)); @@ -3906,7 +3907,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { location = knownLocations[id]!; expect(location.file, equals(file)); // ClockText widget. - expect(location.line, equals(56)); + expect(location.line, equals(57)); expect(location.column, equals(9)); expect(location.name, equals('ClockText')); expect(count, equals(3)); // 3 clock widget instances rebuilt. @@ -3916,7 +3917,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { location = knownLocations[id]!; expect(location.file, equals(file)); // Text widget in _ClockTextState build method. - expect(location.line, equals(94)); + expect(location.line, equals(95)); expect(location.column, equals(12)); expect(location.name, equals('Text')); expect(count, equals(3)); // 3 clock widget instances rebuilt. @@ -4551,7 +4552,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { screenshot12, matchesGoldenFile('inspector.sizedBox_debugPaint_margin.png'), ); - }); + }, skip: impellerEnabled); // TODO(jonahwilliams): https://github.com/flutter/flutter/issues/143616 group('layout explorer', () { const String group = 'test-group';