Merge pull request #825 from eseidelGoogle/locale_test

Add a test to stocks for changing the locale
This commit is contained in:
Eric Seidel
2015-12-08 16:34:53 -08:00
5 changed files with 44 additions and 4 deletions

View File

@@ -4,3 +4,6 @@ dependencies:
path: ../../packages/flutter
intl: '>=0.12.4+2 <0.13.0'
dev_dependencies:
flutter_test:
path: ../../packages/flutter_test

View File

@@ -0,0 +1,23 @@
import 'package:test/test.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/material.dart';
import 'package:stocks/main.dart' as stocks;
import 'package:stocks/stock_data.dart' as stock_data;
void main() {
stock_data.StockDataFetcher.actuallyFetchData = false;
test("Test changing locale", () {
testWidgets((WidgetTester tester) {
stocks.main();
tester.pump(const Duration(seconds: 1)); // Unclear why duration is required.
Element<Text> tab = tester.findText('MARKET');
expect(tab, isNotNull);
tester.setLocale("es", "US");
tester.pump();
expect(tab.widget.data, equals("MERCADO"));
});
});
}