diff options
author | Ubuntu <ubuntu@cert-jenkins-slave-1-201406-15260.maas> | 2021-11-07 16:37:28 +0000 |
---|---|---|
committer | Ubuntu <ubuntu@cert-jenkins-slave-1-201406-15260.maas> | 2021-11-07 16:37:28 +0000 |
commit | f4f0488ce07f8acc64c976778222cd56edc17e37 (patch) | |
tree | 98cbb8967387b01623e0d80eebc7fad26020762c /bin | |
parent | 76c8334e9a0ad8f14930c1588e4b47a15a6c992a (diff) | |
parent | 85800b64a184e7bcc93c5a044b74559cee618245 (diff) |
Merge #408930 from ~kissiel/plainbox-provider-checkbox:fix-missing-camera-resolutions
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/camera_test.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/camera_test.py b/bin/camera_test.py index 4ef90d7..a7740f4 100755 --- a/bin/camera_test.py +++ b/bin/camera_test.py @@ -244,11 +244,12 @@ class CameraTest: supported_resolutions = {} for i in range(caps.get_size()): key = caps.get_structure(i).get_int('width').value - try: - supported_resolutions[key].add( - caps.get_structure(i).get_int('height').value) - except KeyError: + if key not in supported_resolutions.keys(): supported_resolutions[key] = set() + supported_resolutions[key].add( + caps.get_structure(i).get_int('height').value) + if not supported_resolutions: + raise SystemExit("No supported resolutions found!") width = min(supported_resolutions.keys(), key=lambda x: abs(x - self._width)) height = min(supported_resolutions[width], |