diff options
-rwxr-xr-x | bin/rotation_test | 59 | ||||
-rw-r--r-- | units/camera/jobs.pxu | 2 | ||||
-rw-r--r-- | units/usb/test-plan.pxu | 1 | ||||
-rw-r--r-- | units/usb/usb-c.pxu | 1 |
4 files changed, 19 insertions, 44 deletions
diff --git a/bin/rotation_test b/bin/rotation_test index 258a881..6bf90fd 100755 --- a/bin/rotation_test +++ b/bin/rotation_test @@ -5,14 +5,14 @@ # # This file is part of Checkbox. # -# Copyright 2012 Canonical Ltd. +# Copyright 2012-2019 Canonical Ltd. # # Authors: Alberto Milone <alberto.milone@canonical.com> +# Maciej Kisielewski <maciej.kisielewski@canonical.com> # # Checkbox is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3, # as published by the Free Software Foundation. - # # Checkbox is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -22,53 +22,24 @@ # You should have received a copy of the GNU General Public License # along with Checkbox. If not, see <http://www.gnu.org/licenses/>. +import gi import time -import sys - -from checkbox_support.contrib import xrandr - +import subprocess -def rotate_screen(rotation): - # Refresh the screen. Required by NVIDIA - screen = xrandr.get_current_screen() - screen.set_rotation(rotation) - return screen.apply_config() +gi.require_version('Gdk', '3.0') +from gi.repository import Gdk def main(): - screen = xrandr.get_current_screen() - rotations = {'normal': xrandr.RR_ROTATE_0, - 'right': xrandr.RR_ROTATE_90, - 'inverted': xrandr.RR_ROTATE_180, - 'left': xrandr.RR_ROTATE_270} - rots_statuses = {} - - for rot in rotations: - try: - status = rotate_screen(rotations[rot]) - except (xrandr.RRError, xrandr.UnsupportedRRError) as exc: - status = 1 - error = exc - else: - error = 'N/A' - # Collect the status and the error message - rots_statuses[rot] = (status, error) + """Run rotation cycling by running xrandr command.""" + screen = Gdk.Screen.get_default() + output = screen.get_monitor_plug_name(screen.get_primary_monitor()) + print("Using output: {}".format(output)) + + for rotation in ['right', 'inverted', 'left', 'normal']: + print("Changing rotation to: {}".format(rotation)) + subprocess.check_call( + ['xrandr', '--output', output, '--rotation', rotation]) time.sleep(4) - # Try to set the screen back to normal - try: - rotate_screen(xrandr.RR_ROTATE_0) - except(xrandr.RRError, xrandr.UnsupportedRRError) as error: - print(error) - - result = 0 - for elem in rots_statuses: - status = rots_statuses.get(elem)[0] - error = rots_statuses.get(elem)[1] - if status != 0: - print('Error: rotation "%s" failed with status %d: %s.' % - (elem, status, error), file=sys.stderr) - result = 1 - return result - if __name__ == '__main__': exit(main()) diff --git a/units/camera/jobs.pxu b/units/camera/jobs.pxu index b1e4b9c..0605d18 100644 --- a/units/camera/jobs.pxu +++ b/units/camera/jobs.pxu @@ -15,6 +15,7 @@ template-unit: job plugin: user-interact-verify category_id: com.canonical.plainbox::camera id: camera/display_{name} +flags: also-after-suspend-manual _summary: Webcam video display test for {product_slug} estimated_duration: 120.0 depends: camera/detect @@ -57,6 +58,7 @@ plugin: user-interact-verify template-engine: jinja2 category_id: com.canonical.plainbox::camera id: camera/still_{{ name }} +flags: also-after-suspend-manual _summary: Webcam still image capture test for {{ product_slug }} estimated_duration: 120.0 depends: camera/detect diff --git a/units/usb/test-plan.pxu b/units/usb/test-plan.pxu index 63c62b8..e6a9165 100644 --- a/units/usb/test-plan.pxu +++ b/units/usb/test-plan.pxu @@ -102,6 +102,7 @@ include: after-suspend-manual-usb-c/insert certification-status=blocker after-suspend-manual-usb-c/storage-automated certification-status=blocker after-suspend-manual-usb-c/remove certification-status=blocker + after-suspend-manual-usb-c/c-to-ethernet-adapter-insert id: usb-cert-blockers unit: test plan diff --git a/units/usb/usb-c.pxu b/units/usb/usb-c.pxu index cf7c5f6..0d709e2 100644 --- a/units/usb/usb-c.pxu +++ b/units/usb/usb-c.pxu @@ -189,6 +189,7 @@ estimated_duration: 30 id: usb-c/c-to-ethernet-adapter-insert plugin: user-interact +flags: also-after-suspend-manual category_id: com.canonical.plainbox::usb imports: from com.canonical.plainbox import manifest requires: manifest.has_usb_type_c == 'True' |