tablet_rotation =============== **Source code:** `tablet_rotation.py `_ Tests screen rotation through ChromeOS and accelerometer data. Description ----------- Tests that the accelerometer data matches the orientation when the device is physically rotated. Test Procedure -------------- 1. A picture would be shown on the screen. Operator should rotate the tablet to align with the image. This would repeat four times with each orientations, and the test automatically pass when the desired orientation is reached. Dependency ---------- ``chrome.display.system.getInfo`` in Chrome extension to get screen information. Refer to https://developer.chrome.com/apps/system_display for more information. ``cros.factory.device.accelerometer`` is used to determine device orientation. Examples -------- To test screen rotation, and have a timeout of an hour: .. test_list:: generic_ec_component_accel_examples:AccelerometerIMUTests.TabletRotation To provide more parameters for accelerometer when testing: .. test_list:: generic_ec_component_accel_examples:AccelerometerIMUTests. ScreenRotation.TabletRotationAll To test screen rotation for Chrome and prompt operator to flip before and after the test, we can combine the test with `tablet_mode.py <./tablet_mode.html>`_: .. test_list:: generic_ec_component_accel_examples:AccelerometerIMUTests.ScreenRotation Test Arguments -------------- .. list-table:: :widths: 20 10 60 :header-rows: 1 :align: left * - Name - Type - Description * - timeout_secs - int - (optional; default: ``30``) Timeout value for the test. * - degrees_to_orientations - dict - (optional; default: ``{'base': {'0': {'in_accel_x': 0, 'in_accel_y': -1, 'in_accel_z': 0}, '90': {'in_accel_x': 1, 'in_accel_y': 0, 'in_accel_z': 0}, '180': {'in_accel_x': 0, 'in_accel_y': 1, 'in_accel_z': 0}, '270': {'in_accel_x': -1, 'in_accel_y': 0, 'in_accel_z': 0}}, 'lid': {'0': {'in_accel_x': 0, 'in_accel_y': 1, 'in_accel_z': 0}, '90': {'in_accel_x': 1, 'in_accel_y': 0, 'in_accel_z': 0}, '180': {'in_accel_x': 0, 'in_accel_y': -1, 'in_accel_z': 0}, '270': {'in_accel_x': -1, 'in_accel_y': 0, 'in_accel_z': 0}}}``) The keys should be "base" or "lid", which are the locations of the accelerometer. And each value is a dict of (key, value) pair as follows: Keys: degrees of the orientations, ["0", "90", "180", "270"]. Values: a dictionary containing orientation configuration. Keys should be the name of the accelerometer signal. The possible keys are "in_accel_(x|y|z)". Values should be one of [0, 1, -1], representing the ideal value for gravity under such orientation. * - spec_offset - list - (optional; default: ``[1, 1]``) Two numbers, ex: [1.5, 1.5] indicating the tolerance for the digital output of sensors under zero gravity and one gravity. * - sample_rate_hz - int - (optional; default: ``200``) The sample rate in Hz to get raw data from accelerometers. * - mode - ['animation', 'classic'] - (optional; default: ``'classic'``) The mode for showing instruction of the test