resolveIntegrationDeviceMatrix function
IntegrationDeviceMatrix
resolveIntegrationDeviceMatrix(
- EnsembleTestConfig config, {
- required String platform,
- Set<
String> selectedIds = const {},
Widget devices entries that still apply on a real integration target.
Viewport/model are ignored by the harness. Matching platform rows keep
locale/theme. Other platforms are skipped. If --device was set and none
of those ids match the connected platform, this throws.
Implementation
IntegrationDeviceMatrix resolveIntegrationDeviceMatrix(
EnsembleTestConfig config, {
required String platform,
Set<String> selectedIds = const {},
}) {
final filtered = applyDeviceFilter(config, selectedIds);
if (filtered.devices.isEmpty) {
return IntegrationDeviceMatrix(
config: filtered,
skipped: const [],
platform: TestDeviceTarget.normalizePlatform(platform),
);
}
final normalized = TestDeviceTarget.normalizePlatform(platform);
if (normalized.isEmpty) {
return IntegrationDeviceMatrix(
config: filtered,
skipped: const [],
platform: normalized,
);
}
final matched = <TestDeviceTarget>[];
final skipped = <TestDeviceTarget>[];
for (final device in filtered.devices) {
if (device.matchesPlatform(normalized)) {
matched.add(device);
} else {
skipped.add(device);
}
}
if (matched.isEmpty && selectedIds.isNotEmpty) {
throw EnsembleTestFailure(
'--device did not match the connected $normalized target. '
'Selected: ${selectedIds.join(', ')}. Use --device-id to pick a '
'matching emulator/simulator, or choose a devices entry for '
'$normalized.',
);
}
return IntegrationDeviceMatrix(
config: filtered.copyWith(devices: matched),
skipped: skipped,
platform: normalized,
);
}