Align more closely with package:test (#77118)
This commit is contained in:
parent
5039594f69
commit
0cbe597540
@ -61,9 +61,6 @@ Future<void> run(List<String> 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<void> verifyNoTestImports(String workingDirectory) async {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> verifyNoTestPackageImports(String workingDirectory) async {
|
||||
// TODO(ianh): Remove this whole test once https://github.com/dart-lang/matcher/issues/98 is fixed.
|
||||
final List<String> shims = <String>[];
|
||||
final List<String> errors = (await _allFiles(workingDirectory, 'dart', minimumMatches: 2000).toList())
|
||||
.map<String>((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(<String>[
|
||||
"${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<void> verifyNoBadImportsInFlutter(String workingDirectory) async {
|
||||
final List<String> errors = <String>[];
|
||||
final String libPath = path.join(workingDirectory, 'packages', 'flutter', 'lib');
|
||||
|
@ -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<T> isInstanceOf<T>() => isA<T>();
|
||||
TypeMatcher<T> isInstanceOf<T>() => isA<T>();
|
||||
|
||||
void tryToDelete(Directory directory) {
|
||||
// This should not be necessary, but it turns out that
|
||||
|
@ -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<T> isInstanceOf<T>() => isA<T>();
|
||||
TypeMatcher<T> isInstanceOf<T>() => isA<T>();
|
||||
|
@ -5,6 +5,7 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
import 'constants.dart';
|
||||
|
||||
/// A semantics node created from Android accessibility information.
|
||||
|
@ -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<T> isInstanceOf<T>() => isA<T>();
|
@ -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:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'common.dart';
|
||||
import 'constants.dart';
|
||||
import 'flutter_test_alternative.dart';
|
||||
|
||||
/// Matches an [AndroidSemanticsNode].
|
||||
///
|
||||
|
@ -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<T> isInstanceOf<T>() => isA<T>();
|
||||
TypeMatcher<T> isInstanceOf<T>() => isA<T>();
|
||||
|
||||
void tryToDelete(Directory directory) {
|
||||
// This should not be necessary, but it turns out that
|
||||
|
@ -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<T> isInstanceOf<T>() => isA<T>();
|
||||
|
||||
/// Whether we are running in a web browser.
|
||||
const bool isBrowser = identical(0, 0.0);
|
@ -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';
|
||||
|
||||
|
@ -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 }
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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(<int>[0, 1, 2, 3, 4, 5]);
|
||||
final Uint8List chunkTwo = Uint8List.fromList(<int>[6, 7, 8, 9, 10]);
|
||||
|
||||
void main() {
|
||||
group(consolidateHttpClientResponseBytes, () {
|
||||
late MockHttpClientResponse response;
|
||||
|
@ -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', () {
|
||||
|
@ -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', () {
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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', () {
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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', () {
|
||||
|
@ -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,
|
||||
|
@ -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', () {
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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 { }
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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(
|
||||
|
@ -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', () {
|
||||
|
@ -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<int> primaryKeys = <int>[50, 100, 200, 300, 400, 500, 600, 700, 800, 900];
|
||||
const List<int> accentKeys = <int>[100, 200, 400, 700];
|
||||
|
@ -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', () {
|
||||
|
@ -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';
|
||||
|
@ -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', () {
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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', () {
|
||||
|
@ -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.
|
||||
|
@ -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', () {
|
||||
|
@ -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', () {
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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<dynamic> Function(MethodCall call);
|
||||
|
@ -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;
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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', () {
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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', () {
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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.==', () {
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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, () {
|
||||
|
@ -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();
|
||||
|
@ -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() {
|
||||
|
@ -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<T>(MessageCodec<T> codec, T message, List<int> expectedBytes) {
|
||||
final ByteData encoded = codec.encodeMessage(message)!;
|
||||
|
@ -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() {
|
||||
|
@ -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();
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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",
|
||||
]
|
||||
}
|
||||
|
@ -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';
|
||||
|
@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -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<T> isInstanceOf<T>() => isA<T>();
|
||||
TypeMatcher<T> isInstanceOf<T>() => isA<T>();
|
||||
|
||||
void tryToDelete(Directory directory) {
|
||||
// This should not be necessary, but it turns out that
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
@ -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<FlutterError> isFlutterError = isA<FlutterError>();
|
||||
final TypeMatcher<FlutterError> isFlutterError = isA<FlutterError>();
|
||||
|
||||
/// A matcher for [AssertionError].
|
||||
///
|
||||
@ -206,11 +205,12 @@ final test_package.TypeMatcher<FlutterError> isFlutterError = isA<FlutterError>(
|
||||
///
|
||||
/// * [throwsAssertionError], to test if a function throws any [AssertionError].
|
||||
/// * [isFlutterError], to test if any object is a [FlutterError].
|
||||
final test_package.TypeMatcher<AssertionError> isAssertionError = isA<AssertionError>();
|
||||
final TypeMatcher<AssertionError> isAssertionError = isA<AssertionError>();
|
||||
|
||||
/// 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<T> isInstanceOf<T>() => isA<T>();
|
||||
///
|
||||
/// This is identical to [isA] and is included for backwards compatibility.
|
||||
TypeMatcher<T> isInstanceOf<T>() => isA<T>();
|
||||
|
||||
/// Asserts that two [double]s are equal, within some tolerated error.
|
||||
///
|
||||
|
@ -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<void> Function(WidgetTester widgetTester);
|
||||
|
@ -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');
|
||||
|
@ -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<T> isInstanceOf<T>() => isA<T>();
|
||||
TypeMatcher<T> isInstanceOf<T>() => isA<T>();
|
||||
|
||||
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<ToolExit> isToolExit = isA<ToolExit>();
|
||||
final TypeMatcher<ToolExit> isToolExit = isA<ToolExit>();
|
||||
|
||||
/// 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<ProcessException> isProcessException = isA<ProcessException>();
|
||||
final TypeMatcher<ProcessException> isProcessException = isA<ProcessException>();
|
||||
|
||||
/// 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<ValidationResult>()
|
||||
return const TypeMatcher<ValidationResult>()
|
||||
.having((ValidationResult result) => result.type, 'type', validationType)
|
||||
.having((ValidationResult result) => result.statusInfo, 'statusInfo', statusInfo)
|
||||
.having((ValidationResult result) => result.messages, 'messages', messages);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user