mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-27 01:48:17 +00:00
fix(core): fix broken flow for changing brightness [no changelog] (#4378)
* fix(core): fix broken flow for changing brightness [no changelog] * fixup! fix(core): fix broken flow for changing brightness [no changelog] * fixup! fix(core): fix broken flow for changing brightness [no changelog] * fixup! fix(core): fix broken flow for changing brightness [no changelog] * fixup! fix(core): fix broken flow for changing brightness [no changelog] * fixup! fix(core): fix broken flow for changing brightness [no changelog]
This commit is contained in:
parent
6f7fccaac2
commit
ebc302959b
@ -64,7 +64,8 @@ impl FlowController for SetBrightness {
|
||||
|
||||
static BRIGHTNESS: AtomicU8 = AtomicU8::new(0);
|
||||
|
||||
pub fn new_set_brightness(brightness: u8) -> Result<SwipeFlow, Error> {
|
||||
pub fn new_set_brightness(brightness: Option<u8>) -> Result<SwipeFlow, Error> {
|
||||
let brightness = brightness.unwrap_or(theme::backlight::get_backlight_normal());
|
||||
let content_slider = Frame::left_aligned(
|
||||
TR::brightness__title.into(),
|
||||
NumberInputSliderDialog::new(
|
||||
@ -122,6 +123,7 @@ pub fn new_set_brightness(brightness: u8) -> Result<SwipeFlow, Error> {
|
||||
)
|
||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||
.with_result_icon(theme::ICON_BULLET_CHECKMARK, theme::GREEN_LIGHT)
|
||||
.map(move |_msg| Some(FlowMsg::Confirmed));
|
||||
|
||||
let res = SwipeFlow::new(&SetBrightness::Slider)?
|
||||
|
@ -671,7 +671,7 @@ extern "C" fn new_confirm_summary(n_args: usize, args: *const Obj, kwargs: *mut
|
||||
|
||||
extern "C" fn new_set_brightness(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
||||
let block = move |_args: &[Obj], kwargs: &Map| {
|
||||
let current: u8 = kwargs.get(Qstr::MP_QSTR_current)?.try_into()?;
|
||||
let current: Option<u8> = kwargs.get(Qstr::MP_QSTR_current)?.try_into_option()?;
|
||||
let flow = flow::set_brightness::new_set_brightness(current)?;
|
||||
Ok(LayoutObj::new_root(flow)?.into())
|
||||
};
|
||||
|
@ -421,3 +421,16 @@ def test_label_too_long(client: Client):
|
||||
with pytest.raises(exceptions.TrezorFailure), client:
|
||||
client.set_expected_responses([messages.Failure])
|
||||
device.apply_settings(client, label="A" * 33)
|
||||
|
||||
|
||||
@pytest.mark.models(skip=["legacy", "safe3"])
|
||||
@pytest.mark.setup_client(pin=None)
|
||||
def test_set_brightness(client: Client):
|
||||
with client:
|
||||
assert (
|
||||
device.set_brightness(
|
||||
client,
|
||||
None,
|
||||
)
|
||||
== "Settings applied"
|
||||
)
|
||||
|
@ -2356,6 +2356,7 @@
|
||||
"T2T1_cs_test_msg_applysettings.py::test_experimental_features": "4ea1bd8c93443f466eaa6174b22ea3af1041fff34553ea0185cd22331bff9aeb",
|
||||
"T2T1_cs_test_msg_applysettings.py::test_label_too_long": "32d380b2c0942f8a2ab6a32e0e4c8a2ad2ab6750ee39c6fa4d4f0bacf59a4b7c",
|
||||
"T2T1_cs_test_msg_applysettings.py::test_safety_checks": "50a70f14d4c8f4ad4ec469330223a5ddd713a2287d0f8b117d288f6bad8aa4ad",
|
||||
"T2T1_cs_test_msg_applysettings.py::test_set_brightness": "56633879f5ab9af18092dd005fd47aa5a93b44222994930d87c9521ac8f9f417",
|
||||
"T2T1_cs_test_msg_backup_device.py::test_backup_bip39": "7177c4850b85fafd6938e86c99cc83543d1fb0b02b660fc74071b1e0da3955b9",
|
||||
"T2T1_cs_test_msg_backup_device.py::test_backup_slip39_advanced[click_info]": "02402b8e1fb11140cd9fec5589df93d986828f06b7591abc5a74e7c003b6e419",
|
||||
"T2T1_cs_test_msg_backup_device.py::test_backup_slip39_advanced[no_click_info]": "b25925a792ad91a713963db8b4b112683b8158dc36314b8220b3f5b653840ba1",
|
||||
@ -3801,6 +3802,7 @@
|
||||
"T2T1_de_test_msg_applysettings.py::test_experimental_features": "3819fda3d5edc48c81bcc15ccc3a84b1b3d3563c47673c91b86bd3c397e90ac5",
|
||||
"T2T1_de_test_msg_applysettings.py::test_label_too_long": "a3edf3ced8fa1fa6b9f67f869a28bc880ce5e214b0adfaf839cd867875845912",
|
||||
"T2T1_de_test_msg_applysettings.py::test_safety_checks": "b529797883a83618a97c2c5043b4c6133084bde410fedcfb3c637850d330af37",
|
||||
"T2T1_de_test_msg_applysettings.py::test_set_brightness": "e571ae5252b2451f895017250b4f990439405daf024ac95db1d75866a707e64f",
|
||||
"T2T1_de_test_msg_backup_device.py::test_backup_bip39": "c6e0fb7406e55d781f344bca65e40fcf6809598abb0fffa3d5035428dd83c3d9",
|
||||
"T2T1_de_test_msg_backup_device.py::test_backup_slip39_advanced[click_info]": "aa0d299fe68a62670d02d7ffc7e8f50ea656d8342d5868aabeb0499878786bfa",
|
||||
"T2T1_de_test_msg_backup_device.py::test_backup_slip39_advanced[no_click_info]": "568b5e25d5aae594a88a6d7e49574b80b0e0df596306f8ab92c0152377d42a7d",
|
||||
@ -5246,6 +5248,7 @@
|
||||
"T2T1_en_test_msg_applysettings.py::test_experimental_features": "5c82db1025af207c81aa9c8ecacceab148dbc8202642b75f16215b128392f510",
|
||||
"T2T1_en_test_msg_applysettings.py::test_label_too_long": "8b1ccc0dbd6e6e3d02a896650ab90dd332ba4edbbcc4095e0fbb6a96e5256f75",
|
||||
"T2T1_en_test_msg_applysettings.py::test_safety_checks": "b9b9aec8a5789794ae4cae7bb96b286451a017096db804ce182fece10122caff",
|
||||
"T2T1_en_test_msg_applysettings.py::test_set_brightness": "6dbb950febdafc731112225c8059f2a7079b92201378a470376126dc5330b2b6",
|
||||
"T2T1_en_test_msg_backup_device.py::test_backup_bip39": "90baa1b711bf16f0a3f7bd47dfe18e31da476689d601e6c74aa578a1836561f2",
|
||||
"T2T1_en_test_msg_backup_device.py::test_backup_slip39_advanced[click_info]": "96da39b91f26d1620bb5a3f678f5db99e9ea5dfb921ff2e8c2bae2195754f013",
|
||||
"T2T1_en_test_msg_backup_device.py::test_backup_slip39_advanced[no_click_info]": "726e801238c70be4311f9dd6f1c997f8f22e8559e145574520de3dd199d7566d",
|
||||
@ -6709,6 +6712,7 @@
|
||||
"T2T1_es_test_msg_applysettings.py::test_experimental_features": "9ec2220dafa73942c7cbe3b4a607ad5bdc10dc69cdf78eb9ab883db499801569",
|
||||
"T2T1_es_test_msg_applysettings.py::test_label_too_long": "1775658fa541fff7933453c1d346449c492079a39341e07135ac9e7662b3bbd3",
|
||||
"T2T1_es_test_msg_applysettings.py::test_safety_checks": "be9f862506c7ba461264c422824780c99143392acd4fea6e32a4230bee37a971",
|
||||
"T2T1_es_test_msg_applysettings.py::test_set_brightness": "c749543213a9beef6c9d3cc49292e26d01b81f2c0b72fdceec4a06fc4a002eda",
|
||||
"T2T1_es_test_msg_backup_device.py::test_backup_bip39": "1c5d1685e8d267eaee82da5bc4205dfae0bb9110582be5a68c1f530aa5cda79e",
|
||||
"T2T1_es_test_msg_backup_device.py::test_backup_slip39_advanced[click_info]": "19decb593b40963860ede092ed94b7fc5052c2efb738a58c83d9dc5780c7bbdb",
|
||||
"T2T1_es_test_msg_backup_device.py::test_backup_slip39_advanced[no_click_info]": "34feea2a5a55b9e4c35aa48ef58652c40c03c5f7c4efd3bf6a06b9f228f5aaaf",
|
||||
@ -8154,6 +8158,7 @@
|
||||
"T2T1_fr_test_msg_applysettings.py::test_experimental_features": "4311f4d42deee3b1fe0040289a10dbfd0b8ec34bfb3bae71747b30e8f2d53cde",
|
||||
"T2T1_fr_test_msg_applysettings.py::test_label_too_long": "94d3ba1cba15b836e6ebc48ab307aeea71275ef2d9849aaabc8e883df555ce3f",
|
||||
"T2T1_fr_test_msg_applysettings.py::test_safety_checks": "f4b7b4ce0c1f40eabd87f12e086ccd8e728ea92d88f99155afb13e80c1418173",
|
||||
"T2T1_fr_test_msg_applysettings.py::test_set_brightness": "12ab88ce94ab3d5485b9bfb30fc5b25166bd2a98443c534b93380ee134a72bdd",
|
||||
"T2T1_fr_test_msg_backup_device.py::test_backup_bip39": "2ce5ed2875f332fe3c6a85a0d8566c8a3467cf70ba3da307e9340ddeceebd547",
|
||||
"T2T1_fr_test_msg_backup_device.py::test_backup_slip39_advanced[click_info]": "3ee5c7d729d73d401bc699869bb683ca976822e97479a4a1b5a8c6a3c56b41e1",
|
||||
"T2T1_fr_test_msg_backup_device.py::test_backup_slip39_advanced[no_click_info]": "39a84ee4d2a65359c8463cb8d0f6127d6fae0a5909228290e5a86feea486c7ee",
|
||||
@ -9599,6 +9604,7 @@
|
||||
"T2T1_pt_test_msg_applysettings.py::test_experimental_features": "8580af0aae6154bfe5760e4e4e8a2cce4aca056c0db116528a0ed337ae1fd5c1",
|
||||
"T2T1_pt_test_msg_applysettings.py::test_label_too_long": "e9e80e1bfd347b598699a7a84deb8932eff90fc5fb8b56771453e06fe3c4c216",
|
||||
"T2T1_pt_test_msg_applysettings.py::test_safety_checks": "9d019f3c13d4c5657efd55620cdfb19e4858ef5a598b83b9dfe3c62e3af49c5b",
|
||||
"T2T1_pt_test_msg_applysettings.py::test_set_brightness": "4cf75c9ebdaa4408d224afe85d3d87b2576a5b49255a9258a4701733e3bc6a23",
|
||||
"T2T1_pt_test_msg_backup_device.py::test_backup_bip39": "8d5441fc0130c49654e0b7335cacb2ca608cb88e8b778b997a33a622a031f8a5",
|
||||
"T2T1_pt_test_msg_backup_device.py::test_backup_slip39_advanced[click_info]": "49db58a712b5248f51c0c49ebace7413d6d66e44997d16fca01fde60d955484d",
|
||||
"T2T1_pt_test_msg_backup_device.py::test_backup_slip39_advanced[no_click_info]": "35d0cd8d6c14bb0e8a406fca86d81529b14c5a6f33601ac5763a3f7b5ac64c8d",
|
||||
@ -19805,6 +19811,7 @@
|
||||
"T3T1_cs_test_msg_applysettings.py::test_experimental_features": "178aa8aa21de385d3560ead0d76fd080d3fa941d156a3fdfb74b90914f2fc1cc",
|
||||
"T3T1_cs_test_msg_applysettings.py::test_label_too_long": "991a101e4cda5811a95f6c57fa316b1665f85c6f29cd7863ab672082ba3cddbb",
|
||||
"T3T1_cs_test_msg_applysettings.py::test_safety_checks": "167195b02152cb06e6eb82af856de859ee0553aac8a0a4a7fa72152690030786",
|
||||
"T3T1_cs_test_msg_applysettings.py::test_set_brightness": "5fc3447984ba20fb1fa586f090315f65c279cb2b7a3bda73c9a13edcea3462b4",
|
||||
"T3T1_cs_test_msg_backup_device.py::test_backup_bip39": "ebecf7e5361f221116296c82e830f7c1feadc56003d06da901bc21ed859e855b",
|
||||
"T3T1_cs_test_msg_backup_device.py::test_backup_slip39_advanced[click_info]": "4c4687dff2713af671d78adcd2ae2addd4988e88e58040333a8836195fb0e7b2",
|
||||
"T3T1_cs_test_msg_backup_device.py::test_backup_slip39_advanced[no_click_info]": "e056d34e5a6e473549b1a9e1a7f29021dcaf3a88b0fa52da2347e7e6d32285d0",
|
||||
@ -21189,6 +21196,7 @@
|
||||
"T3T1_de_test_msg_applysettings.py::test_experimental_features": "94703a726033b725979dbbd11dd25bbd343bdeb94b1fef0781465e4f10c03ca0",
|
||||
"T3T1_de_test_msg_applysettings.py::test_label_too_long": "656c427f48600d0cfc3e3c739f9959f680a8c45686fe503e81bfbf17e39595eb",
|
||||
"T3T1_de_test_msg_applysettings.py::test_safety_checks": "8d3f7492f0f05b1d4a62caefa43c5f16dc3c9b88a9dfe9ccbe928a504b8d8eb4",
|
||||
"T3T1_de_test_msg_applysettings.py::test_set_brightness": "6aa6591955738f2ec3c8666ac5ba0503f4884734ece62ec7dab6fae639cb517a",
|
||||
"T3T1_de_test_msg_backup_device.py::test_backup_bip39": "61c0450c79ab79343eb5e395d62bb74426efbf169178ad772264578b29cc9ae5",
|
||||
"T3T1_de_test_msg_backup_device.py::test_backup_slip39_advanced[click_info]": "007a24bf416e714e09b89c3193fecb8b7fa66574081d64bf0484ebb5a922cfb6",
|
||||
"T3T1_de_test_msg_backup_device.py::test_backup_slip39_advanced[no_click_info]": "bdc53c17a2b492f57820c1a8ba16865f208e3c25bd14a70982136a8fe9e3ac55",
|
||||
@ -22573,6 +22581,7 @@
|
||||
"T3T1_en_test_msg_applysettings.py::test_experimental_features": "ba5ab0d6a9192b724c0af4e3701fa717346c63b2e4cd102d384e3c1876f54606",
|
||||
"T3T1_en_test_msg_applysettings.py::test_label_too_long": "3c5fb7d6110128ed52024a6b92654210b7acad6fe08b568d5238bfceb257a524",
|
||||
"T3T1_en_test_msg_applysettings.py::test_safety_checks": "3b61a97a0616f9ce392361930b500596ead49604bc707f3e403e0d589a150f74",
|
||||
"T3T1_en_test_msg_applysettings.py::test_set_brightness": "d5e21004cc39e9b3e63c2d9202df1a9c515c40cb39bf77b2b5a78005c9aa002f",
|
||||
"T3T1_en_test_msg_backup_device.py::test_backup_bip39": "fc73184b88b78a2323be753a463dcb53ff1fa828562680cb53efa94d5954bf84",
|
||||
"T3T1_en_test_msg_backup_device.py::test_backup_slip39_advanced[click_info]": "3106ab5757a9ffab90f517094a77767c0139b304cd12f14732d51e0a466b9ad7",
|
||||
"T3T1_en_test_msg_backup_device.py::test_backup_slip39_advanced[no_click_info]": "884101bdc943e03c24be576a9240e0686298ef34794733e51eaa8826ca1da2d6",
|
||||
@ -23957,6 +23966,7 @@
|
||||
"T3T1_es_test_msg_applysettings.py::test_experimental_features": "580672bb342f1ca2d0cbb26bf8727f69f8f9cc59b6a5e5171b102b058edff3f0",
|
||||
"T3T1_es_test_msg_applysettings.py::test_label_too_long": "cf6e2f75443a6d0a64227c79d4f7fd3ebe3799697afc90932fbd87108b288f87",
|
||||
"T3T1_es_test_msg_applysettings.py::test_safety_checks": "e774390e9813f03e2e4088bdf5f49b1867489bfe628d9fab0dbb4f64d45cee2b",
|
||||
"T3T1_es_test_msg_applysettings.py::test_set_brightness": "343d1ebe07cac93420c2331b4eb5c146cc6abfe52d74aa0610b0a69f7fdea396",
|
||||
"T3T1_es_test_msg_backup_device.py::test_backup_bip39": "98f361562582b974ef87c65c406d9b49c9cd823790d2e76a584be1c74def39d2",
|
||||
"T3T1_es_test_msg_backup_device.py::test_backup_slip39_advanced[click_info]": "06effb1af878683444696e7f441a4c5dc069a2320d23bfb315321995494325d3",
|
||||
"T3T1_es_test_msg_backup_device.py::test_backup_slip39_advanced[no_click_info]": "fd2cbbb2bebb48d366f1414a6114fa17ea4dc52e6b862ece0dcf1c2d7e8ea450",
|
||||
@ -25341,6 +25351,7 @@
|
||||
"T3T1_fr_test_msg_applysettings.py::test_experimental_features": "ba662732c202bdb2f6d908f04d9775716189772b0c54a51063e179ab7ac9921c",
|
||||
"T3T1_fr_test_msg_applysettings.py::test_label_too_long": "133bae24a65426ab6f29b12ba1ea0998096e511df637194e27eac3fad505c98f",
|
||||
"T3T1_fr_test_msg_applysettings.py::test_safety_checks": "02349a9e996b7f086145271ee12e67d357a87bea84cf42f32b4fcccaa294b9eb",
|
||||
"T3T1_fr_test_msg_applysettings.py::test_set_brightness": "f240cf4208b729140142552f39f768088588da24e8fde11ab29b4b826bf484da",
|
||||
"T3T1_fr_test_msg_backup_device.py::test_backup_bip39": "20d020e7a0d3e3f69ee07546a01a48ba04e0bbe1ee44f19c5143c76c6099718e",
|
||||
"T3T1_fr_test_msg_backup_device.py::test_backup_slip39_advanced[click_info]": "643739ae74f3e36cc49021c6769b359c35157bc9779f7cc1def53d2edd1def59",
|
||||
"T3T1_fr_test_msg_backup_device.py::test_backup_slip39_advanced[no_click_info]": "2edf67a77cb4e3a3f56062a9e2d4a712ef3a670508016f5ae85b643bb912168c",
|
||||
@ -26725,6 +26736,7 @@
|
||||
"T3T1_pt_test_msg_applysettings.py::test_experimental_features": "b3c57350e9fc437bb95ac5683197001e6324d741ccfdae64e256e26484a61261",
|
||||
"T3T1_pt_test_msg_applysettings.py::test_label_too_long": "e8eb9b57d62689b40a58c053da11694819eb927d8b82b505c6487505cb60a889",
|
||||
"T3T1_pt_test_msg_applysettings.py::test_safety_checks": "6f26dc8715b6fa22616cdfd31d494ab6d4cf9aad5f050c9c876f8cc212fc5840",
|
||||
"T3T1_pt_test_msg_applysettings.py::test_set_brightness": "943cc0fa3fe9ff5fbfcec72645259c14b2dcf7f2b245ab4fe275857883ff734a",
|
||||
"T3T1_pt_test_msg_backup_device.py::test_backup_bip39": "7e6ffe45b91498ef26b630c09c095896e7e3e911df66da74ebd73360d7d4af12",
|
||||
"T3T1_pt_test_msg_backup_device.py::test_backup_slip39_advanced[click_info]": "46aeb38cdf66953503e0bfcfe255384416f3b61885447f7ccac6041a9f49ffd6",
|
||||
"T3T1_pt_test_msg_backup_device.py::test_backup_slip39_advanced[no_click_info]": "327d8515b2ddc9ae9aa5625681ff41ef896b2a535704bb94449878a2b42adfd7",
|
||||
|
Loading…
Reference in New Issue
Block a user