From f3c25fa07aeb840c8264a43908ffe4825ce33776 Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Tue, 16 Mar 2021 13:58:02 -0700 Subject: [PATCH] Align more closely with package:test (#77118) (#78343) --- dev/bots/analyze.dart | 76 ------------------- dev/bots/test/common.dart | 10 +-- dev/customer_testing/test/common.dart | 10 +-- dev/devicelab/test/common.dart | 10 +-- .../lib/src/common.dart | 1 + .../lib/src/flutter_test_alternative.dart | 14 ---- .../lib/src/matcher.dart | 3 +- .../test_driver/main_test.dart | 5 +- dev/tools/test/common.dart | 16 ++-- .../test/flutter_test_alternative.dart | 19 ----- .../test/foundation/assertions_test.dart | 2 +- .../test/foundation/bit_field_test.dart | 2 +- .../foundation/caching_iterable_test.dart | 3 +- .../foundation/consolidate_response_test.dart | 5 +- .../test/foundation/constants_test.dart | 2 +- .../foundation/double_precision_test.dart | 2 +- .../test/foundation/error_reporting_test.dart | 3 +- .../test/foundation/isolates_test.dart | 3 +- .../test/foundation/licenses_test.dart | 2 +- .../flutter/test/foundation/print_test.dart | 2 +- .../test/foundation/reassemble_test.dart | 2 +- .../test/foundation/serialization_test.dart | 2 +- .../foundation/service_extensions_test.dart | 2 +- .../test/foundation/stack_frame_test.dart | 2 +- .../test/foundation/stack_trace_test.dart | 3 +- .../foundation/synchronous_future_test.dart | 2 +- .../flutter/test/gestures/arena_test.dart | 3 +- .../test/gestures/double_tap_test.dart | 4 +- .../gesture_binding_resample_event_test.dart | 3 +- .../test/gestures/gesture_binding_test.dart | 3 +- .../flutter/test/gestures/gesture_tester.dart | 5 +- .../flutter/test/gestures/hit_test_test.dart | 3 +- .../flutter/test/gestures/locking_test.dart | 3 +- .../test/gestures/long_press_test.dart | 2 +- .../test/gestures/lsq_solver_test.dart | 3 +- .../pointer_signal_resolver_test.dart | 3 +- .../flutter/test/gestures/resampler_test.dart | 3 +- .../flutter/test/harness/trivial_test.dart | 2 +- .../flutter/test/material/colors_test.dart | 3 +- .../flutter/test/painting/box_fit_test.dart | 3 +- .../test/painting/decoration_test.dart | 2 +- .../flutter/test/painting/geometry_test.dart | 2 +- .../painting/image_cache_resize_test.dart | 2 +- .../test/painting/image_cache_test.dart | 2 +- .../test/painting/image_decoder_test.dart | 2 +- .../test/painting/strut_style_test.dart | 2 +- .../test/painting/text_style_test.dart | 4 +- .../flutter/test/physics/near_equal_test.dart | 3 +- .../test/rendering/annotated_region_test.dart | 2 +- .../flutter/test/rendering/baseline_test.dart | 2 +- .../rendering/cached_intrinsics_test.dart | 2 +- .../test/rendering/constraints_test.dart | 2 +- .../flutter/test/rendering/debug_test.dart | 2 +- .../rendering/dynamic_intrinsics_test.dart | 2 +- .../test/rendering/first_frame_test.dart | 3 +- .../rendering/independent_layout_test.dart | 2 +- .../test/rendering/intrinsic_width_test.dart | 2 +- .../rendering/mouse_tracker_cursor_test.dart | 2 +- .../test/rendering/mouse_tracker_test.dart | 2 +- .../test/rendering/mutations_test.dart | 2 +- .../non_render_object_root_test.dart | 2 +- .../flutter/test/rendering/offstage_test.dart | 2 +- .../flutter/test/rendering/overflow_test.dart | 2 +- .../rendering/paragraph_intrinsics_test.dart | 2 +- .../test/rendering/positioned_box_test.dart | 2 +- .../test/rendering/proxy_box_test.dart | 2 +- .../proxy_getters_and_setters_test.dart | 2 +- .../test/rendering/proxy_sliver_test.dart | 2 +- .../flutter/test/rendering/reattach_test.dart | 2 +- .../test/rendering/relative_rect_test.dart | 2 +- .../test/rendering/repaint_boundary_test.dart | 2 +- .../semantics_and_children_test.dart | 3 +- .../test/rendering/simple_semantics_test.dart | 2 +- .../flutter/test/rendering/size_test.dart | 2 +- .../test/rendering/sliver_cache_test.dart | 2 +- .../sliver_fixed_extent_layout_test.dart | 2 +- .../sliver_persistent_header_test.dart | 2 +- .../test/rendering/slivers_block_test.dart | 3 +- .../test/rendering/slivers_layout_test.dart | 2 +- .../flutter/test/rendering/stack_test.dart | 2 +- .../test/rendering/transform_test.dart | 2 +- .../test/scheduler/animation_test.dart | 3 +- .../flutter/test/scheduler/priority_test.dart | 3 +- .../test/scheduler/scheduler_test.dart | 2 +- .../custom_semantics_action_test.dart | 3 +- .../semantics/semantics_service_test.dart | 4 +- .../test/services/message_codecs_test.dart | 3 +- .../test/services/message_codecs_testing.dart | 2 +- .../test/services/message_codecs_vm_test.dart | 3 +- .../test/services/platform_channel_test.dart | 4 +- .../test/services/platform_views_test.dart | 3 +- .../test/services/text_input_test.dart | 3 +- packages/flutter/test_private/README.md | 1 - .../animated_icons_private_test.dart.tmpl | 3 +- .../test/animated_icons_private_test.json | 6 +- packages/flutter_driver/test/common.dart | 10 +-- .../flutter_test/lib/src/_matchers_io.dart | 3 +- .../flutter_test/lib/src/_matchers_web.dart | 3 +- packages/flutter_test/lib/src/matchers.dart | 14 ++-- .../flutter_test/lib/src/widget_tester.dart | 27 +++++-- .../generate_localizations_test.dart | 5 +- packages/flutter_tools/test/src/common.dart | 40 +++++----- .../flutter_tools/test/src/test_wrapper.dart | 10 +-- .../test/common.dart | 10 +-- .../example/test_driver/failure_test.dart | 2 +- 105 files changed, 173 insertions(+), 328 deletions(-) delete mode 100644 dev/integration_tests/android_semantics_testing/lib/src/flutter_test_alternative.dart delete mode 100644 packages/flutter/test/flutter_test_alternative.dart diff --git a/dev/bots/analyze.dart b/dev/bots/analyze.dart index aeef8fc15c..4c9f5873af 100644 --- a/dev/bots/analyze.dart +++ b/dev/bots/analyze.dart @@ -61,9 +61,6 @@ Future run(List arguments) async { print('$clock Test imports...'); await verifyNoTestImports(flutterRoot); - print('$clock Test package imports...'); - await verifyNoTestPackageImports(flutterRoot); - print('$clock Bad imports (framework)...'); await verifyNoBadImportsInFlutter(flutterRoot); @@ -299,79 +296,6 @@ Future verifyNoTestImports(String workingDirectory) async { } } -Future verifyNoTestPackageImports(String workingDirectory) async { - // TODO(ianh): Remove this whole test once https://github.com/dart-lang/matcher/issues/98 is fixed. - final List shims = []; - final List errors = (await _allFiles(workingDirectory, 'dart', minimumMatches: 2000).toList()) - .map((File file) { - final String name = Uri.file(path.relative(file.path, - from: workingDirectory)).toFilePath(windows: false); - if (name.startsWith('bin/cache') || - name == 'dev/bots/test.dart' || - name.startsWith('.pub-cache')) - return null; - final String data = file.readAsStringSync(); - if (data.contains("import 'package:test/test.dart'")) { - if (data.contains("// Defines a 'package:test' shim.")) { - shims.add(' $name'); - if (!data.contains('https://github.com/dart-lang/matcher/issues/98')) - return ' $name: Shims must link to the isInstanceOf issue.'; - if (data.contains("import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;") && - data.contains("export 'package:test/test.dart' hide TypeMatcher, isInstanceOf;")) - return null; - return ' $name: Shim seems to be missing the expected import/export lines.'; - } - final int count = 'package:test'.allMatches(data).length; - if (path.split(file.path).contains('test_driver') || - name.startsWith('dev/missing_dependency_tests/') || - name.startsWith('dev/automated_tests/') || - name.startsWith('dev/snippets/') || - name.startsWith('packages/flutter/test/engine/') || - name.startsWith('examples/layers/test/smoketests/raw/') || - name.startsWith('examples/layers/test/smoketests/rendering/') || - name.startsWith('dev/integration_tests/flutter_gallery/test/calculator')) { - // We only exempt driver tests, some of our special trivial tests. - // Driver tests aren't typically expected to use TypeMatcher and company. - // The trivial tests don't typically do anything at all and it would be - // a pain to have to give them a shim. - if (!data.contains("import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;")) - return ' $name: test does not hide TypeMatcher and isInstanceOf from package:test; consider using a shim instead.'; - assert(count > 0); - if (count == 1) - return null; - return " $name: uses 'package:test' $count times."; - } - if (name.startsWith('packages/flutter_test/')) { - // flutter_test has deep ties to package:test - return null; - } - if (data.contains("import 'package:test/test.dart' as test_package;") || - data.contains("import 'package:test/test.dart' as test_package show ")) { - if (count == 1) - return null; - } - return " $name: uses 'package:test' directly"; - } - return null; - }) - .where((String line) => line != null) - .toList() - ..sort(); - - // Fail if any errors - if (errors.isNotEmpty) { - final String s1 = errors.length == 1 ? 's' : ''; - final String s2 = errors.length == 1 ? '' : 's'; - exitWithError([ - "${bold}The following file$s2 use$s1 'package:test' incorrectly:$reset", - ...errors, - "Rather than depending on 'package:test' directly, use one of the shims:", - ...shims, - "This insulates us from breaking changes in 'package:test'." - ]); - } -} - Future verifyNoBadImportsInFlutter(String workingDirectory) async { final List errors = []; final String libPath = path.join(workingDirectory, 'packages', 'flutter', 'lib'); diff --git a/dev/bots/test/common.dart b/dev/bots/test/common.dart index 6ca543fdc0..86a3628f09 100644 --- a/dev/bots/test/common.dart +++ b/dev/bots/test/common.dart @@ -4,16 +4,12 @@ import 'dart:io'; -import 'package:test/test.dart' hide TypeMatcher, isInstanceOf; -import 'package:test/test.dart' as test_package show TypeMatcher; +import 'package:test/test.dart'; -export 'package:test/test.dart' hide TypeMatcher, isInstanceOf; - -// Defines a 'package:test' shim. -// TODO(ianh): Remove this file once https://github.com/dart-lang/matcher/issues/98 is fixed +export 'package:test/test.dart' hide isInstanceOf; /// A matcher that compares the type of the actual value to the type argument T. -test_package.TypeMatcher isInstanceOf() => isA(); +TypeMatcher isInstanceOf() => isA(); void tryToDelete(Directory directory) { // This should not be necessary, but it turns out that diff --git a/dev/customer_testing/test/common.dart b/dev/customer_testing/test/common.dart index 64db237395..cd6fd458da 100644 --- a/dev/customer_testing/test/common.dart +++ b/dev/customer_testing/test/common.dart @@ -2,13 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:test/test.dart' hide TypeMatcher, isInstanceOf; -import 'package:test/test.dart' as test_package show TypeMatcher; +import 'package:test/test.dart' hide isInstanceOf; -export 'package:test/test.dart' hide TypeMatcher, isInstanceOf; - -// Defines a 'package:test' shim. -// TODO(ianh): Remove this file once https://github.com/dart-lang/matcher/issues/98 is fixed +export 'package:test/test.dart' hide isInstanceOf; /// A matcher that compares the type of the actual value to the type argument T. -test_package.TypeMatcher isInstanceOf() => isA(); +TypeMatcher isInstanceOf() => isA(); diff --git a/dev/devicelab/test/common.dart b/dev/devicelab/test/common.dart index 64db237395..e60806e72e 100644 --- a/dev/devicelab/test/common.dart +++ b/dev/devicelab/test/common.dart @@ -2,13 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:test/test.dart' hide TypeMatcher, isInstanceOf; -import 'package:test/test.dart' as test_package show TypeMatcher; +import 'package:test/test.dart'; -export 'package:test/test.dart' hide TypeMatcher, isInstanceOf; - -// Defines a 'package:test' shim. -// TODO(ianh): Remove this file once https://github.com/dart-lang/matcher/issues/98 is fixed +export 'package:test/test.dart' hide isInstanceOf; /// A matcher that compares the type of the actual value to the type argument T. -test_package.TypeMatcher isInstanceOf() => isA(); +TypeMatcher isInstanceOf() => isA(); diff --git a/dev/integration_tests/android_semantics_testing/lib/src/common.dart b/dev/integration_tests/android_semantics_testing/lib/src/common.dart index 79cf2f47ef..8879850835 100644 --- a/dev/integration_tests/android_semantics_testing/lib/src/common.dart +++ b/dev/integration_tests/android_semantics_testing/lib/src/common.dart @@ -5,6 +5,7 @@ import 'dart:convert'; import 'package:meta/meta.dart'; + import 'constants.dart'; /// A semantics node created from Android accessibility information. diff --git a/dev/integration_tests/android_semantics_testing/lib/src/flutter_test_alternative.dart b/dev/integration_tests/android_semantics_testing/lib/src/flutter_test_alternative.dart deleted file mode 100644 index 1865b6f384..0000000000 --- a/dev/integration_tests/android_semantics_testing/lib/src/flutter_test_alternative.dart +++ /dev/null @@ -1,14 +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. - -// Defines a 'package:test' shim. -// TODO(ianh): Remove this file once https://github.com/dart-lang/matcher/issues/98 is fixed - -import 'package:test/test.dart' hide TypeMatcher, isInstanceOf; -import 'package:test/test.dart' as test_package show TypeMatcher; - -export 'package:test/test.dart' hide TypeMatcher, isInstanceOf; - -/// A matcher that compares the type of the actual value to the type argument T. -test_package.TypeMatcher isInstanceOf() => isA(); diff --git a/dev/integration_tests/android_semantics_testing/lib/src/matcher.dart b/dev/integration_tests/android_semantics_testing/lib/src/matcher.dart index 614b23d507..d3f7f27555 100644 --- a/dev/integration_tests/android_semantics_testing/lib/src/matcher.dart +++ b/dev/integration_tests/android_semantics_testing/lib/src/matcher.dart @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'package:test/test.dart' hide isInstanceOf; + import 'common.dart'; import 'constants.dart'; -import 'flutter_test_alternative.dart'; /// Matches an [AndroidSemanticsNode]. /// diff --git a/dev/integration_tests/android_semantics_testing/test_driver/main_test.dart b/dev/integration_tests/android_semantics_testing/test_driver/main_test.dart index 167b3686f6..4183691634 100644 --- a/dev/integration_tests/android_semantics_testing/test_driver/main_test.dart +++ b/dev/integration_tests/android_semantics_testing/test_driver/main_test.dart @@ -4,12 +4,11 @@ import 'dart:io' as io; -import 'package:android_semantics_testing/test_constants.dart'; import 'package:android_semantics_testing/android_semantics_testing.dart'; - -import 'package:test/test.dart' hide TypeMatcher, isInstanceOf; +import 'package:android_semantics_testing/test_constants.dart'; import 'package:flutter_driver/flutter_driver.dart'; import 'package:path/path.dart' as path; +import 'package:test/test.dart' hide isInstanceOf; String adbPath() { final String androidHome = io.Platform.environment['ANDROID_HOME'] ?? io.Platform.environment['ANDROID_SDK_ROOT']; diff --git a/dev/tools/test/common.dart b/dev/tools/test/common.dart index 7ebcc09911..ce2398ec95 100644 --- a/dev/tools/test/common.dart +++ b/dev/tools/test/common.dart @@ -4,21 +4,15 @@ import 'dart:io'; -import 'package:file/file.dart'; -import 'package:test/test.dart' hide TypeMatcher, isInstanceOf; -import 'package:test/test.dart' as test_package show TypeMatcher; - -import 'package:dev_tools/stdio.dart'; - import 'package:args/args.dart'; +import 'package:dev_tools/stdio.dart'; +import 'package:file/file.dart'; +import 'package:test/test.dart'; -export 'package:test/test.dart' hide TypeMatcher, isInstanceOf; - -// Defines a 'package:test' shim. -// TODO(ianh): Remove this file once https://github.com/dart-lang/matcher/issues/98 is fixed +export 'package:test/test.dart' hide isInstanceOf; /// A matcher that compares the type of the actual value to the type argument T. -test_package.TypeMatcher isInstanceOf() => isA(); +TypeMatcher isInstanceOf() => isA(); void tryToDelete(Directory directory) { // This should not be necessary, but it turns out that diff --git a/packages/flutter/test/flutter_test_alternative.dart b/packages/flutter/test/flutter_test_alternative.dart deleted file mode 100644 index 549794c640..0000000000 --- a/packages/flutter/test/flutter_test_alternative.dart +++ /dev/null @@ -1,19 +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. - -// Defines a 'package:test' shim. -// TODO(ianh): Remove this file once https://github.com/dart-lang/matcher/issues/98 is fixed - -import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf; // ignore: deprecated_member_use -import 'package:test_api/test_api.dart' as test_package show TypeMatcher; // ignore: deprecated_member_use - -export 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf; // ignore: deprecated_member_use -export 'package:test_api/fake.dart'; // ignore: deprecated_member_use -export 'package:flutter_test/flutter_test.dart' show createTestImage; - -/// A matcher that compares the type of the actual value to the type argument T. -test_package.TypeMatcher isInstanceOf() => isA(); - -/// Whether we are running in a web browser. -const bool isBrowser = identical(0, 0.0); diff --git a/packages/flutter/test/foundation/assertions_test.dart b/packages/flutter/test/foundation/assertions_test.dart index fba7a72509..e5f9b9ab25 100644 --- a/packages/flutter/test/foundation/assertions_test.dart +++ b/packages/flutter/test/foundation/assertions_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/foundation.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'capture_output.dart'; diff --git a/packages/flutter/test/foundation/bit_field_test.dart b/packages/flutter/test/foundation/bit_field_test.dart index 7048fac195..d03a996922 100644 --- a/packages/flutter/test/foundation/bit_field_test.dart +++ b/packages/flutter/test/foundation/bit_field_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/foundation.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; // ignore: unused_field enum _TestEnum { a, b, c, d, e, f, g, h } diff --git a/packages/flutter/test/foundation/caching_iterable_test.dart b/packages/flutter/test/foundation/caching_iterable_test.dart index 0b496d3129..8c2ff147cf 100644 --- a/packages/flutter/test/foundation/caching_iterable_test.dart +++ b/packages/flutter/test/foundation/caching_iterable_test.dart @@ -3,8 +3,7 @@ // found in the LICENSE file. import 'package:flutter/foundation.dart'; - -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; int yieldCount = 0; diff --git a/packages/flutter/test/foundation/consolidate_response_test.dart b/packages/flutter/test/foundation/consolidate_response_test.dart index 43d6ec5d8d..f9a3a78633 100644 --- a/packages/flutter/test/foundation/consolidate_response_test.dart +++ b/packages/flutter/test/foundation/consolidate_response_test.dart @@ -3,16 +3,17 @@ // found in the LICENSE file. @TestOn('!chrome') + import 'dart:async'; import 'dart:io'; import 'dart:typed_data'; import 'package:flutter/foundation.dart'; - -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; final Uint8List chunkOne = Uint8List.fromList([0, 1, 2, 3, 4, 5]); final Uint8List chunkTwo = Uint8List.fromList([6, 7, 8, 9, 10]); + void main() { group(consolidateHttpClientResponseBytes, () { late MockHttpClientResponse response; diff --git a/packages/flutter/test/foundation/constants_test.dart b/packages/flutter/test/foundation/constants_test.dart index 0fe96e1c2b..66015842f1 100644 --- a/packages/flutter/test/foundation/constants_test.dart +++ b/packages/flutter/test/foundation/constants_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/foundation.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { test('isWeb is false for flutter tester', () { diff --git a/packages/flutter/test/foundation/double_precision_test.dart b/packages/flutter/test/foundation/double_precision_test.dart index 24f348a1a0..182240bddc 100644 --- a/packages/flutter/test/foundation/double_precision_test.dart +++ b/packages/flutter/test/foundation/double_precision_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/foundation.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { test('debugFormatDouble formats doubles', () { diff --git a/packages/flutter/test/foundation/error_reporting_test.dart b/packages/flutter/test/foundation/error_reporting_test.dart index a72055aa04..a66f918ec9 100644 --- a/packages/flutter/test/foundation/error_reporting_test.dart +++ b/packages/flutter/test/foundation/error_reporting_test.dart @@ -3,8 +3,9 @@ // found in the LICENSE file. @TestOn('!chrome') + import 'package:flutter/foundation.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; Object getAssertionErrorWithMessage() { try { diff --git a/packages/flutter/test/foundation/isolates_test.dart b/packages/flutter/test/foundation/isolates_test.dart index 54fda42df6..b888c93757 100644 --- a/packages/flutter/test/foundation/isolates_test.dart +++ b/packages/flutter/test/foundation/isolates_test.dart @@ -3,8 +3,7 @@ // found in the LICENSE file. import 'package:flutter/foundation.dart'; - -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; int test1(int value) { return value + 1; diff --git a/packages/flutter/test/foundation/licenses_test.dart b/packages/flutter/test/foundation/licenses_test.dart index 62262385b0..da056a8eea 100644 --- a/packages/flutter/test/foundation/licenses_test.dart +++ b/packages/flutter/test/foundation/licenses_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/foundation.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { test('LicenseEntryWithLineBreaks - most cases', () { diff --git a/packages/flutter/test/foundation/print_test.dart b/packages/flutter/test/foundation/print_test.dart index 0c1b679cbe..11bf2c77f3 100644 --- a/packages/flutter/test/foundation/print_test.dart +++ b/packages/flutter/test/foundation/print_test.dart @@ -4,7 +4,7 @@ import 'package:flutter/foundation.dart'; import 'package:fake_async/fake_async.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'capture_output.dart'; diff --git a/packages/flutter/test/foundation/reassemble_test.dart b/packages/flutter/test/foundation/reassemble_test.dart index e80ff6cf24..c79f4a3ef3 100644 --- a/packages/flutter/test/foundation/reassemble_test.dart +++ b/packages/flutter/test/foundation/reassemble_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/foundation.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; class TestFoundationFlutterBinding extends BindingBase { bool? wasLocked; diff --git a/packages/flutter/test/foundation/serialization_test.dart b/packages/flutter/test/foundation/serialization_test.dart index 3135b85eba..c51cd5db78 100644 --- a/packages/flutter/test/foundation/serialization_test.dart +++ b/packages/flutter/test/foundation/serialization_test.dart @@ -5,7 +5,7 @@ import 'dart:typed_data'; import 'package:flutter/foundation.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { group('Write and read buffer round-trip', () { diff --git a/packages/flutter/test/foundation/service_extensions_test.dart b/packages/flutter/test/foundation/service_extensions_test.dart index 12262ac580..563a6d4131 100644 --- a/packages/flutter/test/foundation/service_extensions_test.dart +++ b/packages/flutter/test/foundation/service_extensions_test.dart @@ -12,7 +12,7 @@ import 'package:flutter/rendering.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; class TestServiceExtensionsBinding extends BindingBase with SchedulerBinding, diff --git a/packages/flutter/test/foundation/stack_frame_test.dart b/packages/flutter/test/foundation/stack_frame_test.dart index be855e136a..8435f5e919 100644 --- a/packages/flutter/test/foundation/stack_frame_test.dart +++ b/packages/flutter/test/foundation/stack_frame_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/foundation.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { test('Parses line', () { diff --git a/packages/flutter/test/foundation/stack_trace_test.dart b/packages/flutter/test/foundation/stack_trace_test.dart index 80d765f4f0..d61042d8e3 100644 --- a/packages/flutter/test/foundation/stack_trace_test.dart +++ b/packages/flutter/test/foundation/stack_trace_test.dart @@ -3,8 +3,9 @@ // found in the LICENSE file. @TestOn('!chrome') + import 'package:flutter/foundation.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { // TODO(ianh): These tests and the filtering mechanism should be revisited to diff --git a/packages/flutter/test/foundation/synchronous_future_test.dart b/packages/flutter/test/foundation/synchronous_future_test.dart index d38448d22c..676129fa5c 100644 --- a/packages/flutter/test/foundation/synchronous_future_test.dart +++ b/packages/flutter/test/foundation/synchronous_future_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/foundation.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { test('SynchronousFuture control test', () async { diff --git a/packages/flutter/test/gestures/arena_test.dart b/packages/flutter/test/gestures/arena_test.dart index 926ac1f676..9250e1506f 100644 --- a/packages/flutter/test/gestures/arena_test.dart +++ b/packages/flutter/test/gestures/arena_test.dart @@ -3,8 +3,7 @@ // found in the LICENSE file. import 'package:flutter/gestures.dart'; - -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; typedef GestureArenaCallback = void Function(Object key); diff --git a/packages/flutter/test/gestures/double_tap_test.dart b/packages/flutter/test/gestures/double_tap_test.dart index a3e5d8e9c3..4da59cc3b0 100644 --- a/packages/flutter/test/gestures/double_tap_test.dart +++ b/packages/flutter/test/gestures/double_tap_test.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter/gestures.dart'; import 'package:fake_async/fake_async.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter_test/flutter_test.dart'; -import '../flutter_test_alternative.dart'; import 'gesture_tester.dart'; class TestGestureArenaMember extends GestureArenaMember { diff --git a/packages/flutter/test/gestures/gesture_binding_resample_event_test.dart b/packages/flutter/test/gestures/gesture_binding_resample_event_test.dart index 492af5fca1..a2ec06f878 100644 --- a/packages/flutter/test/gestures/gesture_binding_resample_event_test.dart +++ b/packages/flutter/test/gestures/gesture_binding_resample_event_test.dart @@ -9,8 +9,7 @@ import 'package:fake_async/fake_async.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/scheduler.dart'; - -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; typedef HandleEventCallback = void Function(PointerEvent event); diff --git a/packages/flutter/test/gestures/gesture_binding_test.dart b/packages/flutter/test/gestures/gesture_binding_test.dart index 9a446f12f2..c7330d493b 100644 --- a/packages/flutter/test/gestures/gesture_binding_test.dart +++ b/packages/flutter/test/gestures/gesture_binding_test.dart @@ -7,8 +7,7 @@ import 'dart:ui' as ui; import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/scheduler.dart'; - -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; typedef HandleEventCallback = void Function(PointerEvent event); diff --git a/packages/flutter/test/gestures/gesture_tester.dart b/packages/flutter/test/gestures/gesture_tester.dart index 5380df4357..dcbba99ea6 100644 --- a/packages/flutter/test/gestures/gesture_tester.dart +++ b/packages/flutter/test/gestures/gesture_tester.dart @@ -2,12 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'package:fake_async/fake_async.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'package:meta/meta.dart'; -import 'package:fake_async/fake_async.dart'; - -import '../flutter_test_alternative.dart'; class TestGestureFlutterBinding extends BindingBase with GestureBinding { } diff --git a/packages/flutter/test/gestures/hit_test_test.dart b/packages/flutter/test/gestures/hit_test_test.dart index 18afae5841..6607201129 100644 --- a/packages/flutter/test/gestures/hit_test_test.dart +++ b/packages/flutter/test/gestures/hit_test_test.dart @@ -3,10 +3,9 @@ // found in the LICENSE file. import 'package:flutter/gestures.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'package:vector_math/vector_math_64.dart'; -import '../flutter_test_alternative.dart'; - void main() { test('wrapped HitTestResult gets HitTestEntry added to wrapping HitTestResult', () async { final HitTestEntry entry1 = HitTestEntry(_DummyHitTestTarget()); diff --git a/packages/flutter/test/gestures/locking_test.dart b/packages/flutter/test/gestures/locking_test.dart index 07212814cc..b421c55d30 100644 --- a/packages/flutter/test/gestures/locking_test.dart +++ b/packages/flutter/test/gestures/locking_test.dart @@ -6,8 +6,7 @@ import 'dart:ui' as ui; import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; - -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; typedef HandleEventCallback = void Function(PointerEvent event); diff --git a/packages/flutter/test/gestures/long_press_test.dart b/packages/flutter/test/gestures/long_press_test.dart index abcfcb1b6f..943c57adc8 100644 --- a/packages/flutter/test/gestures/long_press_test.dart +++ b/packages/flutter/test/gestures/long_press_test.dart @@ -3,8 +3,8 @@ // found in the LICENSE file. import 'package:flutter/gestures.dart'; +import 'package:flutter_test/flutter_test.dart'; -import '../flutter_test_alternative.dart'; import 'gesture_tester.dart'; // Down/move/up pair 1: normal tap sequence diff --git a/packages/flutter/test/gestures/lsq_solver_test.dart b/packages/flutter/test/gestures/lsq_solver_test.dart index e13eab215d..0254f4ff80 100644 --- a/packages/flutter/test/gestures/lsq_solver_test.dart +++ b/packages/flutter/test/gestures/lsq_solver_test.dart @@ -3,8 +3,7 @@ // found in the LICENSE file. import 'package:flutter/gestures.dart'; - -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { bool approx(double value, double expectation) { diff --git a/packages/flutter/test/gestures/pointer_signal_resolver_test.dart b/packages/flutter/test/gestures/pointer_signal_resolver_test.dart index 205c9c4271..90ccf8f727 100644 --- a/packages/flutter/test/gestures/pointer_signal_resolver_test.dart +++ b/packages/flutter/test/gestures/pointer_signal_resolver_test.dart @@ -3,10 +3,9 @@ // found in the LICENSE file. import 'package:flutter/gestures.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'package:vector_math/vector_math_64.dart'; -import '../flutter_test_alternative.dart'; - class TestPointerSignalListener { TestPointerSignalListener(this.event); diff --git a/packages/flutter/test/gestures/resampler_test.dart b/packages/flutter/test/gestures/resampler_test.dart index 13e858e26a..396217ced1 100644 --- a/packages/flutter/test/gestures/resampler_test.dart +++ b/packages/flutter/test/gestures/resampler_test.dart @@ -3,8 +3,7 @@ // found in the LICENSE file. import 'package:flutter/gestures.dart'; - -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { PointerEvent _createSimulatedPointerAddedEvent( diff --git a/packages/flutter/test/harness/trivial_test.dart b/packages/flutter/test/harness/trivial_test.dart index 081e671b14..2a169846b0 100644 --- a/packages/flutter/test/harness/trivial_test.dart +++ b/packages/flutter/test/harness/trivial_test.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { test('should pass', () { diff --git a/packages/flutter/test/material/colors_test.dart b/packages/flutter/test/material/colors_test.dart index 6f6500dc87..7882f67a43 100644 --- a/packages/flutter/test/material/colors_test.dart +++ b/packages/flutter/test/material/colors_test.dart @@ -3,8 +3,7 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; - -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; const List primaryKeys = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900]; const List accentKeys = [100, 200, 400, 700]; diff --git a/packages/flutter/test/painting/box_fit_test.dart b/packages/flutter/test/painting/box_fit_test.dart index fdc8145eaf..13c8bfb31e 100644 --- a/packages/flutter/test/painting/box_fit_test.dart +++ b/packages/flutter/test/painting/box_fit_test.dart @@ -3,8 +3,7 @@ // found in the LICENSE file. import 'package:flutter/painting.dart'; - -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { test('applyBoxFit', () { diff --git a/packages/flutter/test/painting/decoration_test.dart b/packages/flutter/test/painting/decoration_test.dart index 4675a30b18..cbfee6011c 100644 --- a/packages/flutter/test/painting/decoration_test.dart +++ b/packages/flutter/test/painting/decoration_test.dart @@ -9,8 +9,8 @@ import 'dart:ui' as ui show Image, ColorFilter; import 'package:flutter/foundation.dart'; import 'package:flutter/painting.dart'; import 'package:fake_async/fake_async.dart'; +import 'package:flutter_test/flutter_test.dart'; -import '../flutter_test_alternative.dart'; import '../image_data.dart'; import '../painting/mocks_for_image_cache.dart'; import '../rendering/rendering_tester.dart'; diff --git a/packages/flutter/test/painting/geometry_test.dart b/packages/flutter/test/painting/geometry_test.dart index 9f20ccc3da..6798107777 100644 --- a/packages/flutter/test/painting/geometry_test.dart +++ b/packages/flutter/test/painting/geometry_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/painting.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { test('positionDependentBox', () { diff --git a/packages/flutter/test/painting/image_cache_resize_test.dart b/packages/flutter/test/painting/image_cache_resize_test.dart index 78ff7efe83..806e7735ad 100644 --- a/packages/flutter/test/painting/image_cache_resize_test.dart +++ b/packages/flutter/test/painting/image_cache_resize_test.dart @@ -5,7 +5,7 @@ import 'dart:ui' as ui; import 'package:flutter/painting.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import '../rendering/rendering_tester.dart'; import 'mocks_for_image_cache.dart'; diff --git a/packages/flutter/test/painting/image_cache_test.dart b/packages/flutter/test/painting/image_cache_test.dart index 06553a5203..2b70b8fb26 100644 --- a/packages/flutter/test/painting/image_cache_test.dart +++ b/packages/flutter/test/painting/image_cache_test.dart @@ -8,8 +8,8 @@ import 'dart:ui' as ui; import 'package:flutter/foundation.dart'; import 'package:flutter/painting.dart'; import 'package:flutter/scheduler.dart'; +import 'package:flutter_test/flutter_test.dart'; -import '../flutter_test_alternative.dart'; import '../rendering/rendering_tester.dart'; import 'mocks_for_image_cache.dart'; diff --git a/packages/flutter/test/painting/image_decoder_test.dart b/packages/flutter/test/painting/image_decoder_test.dart index 9d3a2893d6..0d5270ee74 100644 --- a/packages/flutter/test/painting/image_decoder_test.dart +++ b/packages/flutter/test/painting/image_decoder_test.dart @@ -6,8 +6,8 @@ import 'dart:typed_data'; import 'dart:ui' as ui; import 'package:flutter/painting.dart'; +import 'package:flutter_test/flutter_test.dart'; -import '../flutter_test_alternative.dart'; import '../image_data.dart'; import 'painting_utils.dart'; diff --git a/packages/flutter/test/painting/strut_style_test.dart b/packages/flutter/test/painting/strut_style_test.dart index 7f0ac7260a..42f91ca344 100644 --- a/packages/flutter/test/painting/strut_style_test.dart +++ b/packages/flutter/test/painting/strut_style_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/painting.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { test('StrutStyle diagnostics test', () { diff --git a/packages/flutter/test/painting/text_style_test.dart b/packages/flutter/test/painting/text_style_test.dart index 95787f7ba0..390345218b 100644 --- a/packages/flutter/test/painting/text_style_test.dart +++ b/packages/flutter/test/painting/text_style_test.dart @@ -4,9 +4,9 @@ import 'dart:ui' as ui show TextStyle, ParagraphStyle, FontFeature, Shadow; +import 'package:flutter/foundation.dart'; import 'package:flutter/painting.dart'; -import 'package:flutter/src/foundation/constants.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; // This matcher verifies ui.TextStyle.toString (from dart:ui) reports a superset // of the given TextStyle's (from painting.dart) properties. diff --git a/packages/flutter/test/physics/near_equal_test.dart b/packages/flutter/test/physics/near_equal_test.dart index 7199333d04..924ea3dfa8 100644 --- a/packages/flutter/test/physics/near_equal_test.dart +++ b/packages/flutter/test/physics/near_equal_test.dart @@ -3,8 +3,7 @@ // found in the LICENSE file. import 'package:flutter/physics.dart'; - -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { test('test_friction', () { diff --git a/packages/flutter/test/rendering/annotated_region_test.dart b/packages/flutter/test/rendering/annotated_region_test.dart index 5b7ca895e3..2c94bbc0c3 100644 --- a/packages/flutter/test/rendering/annotated_region_test.dart +++ b/packages/flutter/test/rendering/annotated_region_test.dart @@ -4,7 +4,7 @@ import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { group('$AnnotatedRegion find', () { diff --git a/packages/flutter/test/rendering/baseline_test.dart b/packages/flutter/test/rendering/baseline_test.dart index 79ac03ca8e..1047269906 100644 --- a/packages/flutter/test/rendering/baseline_test.dart +++ b/packages/flutter/test/rendering/baseline_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/cached_intrinsics_test.dart b/packages/flutter/test/rendering/cached_intrinsics_test.dart index 87ecf30dc0..2945694216 100644 --- a/packages/flutter/test/rendering/cached_intrinsics_test.dart +++ b/packages/flutter/test/rendering/cached_intrinsics_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; class RenderTestBox extends RenderBox { double value = 0.0; diff --git a/packages/flutter/test/rendering/constraints_test.dart b/packages/flutter/test/rendering/constraints_test.dart index 747333a0e8..cf0ec8b3fe 100644 --- a/packages/flutter/test/rendering/constraints_test.dart +++ b/packages/flutter/test/rendering/constraints_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/debug_test.dart b/packages/flutter/test/rendering/debug_test.dart index 1b9b047ee5..27049274ad 100644 --- a/packages/flutter/test/rendering/debug_test.dart +++ b/packages/flutter/test/rendering/debug_test.dart @@ -5,8 +5,8 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/rendering.dart'; import 'package:vector_math/vector_math_64.dart'; +import 'package:flutter_test/flutter_test.dart'; -import '../flutter_test_alternative.dart'; import 'mock_canvas.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/dynamic_intrinsics_test.dart b/packages/flutter/test/rendering/dynamic_intrinsics_test.dart index f3cb36c1ef..b183977c5c 100644 --- a/packages/flutter/test/rendering/dynamic_intrinsics_test.dart +++ b/packages/flutter/test/rendering/dynamic_intrinsics_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/first_frame_test.dart b/packages/flutter/test/rendering/first_frame_test.dart index d33b93ac6c..6b766c9675 100644 --- a/packages/flutter/test/rendering/first_frame_test.dart +++ b/packages/flutter/test/rendering/first_frame_test.dart @@ -9,8 +9,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; - -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { test('Flutter dispatches first frame event on the web only', () async { diff --git a/packages/flutter/test/rendering/independent_layout_test.dart b/packages/flutter/test/rendering/independent_layout_test.dart index bc6845842c..e7a6bdc54d 100644 --- a/packages/flutter/test/rendering/independent_layout_test.dart +++ b/packages/flutter/test/rendering/independent_layout_test.dart @@ -5,7 +5,7 @@ import 'dart:ui' as ui show window; import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/intrinsic_width_test.dart b/packages/flutter/test/rendering/intrinsic_width_test.dart index 61a4cf1103..dec9bddf9d 100644 --- a/packages/flutter/test/rendering/intrinsic_width_test.dart +++ b/packages/flutter/test/rendering/intrinsic_width_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/mouse_tracker_cursor_test.dart b/packages/flutter/test/rendering/mouse_tracker_cursor_test.dart index 77424108fd..5b0bc10b10 100644 --- a/packages/flutter/test/rendering/mouse_tracker_cursor_test.dart +++ b/packages/flutter/test/rendering/mouse_tracker_cursor_test.dart @@ -8,8 +8,8 @@ import 'dart:ui' show PointerChange; import 'package:flutter/rendering.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_test/flutter_test.dart'; -import '../flutter_test_alternative.dart'; import 'mouse_tracker_test_utils.dart'; typedef MethodCallHandler = Future Function(MethodCall call); diff --git a/packages/flutter/test/rendering/mouse_tracker_test.dart b/packages/flutter/test/rendering/mouse_tracker_test.dart index fecba91acd..73f71f47dc 100644 --- a/packages/flutter/test/rendering/mouse_tracker_test.dart +++ b/packages/flutter/test/rendering/mouse_tracker_test.dart @@ -7,8 +7,8 @@ import 'dart:ui' show PointerChange; import 'package:flutter/rendering.dart'; import 'package:flutter/gestures.dart'; +import 'package:flutter_test/flutter_test.dart'; -import '../flutter_test_alternative.dart'; import 'mouse_tracker_test_utils.dart'; MouseTracker get _mouseTracker => RendererBinding.instance!.mouseTracker; diff --git a/packages/flutter/test/rendering/mutations_test.dart b/packages/flutter/test/rendering/mutations_test.dart index 0bc5db9554..fa46d4a1c0 100644 --- a/packages/flutter/test/rendering/mutations_test.dart +++ b/packages/flutter/test/rendering/mutations_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/non_render_object_root_test.dart b/packages/flutter/test/rendering/non_render_object_root_test.dart index 4bd68b7fa4..a87430772c 100644 --- a/packages/flutter/test/rendering/non_render_object_root_test.dart +++ b/packages/flutter/test/rendering/non_render_object_root_test.dart @@ -4,7 +4,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/offstage_test.dart b/packages/flutter/test/rendering/offstage_test.dart index 9fd9634424..ddd824d805 100644 --- a/packages/flutter/test/rendering/offstage_test.dart +++ b/packages/flutter/test/rendering/offstage_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/overflow_test.dart b/packages/flutter/test/rendering/overflow_test.dart index 3fbf4892c5..c7680b5a9b 100644 --- a/packages/flutter/test/rendering/overflow_test.dart +++ b/packages/flutter/test/rendering/overflow_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/paragraph_intrinsics_test.dart b/packages/flutter/test/rendering/paragraph_intrinsics_test.dart index e960391ae2..cc3c7a68b6 100644 --- a/packages/flutter/test/rendering/paragraph_intrinsics_test.dart +++ b/packages/flutter/test/rendering/paragraph_intrinsics_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { test('list body and paragraph intrinsics', () { diff --git a/packages/flutter/test/rendering/positioned_box_test.dart b/packages/flutter/test/rendering/positioned_box_test.dart index 1dbb08459b..b4c32e67c4 100644 --- a/packages/flutter/test/rendering/positioned_box_test.dart +++ b/packages/flutter/test/rendering/positioned_box_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/proxy_box_test.dart b/packages/flutter/test/rendering/proxy_box_test.dart index f06c7fcc61..ae2b149c16 100644 --- a/packages/flutter/test/rendering/proxy_box_test.dart +++ b/packages/flutter/test/rendering/proxy_box_test.dart @@ -9,7 +9,7 @@ import 'package:flutter/animation.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/proxy_getters_and_setters_test.dart b/packages/flutter/test/rendering/proxy_getters_and_setters_test.dart index 402034d0d5..976bc9e962 100644 --- a/packages/flutter/test/rendering/proxy_getters_and_setters_test.dart +++ b/packages/flutter/test/rendering/proxy_getters_and_setters_test.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { test('RenderConstrainedBox getters and setters', () { diff --git a/packages/flutter/test/rendering/proxy_sliver_test.dart b/packages/flutter/test/rendering/proxy_sliver_test.dart index 511374f5da..bcb381fe3b 100644 --- a/packages/flutter/test/rendering/proxy_sliver_test.dart +++ b/packages/flutter/test/rendering/proxy_sliver_test.dart @@ -4,7 +4,7 @@ import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/reattach_test.dart b/packages/flutter/test/rendering/reattach_test.dart index 2056719050..1c7c4625c4 100644 --- a/packages/flutter/test/rendering/reattach_test.dart +++ b/packages/flutter/test/rendering/reattach_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/relative_rect_test.dart b/packages/flutter/test/rendering/relative_rect_test.dart index 0b140f3043..b998ef4f7b 100644 --- a/packages/flutter/test/rendering/relative_rect_test.dart +++ b/packages/flutter/test/rendering/relative_rect_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { test('RelativeRect.==', () { diff --git a/packages/flutter/test/rendering/repaint_boundary_test.dart b/packages/flutter/test/rendering/repaint_boundary_test.dart index 9f7ecd04fc..bf173e4d07 100644 --- a/packages/flutter/test/rendering/repaint_boundary_test.dart +++ b/packages/flutter/test/rendering/repaint_boundary_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/semantics_and_children_test.dart b/packages/flutter/test/rendering/semantics_and_children_test.dart index 3d6559f8d3..740e973106 100644 --- a/packages/flutter/test/rendering/semantics_and_children_test.dart +++ b/packages/flutter/test/rendering/semantics_and_children_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_test/flutter_test.dart' show TestVSync; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/simple_semantics_test.dart b/packages/flutter/test/rendering/simple_semantics_test.dart index 359cd08d3a..114a7d97be 100644 --- a/packages/flutter/test/rendering/simple_semantics_test.dart +++ b/packages/flutter/test/rendering/simple_semantics_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/size_test.dart b/packages/flutter/test/rendering/size_test.dart index 1451d6c529..ec244ebe0d 100644 --- a/packages/flutter/test/rendering/size_test.dart +++ b/packages/flutter/test/rendering/size_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/sliver_cache_test.dart b/packages/flutter/test/rendering/sliver_cache_test.dart index 572900e2e3..644962505c 100644 --- a/packages/flutter/test/rendering/sliver_cache_test.dart +++ b/packages/flutter/test/rendering/sliver_cache_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/sliver_fixed_extent_layout_test.dart b/packages/flutter/test/rendering/sliver_fixed_extent_layout_test.dart index 67a4c8ea61..7ae332951f 100644 --- a/packages/flutter/test/rendering/sliver_fixed_extent_layout_test.dart +++ b/packages/flutter/test/rendering/sliver_fixed_extent_layout_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/sliver_persistent_header_test.dart b/packages/flutter/test/rendering/sliver_persistent_header_test.dart index af040816cd..d2f1f57d5b 100644 --- a/packages/flutter/test/rendering/sliver_persistent_header_test.dart +++ b/packages/flutter/test/rendering/sliver_persistent_header_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/slivers_block_test.dart b/packages/flutter/test/rendering/slivers_block_test.dart index d9081f3b00..2fdeced041 100644 --- a/packages/flutter/test/rendering/slivers_block_test.dart +++ b/packages/flutter/test/rendering/slivers_block_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/rendering.dart'; import 'package:flutter/animation.dart'; - -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/slivers_layout_test.dart b/packages/flutter/test/rendering/slivers_layout_test.dart index 3bdb82dcac..1ea58ed3b6 100644 --- a/packages/flutter/test/rendering/slivers_layout_test.dart +++ b/packages/flutter/test/rendering/slivers_layout_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/stack_test.dart b/packages/flutter/test/rendering/stack_test.dart index 679dcfba1e..39aaafeb89 100644 --- a/packages/flutter/test/rendering/stack_test.dart +++ b/packages/flutter/test/rendering/stack_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/rendering/transform_test.dart b/packages/flutter/test/rendering/transform_test.dart index d43661497e..a9aa5a3aba 100644 --- a/packages/flutter/test/rendering/transform_test.dart +++ b/packages/flutter/test/rendering/transform_test.dart @@ -5,7 +5,7 @@ import 'dart:math' as math; import 'package:flutter/rendering.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; diff --git a/packages/flutter/test/scheduler/animation_test.dart b/packages/flutter/test/scheduler/animation_test.dart index d500123718..47428e5c5b 100644 --- a/packages/flutter/test/scheduler/animation_test.dart +++ b/packages/flutter/test/scheduler/animation_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; - -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'scheduler_tester.dart'; diff --git a/packages/flutter/test/scheduler/priority_test.dart b/packages/flutter/test/scheduler/priority_test.dart index 6e2e62dcef..dba3bc4bef 100644 --- a/packages/flutter/test/scheduler/priority_test.dart +++ b/packages/flutter/test/scheduler/priority_test.dart @@ -3,8 +3,7 @@ // found in the LICENSE file. import 'package:flutter/scheduler.dart'; - -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { test('Priority operators control test', () async { diff --git a/packages/flutter/test/scheduler/scheduler_test.dart b/packages/flutter/test/scheduler/scheduler_test.dart index fda00aa94a..b064d49b12 100644 --- a/packages/flutter/test/scheduler/scheduler_test.dart +++ b/packages/flutter/test/scheduler/scheduler_test.dart @@ -8,8 +8,8 @@ import 'dart:ui' show window; import 'package:flutter/foundation.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_test/flutter_test.dart'; -import '../flutter_test_alternative.dart'; import 'scheduler_tester.dart'; class TestSchedulerBinding extends BindingBase with SchedulerBinding, ServicesBinding { diff --git a/packages/flutter/test/semantics/custom_semantics_action_test.dart b/packages/flutter/test/semantics/custom_semantics_action_test.dart index e81cbdb082..3275effd59 100644 --- a/packages/flutter/test/semantics/custom_semantics_action_test.dart +++ b/packages/flutter/test/semantics/custom_semantics_action_test.dart @@ -3,8 +3,7 @@ // found in the LICENSE file. import 'package:flutter/semantics.dart'; - -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { group(CustomSemanticsAction, () { diff --git a/packages/flutter/test/semantics/semantics_service_test.dart b/packages/flutter/test/semantics/semantics_service_test.dart index ea72876cc1..b384e0fbf1 100644 --- a/packages/flutter/test/semantics/semantics_service_test.dart +++ b/packages/flutter/test/semantics/semantics_service_test.dart @@ -6,9 +6,7 @@ import 'dart:ui' show TextDirection; import 'package:flutter/semantics.dart'; import 'package:flutter/services.dart' show SystemChannels; -import 'package:flutter_test/flutter_test.dart' show TestWidgetsFlutterBinding; - -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); diff --git a/packages/flutter/test/services/message_codecs_test.dart b/packages/flutter/test/services/message_codecs_test.dart index a25825077f..01b5376ffe 100644 --- a/packages/flutter/test/services/message_codecs_test.dart +++ b/packages/flutter/test/services/message_codecs_test.dart @@ -10,7 +10,8 @@ import 'dart:typed_data'; import 'package:flutter/foundation.dart' show WriteBuffer; import 'package:flutter/services.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; + import 'message_codecs_testing.dart'; void main() { diff --git a/packages/flutter/test/services/message_codecs_testing.dart b/packages/flutter/test/services/message_codecs_testing.dart index 5c561bcf50..927542d22d 100644 --- a/packages/flutter/test/services/message_codecs_testing.dart +++ b/packages/flutter/test/services/message_codecs_testing.dart @@ -5,7 +5,7 @@ import 'dart:typed_data'; import 'package:flutter/services.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void checkEncoding(MessageCodec codec, T message, List expectedBytes) { final ByteData encoded = codec.encodeMessage(message)!; diff --git a/packages/flutter/test/services/message_codecs_vm_test.dart b/packages/flutter/test/services/message_codecs_vm_test.dart index b4fee530f8..946a0b33b8 100644 --- a/packages/flutter/test/services/message_codecs_vm_test.dart +++ b/packages/flutter/test/services/message_codecs_vm_test.dart @@ -7,7 +7,8 @@ import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; + import 'message_codecs_testing.dart'; void main() { diff --git a/packages/flutter/test/services/platform_channel_test.dart b/packages/flutter/test/services/platform_channel_test.dart index 547c58645b..7b7f135fda 100644 --- a/packages/flutter/test/services/platform_channel_test.dart +++ b/packages/flutter/test/services/platform_channel_test.dart @@ -3,9 +3,7 @@ // found in the LICENSE file. import 'package:flutter/services.dart'; -import 'package:flutter_test/flutter_test.dart' show TestWidgetsFlutterBinding; - -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); diff --git a/packages/flutter/test/services/platform_views_test.dart b/packages/flutter/test/services/platform_views_test.dart index 4a3228fea9..c7a35070ed 100644 --- a/packages/flutter/test/services/platform_views_test.dart +++ b/packages/flutter/test/services/platform_views_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/painting.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_test/flutter_test.dart' show TestWidgetsFlutterBinding; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'fake_platform_views.dart'; diff --git a/packages/flutter/test/services/text_input_test.dart b/packages/flutter/test/services/text_input_test.dart index 3dce7b6a4a..67ea3287d3 100644 --- a/packages/flutter/test/services/text_input_test.dart +++ b/packages/flutter/test/services/text_input_test.dart @@ -7,8 +7,7 @@ import 'dart:convert' show utf8; import 'dart:convert' show jsonDecode; import 'package:flutter/services.dart'; -import 'package:flutter_test/flutter_test.dart' show TestWidgetsFlutterBinding; -import '../flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); diff --git a/packages/flutter/test_private/README.md b/packages/flutter/test_private/README.md index 338f3a96ce..9c477bb0ab 100644 --- a/packages/flutter/test_private/README.md +++ b/packages/flutter/test_private/README.md @@ -32,7 +32,6 @@ To add a private test, add a manifest file of the form (assuming ], "pubspec": "my_private_test.pubspec.yaml", "deps": [ - "test/flutter_test_alternative.dart", "lib/src/subpackage/my_private_implementation.dart", ] } diff --git a/packages/flutter/test_private/test/animated_icons_private_test.dart.tmpl b/packages/flutter/test_private/test/animated_icons_private_test.dart.tmpl index b184046bc2..dc84b63cea 100644 --- a/packages/flutter/test_private/test/animated_icons_private_test.dart.tmpl +++ b/packages/flutter/test_private/test/animated_icons_private_test.dart.tmpl @@ -15,8 +15,7 @@ import 'dart:ui' as ui show Paint, Path, Canvas; import 'package:flutter/animation.dart'; import 'package:flutter/widgets.dart'; - -import 'test/flutter_test_alternative.dart'; +import 'package:flutter_test/flutter_test.dart'; part 'src/material/animated_icons/animated_icons.dart'; part 'src/material/animated_icons/animated_icons_data.dart'; diff --git a/packages/flutter/test_private/test/animated_icons_private_test.json b/packages/flutter/test_private/test/animated_icons_private_test.json index 5f38bd0afb..1f125af584 100644 --- a/packages/flutter/test_private/test/animated_icons_private_test.json +++ b/packages/flutter/test_private/test/animated_icons_private_test.json @@ -3,9 +3,7 @@ "animated_icons_private_test.dart.tmpl" ], "pubspec": "pubspec.yaml", - "test_deps": [ - "test/flutter_test_alternative.dart" - ], + "test_deps": [], "deps": [ "lib/src/material/animated_icons/animated_icons.dart", "lib/src/material/animated_icons/animated_icons_data.dart", @@ -24,4 +22,4 @@ "lib/src/material/animated_icons/data/search_ellipsis.g.dart", "lib/src/material/animated_icons/data/view_list.g.dart" ] -} \ No newline at end of file +} diff --git a/packages/flutter_driver/test/common.dart b/packages/flutter_driver/test/common.dart index 5f55a15715..f1ea6c7a08 100644 --- a/packages/flutter_driver/test/common.dart +++ b/packages/flutter_driver/test/common.dart @@ -5,17 +5,13 @@ import 'dart:io'; import 'package:flutter_driver/src/common/error.dart'; -import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf; // ignore: deprecated_member_use -import 'package:test_api/test_api.dart' as test_package show TypeMatcher; // ignore: deprecated_member_use +import 'package:test_api/test_api.dart'; // ignore: deprecated_member_use -export 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf; // ignore: deprecated_member_use +export 'package:test_api/test_api.dart' hide isInstanceOf; // ignore: deprecated_member_use export 'package:test_api/fake.dart'; // ignore: deprecated_member_use -// Defines a 'package:test' shim. -// TODO(ianh): Clean this up once https://github.com/dart-lang/matcher/issues/98 is fixed - /// A matcher that compares the type of the actual value to the type argument T. -test_package.TypeMatcher isInstanceOf() => isA(); +TypeMatcher isInstanceOf() => isA(); void tryToDelete(Directory directory) { // This should not be necessary, but it turns out that diff --git a/packages/flutter_test/lib/src/_matchers_io.dart b/packages/flutter_test/lib/src/_matchers_io.dart index 80d6919d8d..571a67740c 100644 --- a/packages/flutter_test/lib/src/_matchers_io.dart +++ b/packages/flutter_test/lib/src/_matchers_io.dart @@ -9,8 +9,7 @@ import 'package:flutter/widgets.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; import 'package:test_api/src/frontend/async_matcher.dart'; // ignore: implementation_imports -// ignore: deprecated_member_use -import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf; +import 'package:test_api/test_api.dart'; // ignore: deprecated_member_use import 'binding.dart'; import 'finders.dart'; diff --git a/packages/flutter_test/lib/src/_matchers_web.dart b/packages/flutter_test/lib/src/_matchers_web.dart index e87c9c0901..34e58d84e4 100644 --- a/packages/flutter_test/lib/src/_matchers_web.dart +++ b/packages/flutter_test/lib/src/_matchers_web.dart @@ -7,8 +7,7 @@ import 'dart:ui' as ui; import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; import 'package:test_api/src/frontend/async_matcher.dart'; // ignore: implementation_imports -// ignore: deprecated_member_use -import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf; +import 'package:test_api/test_api.dart'; // ignore: deprecated_member_use import 'binding.dart'; import 'finders.dart'; diff --git a/packages/flutter_test/lib/src/matchers.dart b/packages/flutter_test/lib/src/matchers.dart index eb69b9ecce..b26065d089 100644 --- a/packages/flutter_test/lib/src/matchers.dart +++ b/packages/flutter_test/lib/src/matchers.dart @@ -7,10 +7,9 @@ import 'dart:typed_data'; import 'dart:ui' as ui; import 'dart:ui'; +// This import is discouraged in general, but we need it to implement flutter_test. // ignore: deprecated_member_use -import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf; -// ignore: deprecated_member_use -import 'package:test_api/test_api.dart' as test_package show TypeMatcher; +import 'package:test_api/test_api.dart'; import 'package:test_api/src/frontend/async_matcher.dart'; // ignore: implementation_imports import 'package:flutter/foundation.dart'; @@ -196,7 +195,7 @@ final Matcher throwsAssertionError = throwsA(isAssertionError); /// /// * [throwsFlutterError], to test if a function throws a [FlutterError]. /// * [isAssertionError], to test if any object is any kind of [AssertionError]. -final test_package.TypeMatcher isFlutterError = isA(); +final TypeMatcher isFlutterError = isA(); /// A matcher for [AssertionError]. /// @@ -206,11 +205,12 @@ final test_package.TypeMatcher isFlutterError = isA( /// /// * [throwsAssertionError], to test if a function throws any [AssertionError]. /// * [isFlutterError], to test if any object is a [FlutterError]. -final test_package.TypeMatcher isAssertionError = isA(); +final TypeMatcher isAssertionError = isA(); /// A matcher that compares the type of the actual value to the type argument T. -// TODO(ianh): Remove this once https://github.com/dart-lang/matcher/issues/98 is fixed -test_package.TypeMatcher isInstanceOf() => isA(); +/// +/// This is identical to [isA] and is included for backwards compatibility. +TypeMatcher isInstanceOf() => isA(); /// Asserts that two [double]s are equal, within some tolerated error. /// diff --git a/packages/flutter_test/lib/src/widget_tester.dart b/packages/flutter_test/lib/src/widget_tester.dart index 2882b868a9..ae24dbd6ba 100644 --- a/packages/flutter_test/lib/src/widget_tester.dart +++ b/packages/flutter_test/lib/src/widget_tester.dart @@ -11,6 +11,7 @@ import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; import 'package:meta/meta.dart'; +// The test_api package is not for general use... it's literally for our use. // ignore: deprecated_member_use import 'package:test_api/test_api.dart' as test_package; @@ -25,13 +26,26 @@ import 'test_compat.dart'; import 'test_pointer.dart'; import 'test_text_input.dart'; -/// Keep users from needing multiple imports to test semantics. +// Keep users from needing multiple imports to test semantics. export 'package:flutter/rendering.dart' show SemanticsHandle; +// We re-export the test package minus some features that we reimplement. +// +// Specifically: +// +// - test, group, setUpAll, tearDownAll, setUp, tearDown, and expect would +// conflict with our own implementations in test_compat.dart. This handles +// setting up a declarer when one is not defined, which can happen when a +// test is executed via `flutter run`. +// +// - expect is reimplemented below, to catch incorrect async usage. +// +// - isInstanceOf is reimplemented in matchers.dart because we don't want to +// mark it as deprecated (ours is just a method, not a class). +// +// The test_api package has a deprecation warning to discourage direct use but +// that doesn't apply here. // ignore: deprecated_member_use -/// Hide these imports so that they do not conflict with our own implementations in -/// test_compat.dart. This handles setting up a declarer when one is not defined, which -/// can happen when a test is executed via flutter_run. export 'package:test_api/test_api.dart' hide test, group, @@ -39,9 +53,8 @@ export 'package:test_api/test_api.dart' hide tearDownAll, setUp, tearDown, - expect, // we have our own wrapper below - TypeMatcher, // matcher's TypeMatcher conflicts with the one in the Flutter framework - isInstanceOf; // we have our own wrapper in matchers.dart + expect, + isInstanceOf; /// Signature for callback to [testWidgets] and [benchmarkWidgets]. typedef WidgetTesterCallback = Future Function(WidgetTester widgetTester); diff --git a/packages/flutter_tools/test/general.shard/generate_localizations_test.dart b/packages/flutter_tools/test/general.shard/generate_localizations_test.dart index 8bc30b8e48..f0e945325e 100644 --- a/packages/flutter_tools/test/general.shard/generate_localizations_test.dart +++ b/packages/flutter_tools/test/general.shard/generate_localizations_test.dart @@ -16,10 +16,7 @@ import 'package:flutter_tools/src/globals.dart' as globals; import 'package:flutter_tools/src/localizations/gen_l10n.dart'; import 'package:flutter_tools/src/localizations/gen_l10n_types.dart'; import 'package:flutter_tools/src/localizations/localizations_utils.dart'; - -import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf; // ignore: deprecated_member_use -// ignore: deprecated_member_use -export 'package:test_core/test_core.dart' hide TypeMatcher, isInstanceOf, test; // Defines a 'package:test' shim. +import 'package:test/test.dart'; final String defaultL10nPathString = globals.fs.path.join('lib', 'l10n'); final String syntheticPackagePath = globals.fs.path.join('.dart_tool', 'flutter_gen'); diff --git a/packages/flutter_tools/test/src/common.dart b/packages/flutter_tools/test/src/common.dart index faf64622a4..6bfaa7fd18 100644 --- a/packages/flutter_tools/test/src/common.dart +++ b/packages/flutter_tools/test/src/common.dart @@ -8,35 +8,33 @@ import 'dart:async'; import 'package:args/args.dart'; import 'package:args/command_runner.dart'; +import 'package:fake_async/fake_async.dart'; import 'package:file/memory.dart'; -import 'package:flutter_tools/src/base/logger.dart'; -import 'package:flutter_tools/src/base/platform.dart'; -import 'package:flutter_tools/src/base/user_messages.dart'; -import 'package:flutter_tools/src/cache.dart'; -import 'package:flutter_tools/src/convert.dart'; -import 'package:flutter_tools/src/doctor.dart'; -import 'package:flutter_tools/src/vmservice.dart'; -import 'package:vm_service/vm_service.dart' as vm_service; -import 'package:path/path.dart' as path; // ignore: package_path_import - import 'package:flutter_tools/src/base/common.dart'; import 'package:flutter_tools/src/base/context.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/io.dart'; +import 'package:flutter_tools/src/base/logger.dart'; +import 'package:flutter_tools/src/base/platform.dart'; +import 'package:flutter_tools/src/base/user_messages.dart'; +import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/commands/create.dart'; +import 'package:flutter_tools/src/convert.dart'; +import 'package:flutter_tools/src/doctor.dart'; +import 'package:flutter_tools/src/globals.dart' as globals; import 'package:flutter_tools/src/runner/flutter_command.dart'; import 'package:flutter_tools/src/runner/flutter_command_runner.dart'; -import 'package:flutter_tools/src/globals.dart' as globals; +import 'package:flutter_tools/src/vmservice.dart'; import 'package:meta/meta.dart'; -import 'package:fake_async/fake_async.dart'; -import 'package:test_api/test_api.dart' as test_package show TypeMatcher, test; // ignore: deprecated_member_use -import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf; // ignore: deprecated_member_use -// ignore: deprecated_member_use -export 'package:test_core/test_core.dart' hide TypeMatcher, isInstanceOf, test; // Defines a 'package:test' shim. +import 'package:path/path.dart' as path; // ignore: package_path_import +import 'package:test_api/test_api.dart' as test_package show test; // ignore: deprecated_member_use +import 'package:test_api/test_api.dart' hide test; // ignore: deprecated_member_use +import 'package:vm_service/vm_service.dart' as vm_service; + +export 'package:test_api/test_api.dart' hide test, isInstanceOf; // ignore: deprecated_member_use /// A matcher that compares the type of the actual value to the type argument T. -// TODO(ianh): Remove this once https://github.com/dart-lang/matcher/issues/98 is fixed -test_package.TypeMatcher isInstanceOf() => isA(); +TypeMatcher isInstanceOf() => isA(); void tryToDelete(Directory directory) { // This should not be necessary, but it turns out that @@ -135,7 +133,7 @@ Matcher throwsToolExit({ int exitCode, Pattern message }) { } /// Matcher for [ToolExit]s. -final test_package.TypeMatcher isToolExit = isA(); +final TypeMatcher isToolExit = isA(); /// Matcher for functions that throw [ProcessException]. Matcher throwsProcessException({ Pattern message }) { @@ -147,7 +145,7 @@ Matcher throwsProcessException({ Pattern message }) { } /// Matcher for [ProcessException]s. -final test_package.TypeMatcher isProcessException = isA(); +final TypeMatcher isProcessException = isA(); /// Creates a flutter project in the [temp] directory using the /// [arguments] list if specified, or `--no-pub` if not. @@ -439,7 +437,7 @@ Matcher matchDoctorValidation({ String statusInfo, dynamic messages }) { - return const test_package.TypeMatcher() + return const TypeMatcher() .having((ValidationResult result) => result.type, 'type', validationType) .having((ValidationResult result) => result.statusInfo, 'statusInfo', statusInfo) .having((ValidationResult result) => result.messages, 'messages', messages); diff --git a/packages/flutter_tools/test/src/test_wrapper.dart b/packages/flutter_tools/test/src/test_wrapper.dart index 038d086ef7..4158114b50 100644 --- a/packages/flutter_tools/test/src/test_wrapper.dart +++ b/packages/flutter_tools/test/src/test_wrapper.dart @@ -4,11 +4,9 @@ // @dart = 2.8 -import 'package:test_api/test_api.dart' as test_package show TypeMatcher; // ignore: deprecated_member_use -import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf; // ignore: deprecated_member_use -// ignore: deprecated_member_use -export 'package:test_core/test_core.dart' hide TypeMatcher, isInstanceOf, test; // Defines a 'package:test' shim. +import 'package:test/test.dart' hide isInstanceOf; + +export 'package:test/test.dart' hide isInstanceOf; /// A matcher that compares the type of the actual value to the type argument T. -// TODO(ianh): Remove this once https://github.com/dart-lang/matcher/issues/98 is fixed -test_package.TypeMatcher isInstanceOf() => isA(); +TypeMatcher isInstanceOf() => isA(); diff --git a/packages/fuchsia_remote_debug_protocol/test/common.dart b/packages/fuchsia_remote_debug_protocol/test/common.dart index ef6a722e76..e60806e72e 100644 --- a/packages/fuchsia_remote_debug_protocol/test/common.dart +++ b/packages/fuchsia_remote_debug_protocol/test/common.dart @@ -2,13 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Defines a 'package:test' shim. -// TODO(ianh): Remove this file once https://github.com/dart-lang/matcher/issues/98 is fixed +import 'package:test/test.dart'; -import 'package:test/test.dart' hide TypeMatcher, isInstanceOf; // ignore: deprecated_member_use -import 'package:test/test.dart' as test_package show TypeMatcher; // ignore: deprecated_member_use - -export 'package:test/test.dart' hide TypeMatcher, isInstanceOf; // ignore: deprecated_member_use +export 'package:test/test.dart' hide isInstanceOf; /// A matcher that compares the type of the actual value to the type argument T. -test_package.TypeMatcher isInstanceOf() => isA(); +TypeMatcher isInstanceOf() => isA(); diff --git a/packages/integration_test/example/test_driver/failure_test.dart b/packages/integration_test/example/test_driver/failure_test.dart index 88aea930c1..b74e9ed63d 100644 --- a/packages/integration_test/example/test_driver/failure_test.dart +++ b/packages/integration_test/example/test_driver/failure_test.dart @@ -4,7 +4,7 @@ import 'package:flutter_driver/flutter_driver.dart'; import 'package:integration_test/common.dart' as common; -import 'package:test/test.dart' hide TypeMatcher, isInstanceOf; +import 'package:test/test.dart'; /// This file is only used for testing of `package:integration_test` – do not /// follow the conventions here if you are a user of `package:integration_test`.