Commit 727ce65f authored by Adam Barth's avatar Adam Barth

Add package:flutter_test

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