Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcc007 committed Jul 17, 2019
1 parent fc03804 commit 8710d00
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
8 changes: 4 additions & 4 deletions lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,17 @@ T getEnumFromString<T>(List<T> values, String value) {
String getAndroidDeviceLocale(String deviceId) {
// ro.product.locale is available on first boot but does not update,
// persist.sys.locale is empty on first boot but updates with locale changes
String deviceLocale = run
String locale = run
.cmd('adb', ['-s', deviceId, 'shell', 'getprop persist.sys.locale'], '.',
true)
.trim();
if (deviceLocale.isEmpty) {
deviceLocale = run
if (locale.isEmpty) {
locale = run
.cmd('adb', ['-s', deviceId, 'shell', 'getprop ro.product.locale'], '.',
true)
.trim();
}
return deviceLocale;
return locale;
}

/// Returns locale of simulator with udid [udId].
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies:
platform: ^2.2.0
process: ^3.0.9
meta: ^1.1.6
intl: ^0.15.8

dev_dependencies:
test: ^1.5.1+1
Expand Down
2 changes: 1 addition & 1 deletion test/env_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void main() {

final env = {
'screen_size': '1440x2560',
'locale': 'en-US',
'locale': 'en_US',
'device_name': 'Nexus 6P',
'device_type': 'android',
};
Expand Down
20 changes: 10 additions & 10 deletions test/screenshots_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ void main() {
test('change android locale', () async {
final deviceName = 'Nexus 6P';
final emulatorId = 'Nexus_6P_API_28';
final origLocale = 'en-US';
final newLocale = 'fr-CA';
final origLocale = 'en_US';
final newLocale = 'fr_CA';
final daemonClient = DaemonClient();
await daemonClient.start;
daemonClient.verbose = true;
Expand Down Expand Up @@ -318,8 +318,8 @@ void main() {
final emulatorId = 'Nexus_6P_API_28';
final deviceName = 'any device name';
final stagingDir = '/tmp/tmp';
final origLocale = 'en-US';
final newLocale = 'fr-CA';
final origLocale = 'en_US';
final newLocale = 'fr_CA';
final testAppDir = 'example';
final testAppSrcPath = 'test_driver/main.dart';

Expand Down Expand Up @@ -348,7 +348,7 @@ void main() {
test('get android device locale', () async {
final emulatorId = 'Nexus_6P_API_28';
final stagingDir = '/tmp/tmp';
final locale = 'en-US';
final locale = 'en_US';

await resources.unpackScripts(stagingDir);
final daemonClient = DaemonClient();
Expand All @@ -363,8 +363,8 @@ void main() {
test('change locale on iOS and test', () async {
final simulatorName = 'iPhone X';
final stagingDir = '/tmp/tmp';
final origLocale = 'en-US';
final locale = 'fr-CA';
final origLocale = 'en_US';
final locale = 'fr_CA';
final testAppDir = 'example';
final testAppSrcPath = 'test_driver/main.dart';

Expand Down Expand Up @@ -399,7 +399,7 @@ void main() {
test('get ios simulator locale', () async {
final udId = '03D4FC12-3927-4C8B-A226-17DE34AE9C18';
var locale = utils.getIosSimulatorLocale(udId);
expect(locale, 'en-US');
expect(locale, 'en_US');
});

test('get avd from a running emulator', () async {
Expand Down Expand Up @@ -507,7 +507,7 @@ devices:
});

test('scan syslog for string', () async {
final toLocale = 'en-US';
final toLocale = 'en_US';
// final expected =
// 'ContactsProvider: Locale has changed from [fr_CA] to [en_US]';
// final expected = RegExp('Locale has changed from');
Expand All @@ -524,7 +524,7 @@ devices:
});

test('reg exp', () {
final locale = 'fr-CA';
final locale = 'fr_CA';
final line =
'ContactsProvider: Locale has changed from [en_US] to [${locale.replaceFirst('-', '_')}]';
// final regExp = RegExp(
Expand Down
10 changes: 5 additions & 5 deletions test/screenshots_yaml_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ staging: /tmp/screenshots
# A list of locales supported in app
locales:
# - fr-CA
- en-US
# - de-DE
# - fr_CA
- en_US
# - de_DE
# A list of devices to emulate
devices:
Expand Down Expand Up @@ -49,7 +49,7 @@ void main() {
test('config info for app from string', () {
final expected = {
'tests': ['example/test_driver/main.dart'],
'locales': ['en-US'],
'locales': ['en_US'],
'frame': true,
'devices': {
'android': {'Nexus 5X': null},
Expand All @@ -68,7 +68,7 @@ void main() {
test('config info for app from file', () {
final expected = {
'tests': ['example/test_driver/main.dart'],
'locales': ['en-US'],
'locales': ['en_US'],
'frame': true,
'devices': {
'android': {'Nexus 5X': null},
Expand Down

0 comments on commit 8710d00

Please sign in to comment.