mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-08-01 11:28:20 +00:00
fix(core/debug): send current layout contents after watch_layout()
This should make tests more deterministic as previously whether homescreen contents were sent or not was dependent on timing. [no changelog]
This commit is contained in:
parent
305d8c399a
commit
877aea9f8b
@ -102,6 +102,7 @@ if __debug__:
|
|||||||
|
|
||||||
async def return_layout_change() -> None:
|
async def return_layout_change() -> None:
|
||||||
content = await layout_change_chan.take()
|
content = await layout_change_chan.take()
|
||||||
|
layout_change_chan.putters.clear()
|
||||||
assert DEBUG_CONTEXT is not None
|
assert DEBUG_CONTEXT is not None
|
||||||
if storage.layout_watcher is LAYOUT_WATCHER_LAYOUT:
|
if storage.layout_watcher is LAYOUT_WATCHER_LAYOUT:
|
||||||
await DEBUG_CONTEXT.write(DebugLinkLayout(lines=content))
|
await DEBUG_CONTEXT.write(DebugLinkLayout(lines=content))
|
||||||
@ -126,6 +127,9 @@ if __debug__:
|
|||||||
if msg.watch:
|
if msg.watch:
|
||||||
await ui.wait_until_layout_is_running()
|
await ui.wait_until_layout_is_running()
|
||||||
storage.watch_layout_changes = bool(msg.watch)
|
storage.watch_layout_changes = bool(msg.watch)
|
||||||
|
if msg.watch and ui.RUNNING_LAYOUT:
|
||||||
|
ui.RUNNING_LAYOUT.should_notify_layout_change = False
|
||||||
|
notify_layout_change(ui.RUNNING_LAYOUT)
|
||||||
log.debug(__name__, "Watch layout changes: %s", storage.watch_layout_changes)
|
log.debug(__name__, "Watch layout changes: %s", storage.watch_layout_changes)
|
||||||
return Success()
|
return Success()
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ if __debug__:
|
|||||||
class RustLayout(ui.Layout):
|
class RustLayout(ui.Layout):
|
||||||
# pylint: disable=super-init-not-called
|
# pylint: disable=super-init-not-called
|
||||||
def __init__(self, layout: Any, is_backup: bool = False):
|
def __init__(self, layout: Any, is_backup: bool = False):
|
||||||
|
super().__init__()
|
||||||
self.layout = layout
|
self.layout = layout
|
||||||
self.timer = loop.Timer()
|
self.timer = loop.Timer()
|
||||||
self.layout.attach_timer_fn(self.set_timer)
|
self.layout.attach_timer_fn(self.set_timer)
|
||||||
|
@ -141,6 +141,10 @@ if __debug__:
|
|||||||
PROTOBUF_BUFFER_SIZE_DEBUG = 1024
|
PROTOBUF_BUFFER_SIZE_DEBUG = 1024
|
||||||
WIRE_BUFFER_DEBUG = bytearray(PROTOBUF_BUFFER_SIZE_DEBUG)
|
WIRE_BUFFER_DEBUG = bytearray(PROTOBUF_BUFFER_SIZE_DEBUG)
|
||||||
|
|
||||||
|
if __debug__:
|
||||||
|
PROTOBUF_BUFFER_SIZE_DEBUG = 1024
|
||||||
|
WIRE_BUFFER_DEBUG = bytearray(PROTOBUF_BUFFER_SIZE_DEBUG)
|
||||||
|
|
||||||
|
|
||||||
class Context:
|
class Context:
|
||||||
def __init__(self, iface: WireInterface, sid: int, buffer: bytearray) -> None:
|
def __init__(self, iface: WireInterface, sid: int, buffer: bytearray) -> None:
|
||||||
|
@ -705,6 +705,14 @@ class TrezorClientDebugLink(TrezorClient):
|
|||||||
# - TT < 2.3.0 does not reply to unknown debuglink messages due to a bug
|
# - TT < 2.3.0 does not reply to unknown debuglink messages due to a bug
|
||||||
self.debug.watch_layout(watch)
|
self.debug.watch_layout(watch)
|
||||||
|
|
||||||
|
if self.version >= (2, 5, 2) and watch:
|
||||||
|
first_layout = self.debug.wait_layout()
|
||||||
|
assert(any(hs in first_layout.text) for hs in (
|
||||||
|
"Homescreen",
|
||||||
|
"Lockscreen",
|
||||||
|
"RecoveryHomescreen",
|
||||||
|
))
|
||||||
|
|
||||||
def __enter__(self) -> "TrezorClientDebugLink":
|
def __enter__(self) -> "TrezorClientDebugLink":
|
||||||
# For usage in with/expected_responses
|
# For usage in with/expected_responses
|
||||||
if self.in_with_statement:
|
if self.in_with_statement:
|
||||||
|
@ -178,8 +178,6 @@ VECTORS_MULTISIG = ( # script_type, bip48_type, address, xpubs, ignore_xpub_mag
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# NOTE: contains wait_layout race that manifests on hw sometimes
|
|
||||||
@pytest.mark.flaky(max_runs=5)
|
|
||||||
@pytest.mark.skip_t1
|
@pytest.mark.skip_t1
|
||||||
@pytest.mark.multisig
|
@pytest.mark.multisig
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
@ -328,7 +328,7 @@ def test_signmessage_pagination(client: Client, message: str):
|
|||||||
|
|
||||||
with client:
|
with client:
|
||||||
client.set_input_flow(input_flow)
|
client.set_input_flow(input_flow)
|
||||||
client.debug.watch_layout(True)
|
client.watch_layout()
|
||||||
btc.sign_message(
|
btc.sign_message(
|
||||||
client,
|
client,
|
||||||
coin_name="Bitcoin",
|
coin_name="Bitcoin",
|
||||||
|
Loading…
Reference in New Issue
Block a user