mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-12 00:10:58 +00:00
core: fix artifacts in click-based UI tests
This commit is contained in:
parent
a9d8fd3992
commit
70f67883c5
@ -49,6 +49,13 @@ class Lockscreen(HomescreenBase):
|
|||||||
# and paint it.
|
# and paint it.
|
||||||
ui.display.clear()
|
ui.display.clear()
|
||||||
self.on_render()
|
self.on_render()
|
||||||
|
|
||||||
|
if __debug__ and self.should_notify_layout_change:
|
||||||
|
from apps.debug import notify_layout_change
|
||||||
|
|
||||||
|
self.should_notify_layout_change = False
|
||||||
|
notify_layout_change(self)
|
||||||
|
|
||||||
ui.refresh()
|
ui.refresh()
|
||||||
ui.backlight_fade(ui.BACKLIGHT_LOW)
|
ui.backlight_fade(ui.BACKLIGHT_LOW)
|
||||||
# long sleep
|
# long sleep
|
||||||
|
@ -310,6 +310,12 @@ class Layout(Component):
|
|||||||
Run the layout and wait until it completes. Returns the result value.
|
Run the layout and wait until it completes. Returns the result value.
|
||||||
Usually not overridden.
|
Usually not overridden.
|
||||||
"""
|
"""
|
||||||
|
if __debug__:
|
||||||
|
# we want to call notify_layout_change() when the rendering is done;
|
||||||
|
# but only the first time the layout is awaited. Here we indicate that we
|
||||||
|
# are being awaited, and in handle_rendering() we send the appropriate event
|
||||||
|
self.should_notify_layout_change = True
|
||||||
|
|
||||||
value = None
|
value = None
|
||||||
try:
|
try:
|
||||||
# If any other layout is running (waiting on the layout channel),
|
# If any other layout is running (waiting on the layout channel),
|
||||||
@ -322,8 +328,6 @@ class Layout(Component):
|
|||||||
# layout channel. This allows other layouts to cancel us, and the
|
# layout channel. This allows other layouts to cancel us, and the
|
||||||
# layout tasks to trigger restart by exiting (new tasks are created
|
# layout tasks to trigger restart by exiting (new tasks are created
|
||||||
# and we continue, because we are in a loop).
|
# and we continue, because we are in a loop).
|
||||||
if __debug__:
|
|
||||||
notify_layout_change(self)
|
|
||||||
while True:
|
while True:
|
||||||
await loop.race(layout_chan.take(), *self.create_tasks())
|
await loop.race(layout_chan.take(), *self.create_tasks())
|
||||||
except Result as result:
|
except Result as result:
|
||||||
@ -365,6 +369,14 @@ class Layout(Component):
|
|||||||
display.clear()
|
display.clear()
|
||||||
self.dispatch(REPAINT, 0, 0)
|
self.dispatch(REPAINT, 0, 0)
|
||||||
self.dispatch(RENDER, 0, 0)
|
self.dispatch(RENDER, 0, 0)
|
||||||
|
|
||||||
|
if __debug__ and self.should_notify_layout_change:
|
||||||
|
# notify about change and do not notify again until next await.
|
||||||
|
# (handle_rendering might be called multiple times in a single await,
|
||||||
|
# because of the endless loop in __iter__)
|
||||||
|
self.should_notify_layout_change = False
|
||||||
|
notify_layout_change(self)
|
||||||
|
|
||||||
# Display is usually refreshed after every loop step, but here we are
|
# Display is usually refreshed after every loop step, but here we are
|
||||||
# rendering everything synchronously, so refresh it manually and turn
|
# rendering everything synchronously, so refresh it manually and turn
|
||||||
# the brightness on again.
|
# the brightness on again.
|
||||||
|
@ -48,7 +48,7 @@ def test_reset_slip39_advanced_2of2groups_2of2shares(device_handler):
|
|||||||
reset.confirm_wait(debug, "Create new wallet")
|
reset.confirm_wait(debug, "Create new wallet")
|
||||||
|
|
||||||
# confirm back up
|
# confirm back up
|
||||||
reset.confirm_wait(debug, "Success")
|
reset.confirm_read(debug, "Success")
|
||||||
|
|
||||||
# confirm checklist
|
# confirm checklist
|
||||||
reset.confirm_read(debug, "Checklist")
|
reset.confirm_read(debug, "Checklist")
|
||||||
@ -130,7 +130,7 @@ def test_reset_slip39_advanced_16of16groups_16of16shares(device_handler):
|
|||||||
reset.confirm_wait(debug, "Create new wallet")
|
reset.confirm_wait(debug, "Create new wallet")
|
||||||
|
|
||||||
# confirm back up
|
# confirm back up
|
||||||
reset.confirm_wait(debug, "Success")
|
reset.confirm_read(debug, "Success")
|
||||||
|
|
||||||
# confirm checklist
|
# confirm checklist
|
||||||
reset.confirm_read(debug, "Checklist")
|
reset.confirm_read(debug, "Checklist")
|
||||||
|
@ -48,7 +48,7 @@ def test_reset_slip39_basic_1of1(device_handler):
|
|||||||
reset.confirm_wait(debug, "Create new wallet")
|
reset.confirm_wait(debug, "Create new wallet")
|
||||||
|
|
||||||
# confirm back up
|
# confirm back up
|
||||||
reset.confirm_wait(debug, "Success")
|
reset.confirm_read(debug, "Success")
|
||||||
|
|
||||||
# confirm checklist
|
# confirm checklist
|
||||||
reset.confirm_read(debug, "Checklist")
|
reset.confirm_read(debug, "Checklist")
|
||||||
@ -120,7 +120,7 @@ def test_reset_slip39_basic_16of16(device_handler):
|
|||||||
reset.confirm_wait(debug, "Create new wallet")
|
reset.confirm_wait(debug, "Create new wallet")
|
||||||
|
|
||||||
# confirm back up
|
# confirm back up
|
||||||
reset.confirm_wait(debug, "Success")
|
reset.confirm_read(debug, "Success")
|
||||||
|
|
||||||
# confirm checklist
|
# confirm checklist
|
||||||
reset.confirm_read(debug, "Checklist")
|
reset.confirm_read(debug, "Checklist")
|
||||||
|
@ -73,9 +73,11 @@ def do_recover_core(client, mnemonic, **kwargs):
|
|||||||
|
|
||||||
yield
|
yield
|
||||||
for word in mnemonic:
|
for word in mnemonic:
|
||||||
|
client.debug.wait_layout()
|
||||||
client.debug.input(word)
|
client.debug.input(word)
|
||||||
|
|
||||||
yield
|
yield
|
||||||
|
client.debug.wait_layout()
|
||||||
client.debug.click(buttons.OK)
|
client.debug.click(buttons.OK)
|
||||||
|
|
||||||
with client:
|
with client:
|
||||||
|
Loading…
Reference in New Issue
Block a user