2014-01-07 20:59:24 |
kevin gunn |
description |
Unity does not process events from evdev device created before unity is restarted (i.e. in autopilot tests)
Brief:
In an autopilot test if you have a touch device object, launch unity, do some tapping/dragging, stop unity, start it again the same created device will have no effect on the new unity.
(i.e. attempt to swipe greeter will fail)
* To reproduce using python shell:
(Have 2 terminals, both on the device(ssh/adb shell); one for python shell the other for starting/stopping unity)
1. Make sure unity8 is running on the device
2. In the python shell execute:
from autopilot.input import Touch
touch = Touch.create()
touch.drag(717,669,144,669) # assuming maguro, but some movement will happen regardless
3. You will see the greeter disappear/dash move/some movement.
4. Restart unity (without restarting the python shell)
stop unity8
start unity8
5. Back in the python terminal, re-execute the drag:
touch.drag(717,669,144,669)
6. Nothing will happen to unity (no greeter movement etc.)
7. (Work around) Re-create the device to get movement back (in python terminal):
from autopilot.input import _uinput
_uinput._touch_device = _uinput.create_touch_device()
touch.drag(717,669,144,669) # Movement happens again.
7b. Or you can kill the python shell and do the pythno steps from scratch, but that just does `_uinput.create_touch_device()` again
* To reproduce using autopilot:
Any test after the first fails due to input not being processed by the evdev device that was created before unity8 is started.
# Run at least 2 tests:
$ autopilot run -v unity8.shell.tests.test_hud.TestHud.test_show_hud_appears unity8.shell.tests.test_hud.TestHud.test_hide_hud_dragging
The second test will fail due to failing to swipe the greeter away.
* Extra details:
If I add extra logging:
$ initctl set-env MIR_SERVER_INPUT_REPORT=log
$ initctl set-env MIR_SERVER_LEGACY_INPUT_REPORT=log
I see details in the logs (~/.cache/upstart/unity8.log) when the drag is attempted:
...
[II, input] Received event (when, type, code, value) from kernel: (1381464336335967000ns, 3, 54, 621)
[II, input] Received event (when, type, code, value) from kernel: (1381464336335967000ns, 0, 0, 0)
[II, input] Published motion event (seq_id, event_time) to fd 65: (305, 1381464336335967000)
[II, input] Received event finished (seq_id) from fd 65: 305
...
But nothing happens on the screen (I am able to manually swipe the screen).
* Workaround
A work around is to add this to the test setup:
from autopilot.input import _uinput
_uinput._touch_device = _uinput.create_touch_device()
Which forces the creation of a new device for this specific test run and instance of unity. |
Unity does not process events from evdev device created before unity is restarted (i.e. in autopilot tests)
Brief:
In an autopilot test if you have a touch device object, launch unity, do some tapping/dragging, stop unity, start it again the same created device will have no effect on the new unity.
(i.e. attempt to swipe greeter will fail)
* To reproduce using python shell:
(Have 2 terminals, both on the device(ssh/adb shell); one for python shell the other for starting/stopping unity)
1. Make sure unity8 is running on the device
2. In the python shell execute:
from autopilot.input import Touch
touch = Touch.create()
touch.drag(717,669,144,669) # assuming maguro, but some movement will happen regardless
3. You will see the greeter disappear/dash move/some movement.
4. Restart unity (without restarting the python shell)
stop unity8
start unity8
5. Back in the python terminal, re-execute the drag:
touch.drag(717,669,144,669)
6. Nothing will happen to unity (no greeter movement etc.)
7. (Work around) Re-create the device to get movement back (in python terminal):
from autopilot.input import _uinput
_uinput._touch_device = _uinput.create_touch_device()
touch.drag(717,669,144,669) # Movement happens again.
7b. Or you can kill the python shell and do the pythno steps from scratch, but that just does `_uinput.create_touch_device()` again
* To reproduce using autopilot:
Any test after the first fails due to input not being processed by the evdev device that was created before unity8 is started.
# Run at least 2 tests:
$ autopilot run -v unity8.shell.tests.test_hud.TestHud.test_show_hud_appears unity8.shell.tests.test_hud.TestHud.test_hide_hud_dragging
The second test will fail due to failing to swipe the greeter away.
* Extra details:
If I add extra logging:
$ initctl set-env MIR_SERVER_INPUT_REPORT=log
$ initctl set-env MIR_SERVER_LEGACY_INPUT_REPORT=log
I see details in the logs (~/.cache/upstart/unity8.log) when the drag is attempted:
...
[II, input] Received event (when, type, code, value) from kernel: (1381464336335967000ns, 3, 54, 621)
[II, input] Received event (when, type, code, value) from kernel: (1381464336335967000ns, 0, 0, 0)
[II, input] Published motion event (seq_id, event_time) to fd 65: (305, 1381464336335967000)
[II, input] Received event finished (seq_id) from fd 65: 305
...
But nothing happens on the screen (I am able to manually swipe the screen).
* Workaround
A work around is to add this to the test setup:
from autopilot.input import _uinput
_uinput._touch_device = _uinput.create_touch_device()
Which forces the creation of a new device for this specific test run and instance of unity.
related https://bugs.launchpad.net/mir/+bug/1237784 |
|