mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Add package:flutter_test
This package contains WidgetTester, which is very useful when writing tests for widgets.
This commit is contained in:
parent
587b5bce35
commit
727ce65ffc
8
packages/flutter_test/lib/flutter_test.dart
Normal file
8
packages/flutter_test/lib/flutter_test.dart
Normal file
@ -0,0 +1,8 @@
|
||||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
library flutter_test;
|
||||
|
||||
export 'src/test_pointer.dart';
|
||||
export 'src/widget_tester.dart';
|
@ -1,3 +1,7 @@
|
||||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:flutter/gestures.dart';
|
@ -11,24 +11,7 @@ import 'package:flutter/widgets.dart';
|
||||
import 'package:quiver/testing/async.dart';
|
||||
import 'package:quiver/time.dart';
|
||||
|
||||
import '../engine/mock_events.dart';
|
||||
|
||||
class RootComponent extends StatefulComponent {
|
||||
RootComponentState createState() => new RootComponentState();
|
||||
}
|
||||
|
||||
class RootComponentState extends State<RootComponent> {
|
||||
Widget _child = new DecoratedBox(decoration: new BoxDecoration());
|
||||
Widget get child => _child;
|
||||
void set child(Widget value) {
|
||||
if (value != _child) {
|
||||
setState(() {
|
||||
_child = value;
|
||||
});
|
||||
}
|
||||
}
|
||||
Widget build(BuildContext context) => child;
|
||||
}
|
||||
import 'test_pointer.dart';
|
||||
|
||||
typedef Point SizeToPointFunction(Size size);
|
||||
|
10
packages/flutter_test/pubspec.yaml
Normal file
10
packages/flutter_test/pubspec.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
name: flutter_test
|
||||
dependencies:
|
||||
test: ^0.12.5
|
||||
quiver: ^0.21.4
|
||||
flutter:
|
||||
path: ../flutter
|
||||
|
||||
# So that the test harness is available when running the tests.
|
||||
flutter_tools:
|
||||
path: ../flutter_tools
|
@ -1,10 +1,10 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:stocks/main.dart' as stocks;
|
||||
import 'package:stocks/stock_data.dart' as stock_data;
|
||||
import '../../test/widget/widget_tester.dart';
|
||||
|
||||
const int _kNumberOfIterations = 50000;
|
||||
const bool _kRunForever = false;
|
||||
|
@ -1,10 +1,10 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:stocks/main.dart' as stocks;
|
||||
import 'package:stocks/stock_data.dart' as stock_data;
|
||||
import '../../test/widget/widget_tester.dart';
|
||||
|
||||
const int _kNumberOfIterations = 100000;
|
||||
const bool _kRunForever = false;
|
||||
|
@ -1,10 +1,10 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:stocks/main.dart' as stocks;
|
||||
import 'package:stocks/stock_data.dart' as stock_data;
|
||||
import '../../test/widget/widget_tester.dart';
|
||||
|
||||
const int _kNumberOfIterations = 100000;
|
||||
const bool _kRunForever = false;
|
||||
|
@ -1,13 +1,10 @@
|
||||
name: flutter_unit_tests
|
||||
dependencies:
|
||||
test: ^0.12.5
|
||||
quiver: ^0.21.4
|
||||
flx:
|
||||
path: ../flx
|
||||
flutter:
|
||||
path: ../flutter
|
||||
flutter_test:
|
||||
path: ../flutter_test
|
||||
stocks:
|
||||
path: ../../examples/stocks
|
||||
# To ensure the version of test doesn't get out of sync.
|
||||
flutter_tools:
|
||||
path: ../flutter_tools
|
||||
|
@ -1,8 +1,7 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../engine/mock_events.dart';
|
||||
|
||||
void main() {
|
||||
test('Should route pointers', () {
|
||||
bool callbackRan = false;
|
||||
|
@ -1,10 +1,9 @@
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../engine/mock_events.dart';
|
||||
|
||||
void main() {
|
||||
test('Should recognize scale gestures', () {
|
||||
PointerRouter router = new PointerRouter();
|
||||
|
@ -1,10 +1,9 @@
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../engine/mock_events.dart';
|
||||
|
||||
void main() {
|
||||
test('Should recognize pan', () {
|
||||
PointerRouter router = new PointerRouter();
|
||||
|
@ -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:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
void main() {
|
||||
test('Align smoke test', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
|
@ -2,13 +2,12 @@
|
||||
// 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 'package:flutter/animation.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
void main() {
|
||||
test('AnimatedContainer control test', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
|
@ -2,12 +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 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../engine/mock_events.dart';
|
||||
import 'widget_tester.dart';
|
||||
|
||||
final Key blockKey = new Key('test');
|
||||
|
||||
void main() {
|
||||
|
@ -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:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
void main() {
|
||||
test('Verify that a tap dismisses a modal BottomSheet', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
@ -79,7 +78,7 @@ void main() {
|
||||
expect(showBottomSheetThenCalled, isFalse);
|
||||
expect(tester.findText('BottomSheet'), isNull);
|
||||
|
||||
scaffoldKey.currentState.showBottomSheet((BuildContext context) {
|
||||
scaffoldKey.currentState.showBottomSheet((BuildContext context) {
|
||||
return new Container(
|
||||
margin: new EdgeDims.all(40.0),
|
||||
child: new Text('BottomSheet')
|
||||
|
@ -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:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
void main() {
|
||||
test('Circles can have uniform borders', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
|
@ -2,11 +2,11 @@
|
||||
// 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 'package:flutter/animation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
import 'test_widgets.dart';
|
||||
|
||||
class ProbeWidget extends StatefulComponent {
|
||||
|
@ -2,11 +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 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
void main() {
|
||||
test('Can be placed in an infinte box', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
|
@ -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:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
void main() {
|
||||
test('Comparing coordinates', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
|
@ -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:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
class TestMultiChildLayoutDelegate extends MultiChildLayoutDelegate {
|
||||
BoxConstraints getSizeConstraints;
|
||||
|
||||
|
@ -2,11 +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 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
class TestOneChildLayoutDelegate extends OneChildLayoutDelegate {
|
||||
BoxConstraints constraintsFromGetSize;
|
||||
BoxConstraints constraintsFromGetConstraintsForChild;
|
||||
|
@ -2,11 +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 'package:flutter/material.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
void main() {
|
||||
test('Can select a day', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
|
@ -2,13 +2,11 @@
|
||||
// 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 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../engine/mock_events.dart';
|
||||
import 'widget_tester.dart';
|
||||
|
||||
const double itemExtent = 100.0;
|
||||
ScrollDirection scrollDirection = ScrollDirection.vertical;
|
||||
DismissDirection dismissDirection = DismissDirection.horizontal;
|
||||
@ -284,4 +282,3 @@ void main() {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2,12 +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 'package:flutter/material.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../engine/mock_events.dart';
|
||||
import 'widget_tester.dart';
|
||||
|
||||
void main() {
|
||||
test('Drag and drop - control test', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
|
@ -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:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
void main() {
|
||||
|
||||
test('Drawer control test', () {
|
||||
|
@ -2,11 +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 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
class Item {
|
||||
GlobalKey key1 = new GlobalKey();
|
||||
GlobalKey key2 = new GlobalKey();
|
||||
|
@ -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:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
void main() {
|
||||
test('Can hit test flex children of stacks', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
|
@ -2,11 +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 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
class TestFocusable extends StatelessComponent {
|
||||
TestFocusable(this.no, this.yes, GlobalKey key) : super(key: key);
|
||||
final String no;
|
||||
|
@ -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:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
void main() {
|
||||
test('FractionallySizedBox', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
|
@ -2,12 +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 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../engine/mock_events.dart';
|
||||
import 'widget_tester.dart';
|
||||
|
||||
void main() {
|
||||
test('Uncontested scrolls start immediately', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
|
@ -2,11 +2,11 @@
|
||||
// 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 'package:flutter/material.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'test_matchers.dart';
|
||||
import 'widget_tester.dart';
|
||||
|
||||
Key firstKey = new Key('first');
|
||||
Key secondKey = new Key('second');
|
||||
|
@ -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_test/flutter_test.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
import 'test_widgets.dart';
|
||||
|
||||
void main() {
|
||||
|
@ -2,11 +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 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
List<String> ancestors = <String>[];
|
||||
|
||||
class TestComponent extends StatefulComponent {
|
||||
|
@ -2,13 +2,13 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:mojo_services/keyboard/keyboard.mojom.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mojo_services/keyboard/keyboard.mojom.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
import '../services/mock_services.dart';
|
||||
|
||||
class MockKeyboard implements KeyboardService {
|
||||
|
@ -2,11 +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 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
void main() {
|
||||
test('Events bubble up the tree', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
|
@ -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_test/flutter_test.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
import 'test_widgets.dart';
|
||||
|
||||
void main() {
|
||||
|
@ -2,12 +2,12 @@
|
||||
// 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 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'test_widgets.dart';
|
||||
import 'widget_tester.dart';
|
||||
|
||||
void checkTree(WidgetTester tester, List<BoxDecoration> expectedDecorations) {
|
||||
MultiChildRenderObjectElement element =
|
||||
|
@ -2,11 +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 'package:flutter/material.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
class FirstComponent extends StatelessComponent {
|
||||
Widget build(BuildContext context) {
|
||||
return new GestureDetector(
|
||||
|
@ -2,11 +2,11 @@
|
||||
// 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 'package:flutter/material.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'test_matchers.dart';
|
||||
import 'widget_tester.dart';
|
||||
|
||||
class TestOverlayRoute extends OverlayRoute {
|
||||
List<WidgetBuilder> get builders => <WidgetBuilder>[ _build ];
|
||||
|
@ -2,11 +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 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
const Size pageSize = const Size(800.0, 600.0);
|
||||
const List<int> pages = const <int>[0, 1, 2, 3, 4, 5];
|
||||
int currentPage = null;
|
||||
|
@ -2,12 +2,12 @@
|
||||
// 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 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'test_widgets.dart';
|
||||
import 'widget_tester.dart';
|
||||
|
||||
class TestParentData {
|
||||
TestParentData({ this.top, this.right, this.bottom, this.left });
|
||||
|
@ -2,13 +2,12 @@
|
||||
// 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 'package:flutter/animation.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
void main() {
|
||||
|
||||
test('Can animate position data', () {
|
||||
|
@ -2,13 +2,11 @@
|
||||
// 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 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
void main() {
|
||||
test('LinearProgressIndicator changes when its value changes', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
|
@ -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:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/animation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
class ThePositiveNumbers extends ScrollableWidgetList {
|
||||
ThePositiveNumbers() : super(itemExtent: 100.0);
|
||||
ThePositiveNumbersState createState() => new ThePositiveNumbersState();
|
||||
|
@ -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:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
final BoxDecoration kBoxDecorationA = new BoxDecoration();
|
||||
final BoxDecoration kBoxDecorationB = new BoxDecoration();
|
||||
final BoxDecoration kBoxDecorationC = new BoxDecoration();
|
||||
|
@ -2,11 +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 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
class StateMarker extends StatefulComponent {
|
||||
StateMarker({ Key key, this.child }) : super(key: key);
|
||||
|
||||
|
@ -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:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
const List<int> items = const <int>[0, 1, 2, 3, 4, 5];
|
||||
List<int> tapped = <int>[];
|
||||
|
||||
|
@ -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:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
const List<int> items = const <int>[0, 1, 2, 3, 4, 5];
|
||||
|
||||
Widget buildFrame() {
|
||||
|
@ -2,11 +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 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
const List<int> items = const <int>[0, 1, 2, 3, 4, 5];
|
||||
|
||||
Widget buildFrame() {
|
||||
|
@ -2,11 +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 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
List<int> items = <int>[0, 1, 2, 3, 4, 5];
|
||||
|
||||
Widget buildCard(BuildContext context, int index) {
|
||||
|
@ -2,11 +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 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
ChangerState changer;
|
||||
|
||||
class Changer extends StatefulComponent {
|
||||
|
@ -2,12 +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 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../engine/mock_events.dart';
|
||||
import 'widget_tester.dart';
|
||||
|
||||
class Inside extends StatefulComponent {
|
||||
InsideState createState() => new InsideState();
|
||||
}
|
||||
|
@ -4,12 +4,11 @@
|
||||
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/painting.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
ui.Shader createShader(Rect bounds) {
|
||||
return new LinearGradient(
|
||||
begin: Point.origin,
|
||||
|
@ -2,13 +2,11 @@
|
||||
// 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 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
void main() {
|
||||
test('SizeObserver notices zero size', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
|
@ -2,11 +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 'package:flutter/material.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
class Builder extends StatelessComponent {
|
||||
Builder({ this.builder });
|
||||
final WidgetBuilder builder;
|
||||
@ -55,7 +54,7 @@ void main() {
|
||||
expect(tester.findText(helloSnackBar), isNotNull);
|
||||
tester.pump(new Duration(milliseconds: 750)); // 1.50s
|
||||
expect(tester.findText(helloSnackBar), isNotNull);
|
||||
tester.pump(new Duration(milliseconds: 750)); // 2.25s
|
||||
tester.pump(new Duration(milliseconds: 750)); // 2.25s
|
||||
expect(tester.findText(helloSnackBar), isNotNull);
|
||||
tester.pump(new Duration(milliseconds: 750)); // 3.00s // timer triggers to dismiss snackbar, reverse animation is scheduled
|
||||
tester.pump(); // begin animation
|
||||
@ -114,7 +113,7 @@ void main() {
|
||||
tester.pump(new Duration(milliseconds: 750)); // 1.50s
|
||||
expect(tester.findText('bar1'), isNotNull);
|
||||
expect(tester.findText('bar2'), isNull);
|
||||
tester.pump(new Duration(milliseconds: 750)); // 2.25s
|
||||
tester.pump(new Duration(milliseconds: 750)); // 2.25s
|
||||
expect(tester.findText('bar1'), isNotNull);
|
||||
expect(tester.findText('bar2'), isNull);
|
||||
tester.pump(new Duration(milliseconds: 750)); // 3.00s // timer triggers to dismiss snackbar, reverse animation is scheduled
|
||||
@ -133,7 +132,7 @@ void main() {
|
||||
tester.pump(new Duration(milliseconds: 750)); // 5.25s
|
||||
expect(tester.findText('bar1'), isNull);
|
||||
expect(tester.findText('bar2'), isNotNull);
|
||||
tester.pump(new Duration(milliseconds: 750)); // 6.00s
|
||||
tester.pump(new Duration(milliseconds: 750)); // 6.00s
|
||||
expect(tester.findText('bar1'), isNull);
|
||||
expect(tester.findText('bar2'), isNotNull);
|
||||
tester.pump(new Duration(milliseconds: 750)); // 6.75s // timer triggers to dismiss snackbar, reverse animation is scheduled
|
||||
@ -200,10 +199,10 @@ void main() {
|
||||
tester.pump(new Duration(milliseconds: 750)); // 1.50s
|
||||
expect(tester.findText('bar1'), isNotNull);
|
||||
expect(tester.findText('bar2'), isNull);
|
||||
tester.pump(new Duration(milliseconds: 750)); // 2.25s
|
||||
tester.pump(new Duration(milliseconds: 750)); // 2.25s
|
||||
expect(tester.findText('bar1'), isNotNull);
|
||||
expect(tester.findText('bar2'), isNull);
|
||||
tester.pump(new Duration(milliseconds: 10000)); // 12.25s
|
||||
tester.pump(new Duration(milliseconds: 10000)); // 12.25s
|
||||
expect(tester.findText('bar1'), isNotNull);
|
||||
expect(tester.findText('bar2'), isNull);
|
||||
|
||||
@ -225,7 +224,7 @@ void main() {
|
||||
tester.pump(new Duration(milliseconds: 750)); // 15.25s
|
||||
expect(tester.findText('bar1'), isNull);
|
||||
expect(tester.findText('bar2'), isNotNull);
|
||||
tester.pump(new Duration(milliseconds: 750)); // 16.00s
|
||||
tester.pump(new Duration(milliseconds: 750)); // 16.00s
|
||||
expect(tester.findText('bar1'), isNull);
|
||||
expect(tester.findText('bar2'), isNotNull);
|
||||
tester.pump(new Duration(milliseconds: 750)); // 16.75s // timer triggers to dismiss snackbar, reverse animation is scheduled
|
||||
|
@ -4,11 +4,10 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
const double itemExtent = 200.0;
|
||||
ScrollDirection scrollDirection = ScrollDirection.vertical;
|
||||
GlobalKey scrollableListKey;
|
||||
|
@ -2,11 +2,11 @@
|
||||
// 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 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
import '../rendering/rendering_tester.dart';
|
||||
|
||||
void main() {
|
||||
|
@ -2,11 +2,11 @@
|
||||
// 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 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
import 'test_widgets.dart';
|
||||
|
||||
void main() {
|
||||
|
@ -2,11 +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 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
class InnerComponent extends StatefulComponent {
|
||||
InnerComponent({ Key key }) : super(key: key);
|
||||
InnerComponentState createState() => new InnerComponentState();
|
||||
|
@ -2,11 +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 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
class TestWidget extends StatefulComponent {
|
||||
TestWidget({ this.child, this.persistentState, this.syncedState });
|
||||
|
||||
|
@ -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:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
int selectedIndex = 2;
|
||||
|
||||
Widget buildFrame({ List<String> tabs, bool isScrollable: false }) {
|
||||
|
@ -2,11 +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 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
final BoxDecoration kBoxDecorationA = new BoxDecoration(
|
||||
backgroundColor: const Color(0xFFFF0000)
|
||||
);
|
||||
|
@ -2,11 +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 'package:flutter/widgets.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'widget_tester.dart';
|
||||
|
||||
void main() {
|
||||
test('Transform origin', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
|
Loading…
Reference in New Issue
Block a user