Skip to content

Commit

Permalink
Fixed finding device info from config
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcc007 committed Jul 17, 2019
1 parent aa6b8b5 commit 9e0fabd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/src/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,12 @@ bool isValidFrame(dynamic frame) {
/// Find device info in config for device name.
Map findDeviceInfo(Map configInfo, String deviceName) {
Map deviceInfo;
configInfo['devices'].values.forEach((devices) {
devices.forEach((_deviceName, _deviceInfo) {
if (_deviceName == deviceName) deviceInfo = _deviceInfo;
});
configInfo['devices'].forEach((deviceType, devices) {
if (devices != null) {
devices.forEach((_deviceName, _deviceInfo) {
if (_deviceName == deviceName) deviceInfo = _deviceInfo;
});
}
});
return deviceInfo;
}
2 changes: 2 additions & 0 deletions test/screenshots_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -732,11 +732,13 @@ devices:
android:
android device 1:
android device 2:
fuschia:
''';
final configInfo = loadYaml(params);
final deviceNames = utils.getAllConfiguredDeviceNames(configInfo);
for (final devName in deviceNames) {
final deviceInfo = findDeviceInfo(configInfo, devName);
print('devName=$devName');
print('deviceInfo=$deviceInfo');
if (deviceInfo != null) {
expect(deviceInfo['orientation'], orientation);
Expand Down

0 comments on commit 9e0fabd

Please sign in to comment.