From 65ca387075701655eaf6a1f654b1aed356fc90f7 Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Sat, 28 Jan 2017 15:55:47 -0800 Subject: [PATCH] Make the Ahem font available to tests. (#7725) --- packages/flutter/test/material/tabs_test.dart | 10 +++++----- packages/flutter/test/widgets/buttons_test.dart | 4 ++-- packages/flutter_tools/lib/src/commands/test.dart | 2 +- .../flutter_tools/lib/src/test/flutter_platform.dart | 1 + 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/flutter/test/material/tabs_test.dart b/packages/flutter/test/material/tabs_test.dart index 77c4816042..49763499cb 100644 --- a/packages/flutter/test/material/tabs_test.dart +++ b/packages/flutter/test/material/tabs_test.dart @@ -188,19 +188,19 @@ void main() { testWidgets('TabBar can be scrolled independent of the selection', (WidgetTester tester) async { - List tabs = ['AAAAAA', 'BBBBBB', 'CCCCCC', 'DDDDDD', 'EEEEEE', 'FFFFFF', 'GGGGGG', 'HHHHHH', 'IIIIII', 'JJJJJJ', 'KKKKKK', 'LLLLLL']; + List tabs = ['AAAA', 'BBBB', 'CCCC', 'DDDD', 'EEEE', 'FFFF', 'GGGG', 'HHHH', 'IIII', 'JJJJ', 'KKKK', 'LLLL']; Key tabBarKey = new Key('TabBar'); - await tester.pumpWidget(buildFrame(tabs: tabs, value: 'AAAAAA', isScrollable: true, tabBarKey: tabBarKey)); - TabController controller = DefaultTabController.of(tester.element(find.text('AAAAAA'))); + await tester.pumpWidget(buildFrame(tabs: tabs, value: 'AAAA', isScrollable: true, tabBarKey: tabBarKey)); + TabController controller = DefaultTabController.of(tester.element(find.text('AAAA'))); expect(controller, isNotNull); expect(controller.index, 0); // Fling-scroll the TabBar to the left - expect(tester.getCenter(find.text('HHHHHH')).x, lessThan(700.0)); + expect(tester.getCenter(find.text('HHHH')).x, lessThan(700.0)); await tester.fling(find.byKey(tabBarKey), const Offset(-200.0, 0.0), 10000.0); await tester.pump(); await tester.pump(const Duration(seconds: 1)); // finish the scroll animation - expect(tester.getCenter(find.text('HHHHHH')).x, lessThan(500.0)); + expect(tester.getCenter(find.text('HHHH')).x, lessThan(500.0)); // Scrolling the TabBar doesn't change the selection expect(controller.index, 0); diff --git a/packages/flutter/test/widgets/buttons_test.dart b/packages/flutter/test/widgets/buttons_test.dart index 9fd62e7c49..68996fa624 100644 --- a/packages/flutter/test/widgets/buttons_test.dart +++ b/packages/flutter/test/widgets/buttons_test.dart @@ -17,7 +17,7 @@ void main() { child: new Center( child: new FlatButton( onPressed: () { }, - child: new Text('Hello') + child: new Text('ABC') ) ) ) @@ -30,7 +30,7 @@ void main() { new TestSemantics( id: 1, actions: SemanticsAction.tap.index, - label: 'Hello', + label: 'ABC', rect: new Rect.fromLTRB(0.0, 0.0, 88.0, 36.0), transform: new Matrix4.translationValues(356.0, 282.0, 0.0) ) diff --git a/packages/flutter_tools/lib/src/commands/test.dart b/packages/flutter_tools/lib/src/commands/test.dart index 9b3c90ab5e..7178a78cb6 100644 --- a/packages/flutter_tools/lib/src/commands/test.dart +++ b/packages/flutter_tools/lib/src/commands/test.dart @@ -173,7 +173,7 @@ class TestCommand extends FlutterCommand { testArgs.add('--'); Directory testDir; - List files = argResults.rest.map((String testPath) => path.absolute(testPath)).toList(); + Iterable files = argResults.rest.map((String testPath) => path.absolute(testPath)).toList(); if (argResults['start-paused']) { if (files.length != 1) throwToolExit('When using --start-paused, you must specify a single test file to run.', exitCode: 1); diff --git a/packages/flutter_tools/lib/src/test/flutter_platform.dart b/packages/flutter_tools/lib/src/test/flutter_platform.dart index 0a38ef4748..ac2a3b138a 100644 --- a/packages/flutter_tools/lib/src/test/flutter_platform.dart +++ b/packages/flutter_tools/lib/src/test/flutter_platform.dart @@ -451,6 +451,7 @@ void main() { '--enable-dart-profiling', '--non-interactive', '--enable-checked-mode', + '--use-test-fonts', '--packages=$packages', testPath, ]);