Skip to content

Commit

Permalink
Merge pull request #198 from LedgerHQ/fbe/fix_navigation_for_latest_stax
Browse files Browse the repository at this point in the history
Move Stax layout navigation following API_LEVEL_21 update
  • Loading branch information
fbeutin-ledger authored Jul 12, 2024
2 parents f173fff + d4f2214 commit f10eb43
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
22 changes: 11 additions & 11 deletions src/ragger/firmware/touch/positions.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ def __iter__(self):

# Stax resolution is 400x670
STAX_CENTER = Position(200, 335)
STAX_CENTER_LEFT = Position(200, 40)
# Flex resolution is 480x600
FLEX_CENTER = Position(240, 300)

# Used for Flex keyboard 'validation' button, which is not vertically centered, contrary to Stax
STAX_BUTTON_UPPER_CENTER_MIDDLE = Position(200, 280)
FLEX_BUTTON_UPPER_CENTER_MIDDLE = Position(240, 250)

STAX_BUTTON_UPPER_LEFT = Position(36, 36)
Expand All @@ -49,8 +48,9 @@ def __iter__(self):
FLEX_BUTTON_LOWER_MIDDLE = Position(240, 550)

STAX_BUTTON_LOWER_RIGHT = Position(342, 606)
FLEX_BUTTON_LOWER_MIDDLE_RIGHT = Position(320, 550)
FLEX_BUTTON_LOWER_RIGHT = Position(430, 550)
STAX_BUTTON_LOWER_MIDDLE_RIGHT = Position(266, 615)
FLEX_BUTTON_LOWER_MIDDLE_RIGHT = Position(320, 550)

STAX_BUTTON_ABOVE_LOWER_MIDDLE = Position(200, 515)
FLEX_BUTTON_ABOVE_LOWER_MIDDLE = Position(240, 435)
Expand Down Expand Up @@ -374,7 +374,7 @@ def __iter__(self):
Firmware.FLEX: FLEX_CENTER,
},
"KeyboardConfirmationButton": {
Firmware.STAX: STAX_CENTER,
Firmware.STAX: STAX_BUTTON_UPPER_CENTER_MIDDLE,
Firmware.FLEX: FLEX_BUTTON_UPPER_CENTER_MIDDLE,
},
"RightHeader": {
Expand All @@ -394,7 +394,7 @@ def __iter__(self):
Firmware.FLEX: FLEX_BUTTON_LOWER_LEFT
},
"CancelFooter": {
Firmware.STAX: STAX_BUTTON_LOWER_MIDDLE,
Firmware.STAX: STAX_BUTTON_LOWER_LEFT,
Firmware.FLEX: FLEX_BUTTON_LOWER_LEFT
},
"UseCaseHome": {
Expand Down Expand Up @@ -427,7 +427,7 @@ def __iter__(self):
Firmware.STAX: {
"single_page_exit": STAX_BUTTON_UPPER_LEFT,
"multi_page_exit": STAX_BUTTON_UPPER_LEFT,
"previous": STAX_BUTTON_LOWER_LEFT,
"previous": STAX_BUTTON_LOWER_MIDDLE_RIGHT,
"next": STAX_BUTTON_LOWER_RIGHT,
},
Firmware.FLEX: {
Expand All @@ -452,7 +452,7 @@ def __iter__(self):
"UseCaseChoice": {
Firmware.STAX: {
"confirm": STAX_BUTTON_ABOVE_LOWER_MIDDLE,
"reject": STAX_BUTTON_LOWER_MIDDLE,
"reject": STAX_BUTTON_LOWER_LEFT,
},
Firmware.FLEX: {
"confirm": FLEX_BUTTON_ABOVE_LOWER_MIDDLE,
Expand All @@ -469,10 +469,10 @@ def __iter__(self):
},
"UseCaseReview": {
Firmware.STAX: {
"tap": STAX_CENTER_LEFT,
"previous": STAX_BUTTON_UPPER_LEFT,
"tap": STAX_BUTTON_LOWER_RIGHT,
"previous": STAX_BUTTON_LOWER_MIDDLE,
"confirm": STAX_BUTTON_ABOVE_LOWER_MIDDLE,
"reject": STAX_BUTTON_LOWER_MIDDLE,
"reject": STAX_BUTTON_LOWER_LEFT,
},
Firmware.FLEX: {
"tap": FLEX_BUTTON_LOWER_RIGHT,
Expand All @@ -498,7 +498,7 @@ def __iter__(self):
"tap": STAX_BUTTON_ABOVE_LOWER_MIDDLE,
"exit_qr": STAX_BUTTON_LOWER_MIDDLE,
"confirm": STAX_BUTTON_ABOVE_LOWER_MIDDLE,
"cancel": STAX_BUTTON_LOWER_MIDDLE,
"cancel": STAX_BUTTON_LOWER_LEFT,
},
Firmware.FLEX: {
"tap": FLEX_BUTTON_ABOVE_LOWER_MIDDLE,
Expand Down
Binary file modified tests/snapshots/stax/waiting_screen/00000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/stax/waiting_screen/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/stax/waiting_screen/00002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/stax/waiting_screen/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/stax/waiting_screen/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions tests/unit/firmware/touch/test_screen_FullScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ def test_non_variable_layouts(self):
(self.screen.navigation_header, POSITIONS["LeftHeader"][self.firmware]),
(self.screen.tappable_center, POSITIONS["TappableCenter"][self.firmware]),
(self.screen.centered_footer, POSITIONS["CenteredFooter"][self.firmware]),
(self.screen.cancel_footer, POSITIONS["CenteredFooter"][self.firmware]),
(self.screen.exit_footer, POSITIONS["CenteredFooter"][self.firmware]),
(self.screen.info_footer, POSITIONS["CenteredFooter"][self.firmware]),
(self.screen.settings_footer, POSITIONS["CenteredFooter"][self.firmware]),
(self.screen.cancel_footer, POSITIONS["CancelFooter"][self.firmware]),
(self.screen.exit_footer, POSITIONS["CancelFooter"][self.firmware]),
(self.screen.info_footer, POSITIONS["CancelFooter"][self.firmware]),
(self.screen.settings_footer, POSITIONS["CancelFooter"][self.firmware]),
]
call_number = 0
self.assertEqual(self.backend.finger_touch.call_count, call_number)
Expand Down

0 comments on commit f10eb43

Please sign in to comment.