stylus ====== **Source code:** `stylus.py `_ Test stylus functionality. Description ----------- Verifies if stylus is functional by asking operator to draw specified lines or shapes using stylus. For EMR stylus, drawing a diagonal line from left-bottom to right-top corner should be sufficient to validate all scan lines. But for clamshells with hall sensor, the magnet may cause EMR stylus to be non-functional in particular area. To test that, set argument `endpoints_ratio` to build the lines for operator to draw. Test Procedure -------------- 1. When started, a diagonal line is displayed on screen. 2. Operator must use stylus to draw and follow the displayed line. 3. If the stylus moved too far (specified in argument `error_margin`) from the requested path, test will fail. Dependency ---------- - Based on Linux evdev. Examples -------- To check stylus functionality by drawing a diagonal line, add this in test list: .. test_list:: generic_touchscreen_examples:TouchscreenTests.Stylus To check if the magnet in left side will cause problems, add this in test list to draw a line from left-top to left-bottom: .. test_list:: generic_touchscreen_examples:TouchscreenTests.StylusTopLeftToBottomLeft Test Arguments -------------- .. list-table:: :widths: 20 10 60 :header-rows: 1 :align: left * - Name - Type - Description * - device_filter - int, str, list, None - (optional; default: ``None``) Stylus input event id, evdev name, or evdev events. * - error_margin - int - (optional; default: ``25``) Maximum tolerable distance to the diagonal line (in pixel). * - begin_ratio - float - (optional; default: ``0.01``) The beginning position of the diagonal line segment to check. Should be in (0, 1). * - end_ratio - float - (optional; default: ``0.99``) The ending position of the diagonal line segment to check. Should be in (0, 1). * - step_ratio - float - (optional; default: ``0.01``) If the distance between an input event to the latest accepted input event is larger than this size, it would be ignored. Should be in (0, 1). * - endpoints_ratio - list - (optional; default: ``[[0, 1], [1, 0]]``) A list of two pairs, each pair contains the X and Y coordinates ratio of an endpoint of the line segment for operator to draw. Both endpoints must be on the border (e.g., X=0 or X=1 or Y=0 or Y=1). * - autostart - bool - (optional; default: ``False``) Starts the test automatically without prompting. Operators can still press ESC to fail the test. * - flush_interval - float - (optional; default: ``0.1``) The time interval of flushing event buffers. * - angle_compensation - ['angle_0', 'angle_180', 'angle_270', 'angle_90'] - (optional; default: ``0``) Specify a degree to compensate the orientation difference between panel and system in counter-clockwise direction. It is used when panel scanout is different from default system orientation, i.e., a angle difference between the instruction line displayed on screen and the position read from evdev.