mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-04 21:48:17 +00:00
chore(core): add missing parameter to set_brightness function
This commit is contained in:
parent
05f464f406
commit
217dd8c817
1
core/.changelog.d/4410.fixed
Normal file
1
core/.changelog.d/4410.fixed
Normal file
@ -0,0 +1 @@
|
|||||||
|
Add optional value parameter in brightness setting flow.
|
@ -4,7 +4,7 @@ if TYPE_CHECKING:
|
|||||||
from trezor.messages import SetBrightness, Success
|
from trezor.messages import SetBrightness, Success
|
||||||
|
|
||||||
|
|
||||||
async def set_brightness(_msg: SetBrightness) -> Success:
|
async def set_brightness(msg: SetBrightness) -> Success:
|
||||||
import storage.device as storage_device
|
import storage.device as storage_device
|
||||||
from trezor.messages import Success
|
from trezor.messages import Success
|
||||||
from trezor.ui.layouts import set_brightness
|
from trezor.ui.layouts import set_brightness
|
||||||
@ -13,5 +13,5 @@ async def set_brightness(_msg: SetBrightness) -> Success:
|
|||||||
if not storage_device.is_initialized():
|
if not storage_device.is_initialized():
|
||||||
raise NotInitialized("Device is not initialized")
|
raise NotInitialized("Device is not initialized")
|
||||||
|
|
||||||
await set_brightness()
|
await set_brightness(msg.value)
|
||||||
return Success(message="Settings applied")
|
return Success(message="Settings applied")
|
||||||
|
@ -424,13 +424,32 @@ def test_label_too_long(client: Client):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.models(skip=["legacy", "safe3"])
|
@pytest.mark.models(skip=["legacy", "safe3"])
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"value",
|
||||||
|
[
|
||||||
|
pytest.param(None, id="none_default"),
|
||||||
|
pytest.param(
|
||||||
|
-1,
|
||||||
|
marks=pytest.mark.xfail(),
|
||||||
|
id="negative_value",
|
||||||
|
),
|
||||||
|
pytest.param(0, id="0_min_value"),
|
||||||
|
pytest.param(128, id="128"),
|
||||||
|
pytest.param(255, id="255_max_value"),
|
||||||
|
pytest.param(
|
||||||
|
256,
|
||||||
|
marks=pytest.mark.xfail(),
|
||||||
|
id="256_too_high",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
@pytest.mark.setup_client(pin=None)
|
@pytest.mark.setup_client(pin=None)
|
||||||
def test_set_brightness(client: Client):
|
def test_set_brightness(client: Client, value: int | None):
|
||||||
with client:
|
with client:
|
||||||
assert (
|
assert (
|
||||||
device.set_brightness(
|
device.set_brightness(
|
||||||
client,
|
client,
|
||||||
None,
|
value,
|
||||||
)
|
)
|
||||||
== "Settings applied"
|
== "Settings applied"
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user