diff options
| author | Your Name <you@example.com> | 2026-05-19 01:44:11 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-19 01:44:11 +0530 |
| commit | 58a0b5fd115d9687a1292e5e82e6b9fa8454b930 (patch) | |
| tree | dd9f18903d0237edcf5844c58fcb88bcf737b22c /tests | |
| parent | 699fc6c03899c3b1ff853d8c7c6cf32173436354 (diff) | |
Dynamic layout for WiFi setup: landscape rotation, responsive render, highlight feedback
- Render functions use axs15231b_get_width/height() instead of hardcoded coords
- render_wifi_setup_list: dynamic item widths, screen-relative cancel button
- render_wifi_setup_password: dynamic field/eye/keyboard from kb_get_layout()
- render_wifi_setup_result: centered on screen, dynamic button placement
- handle_wifi_setup_touch: matching dynamic hit areas, highlight_rect() feedback
- Rotation lifecycle: enter_wifi_setup_rotation/exit wired into all entry/exit paths
- display_enter_wifi_setup + READY/ERROR touch + SUCCESS auto-return + LIST cancel
- Added kb_result_t typedef to keyboard.h (was only in .c)
- Fixed test_keyboard.c: use computed offsets from kb_layout_t defaults
- All 101 unit tests pass (touch:19, keyboard:46, wifi_setup:36)
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/unit/test_keyboard | bin | 0 -> 35416 bytes | |||
| -rw-r--r-- | tests/unit/test_keyboard.c | 22 | ||||
| -rwxr-xr-x | tests/unit/test_touch | bin | 0 -> 30304 bytes | |||
| -rwxr-xr-x | tests/unit/test_wifi_setup | bin | 0 -> 33336 bytes |
4 files changed, 13 insertions, 9 deletions
diff --git a/tests/unit/test_keyboard b/tests/unit/test_keyboard new file mode 100755 index 0000000..61cc9f5 --- /dev/null +++ b/tests/unit/test_keyboard | |||
| Binary files differ | |||
diff --git a/tests/unit/test_keyboard.c b/tests/unit/test_keyboard.c index e069f28..81ca328 100644 --- a/tests/unit/test_keyboard.c +++ b/tests/unit/test_keyboard.c | |||
| @@ -41,37 +41,41 @@ int main(void) | |||
| 41 | kb_result_t r = kb_hit_test(160, 10, KB_ALPHA_LOWER); | 41 | kb_result_t r = kb_hit_test(160, 10, KB_ALPHA_LOWER); |
| 42 | ASSERT(r.action == KB_ACTION_NONE, "Touch above keyboard = NONE"); | 42 | ASSERT(r.action == KB_ACTION_NONE, "Touch above keyboard = NONE"); |
| 43 | 43 | ||
| 44 | r = kb_hit_test(160, KB_START_Y + KB_ROW_COUNT * (KB_KEY_H + KB_KEY_GAP) + 10, KB_ALPHA_LOWER); | 44 | r = kb_hit_test(160, 70 + 4 * (36 + 2) + 10, KB_ALPHA_LOWER); |
| 45 | ASSERT(r.action == KB_ACTION_NONE, "Touch below keyboard = NONE"); | 45 | ASSERT(r.action == KB_ACTION_NONE, "Touch below keyboard = NONE"); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | { | 48 | { |
| 49 | int mid_x = 5 + KB_KEY_W / 2; | 49 | int margin_r0 = (320 - (10 * 28 + 9 * 2)) / 2; |
| 50 | int mid_y = KB_START_Y + KB_KEY_H / 2; | 50 | int mid_x = margin_r0 + 28 / 2; |
| 51 | int mid_y = 70 + 36 / 2; | ||
| 51 | kb_result_t r = kb_hit_test(mid_x, mid_y, KB_ALPHA_LOWER); | 52 | kb_result_t r = kb_hit_test(mid_x, mid_y, KB_ALPHA_LOWER); |
| 52 | ASSERT(r.action == KB_ACTION_CHAR, "Row 0 first key is a char"); | 53 | ASSERT(r.action == KB_ACTION_CHAR, "Row 0 first key is a char"); |
| 53 | ASSERT_EQ_INT('q', r.ch, "Row 0 first key = 'q'"); | 54 | ASSERT_EQ_INT('q', r.ch, "Row 0 first key = 'q'"); |
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | { | 57 | { |
| 57 | int x = 5 + KB_KEY_W + KB_KEY_GAP + KB_KEY_W / 2; | 58 | int margin_r0 = (320 - (10 * 28 + 9 * 2)) / 2; |
| 58 | int y = KB_START_Y + KB_KEY_H / 2; | 59 | int x = margin_r0 + 28 + 2 + 28 / 2; |
| 60 | int y = 70 + 36 / 2; | ||
| 59 | kb_result_t r = kb_hit_test(x, y, KB_ALPHA_LOWER); | 61 | kb_result_t r = kb_hit_test(x, y, KB_ALPHA_LOWER); |
| 60 | ASSERT(r.action == KB_ACTION_CHAR, "Row 0 second key is a char"); | 62 | ASSERT(r.action == KB_ACTION_CHAR, "Row 0 second key is a char"); |
| 61 | ASSERT_EQ_INT('w', r.ch, "Row 0 second key = 'w'"); | 63 | ASSERT_EQ_INT('w', r.ch, "Row 0 second key = 'w'"); |
| 62 | } | 64 | } |
| 63 | 65 | ||
| 64 | { | 66 | { |
| 65 | int y_row1 = KB_START_Y + (KB_KEY_H + KB_KEY_GAP) + KB_KEY_H / 2; | 67 | int margin_r1 = (320 - (9 * 28 + 8 * 2)) / 2; |
| 66 | int x_row1 = 14 + KB_KEY_W / 2; | 68 | int y_row1 = 70 + (36 + 2) + 36 / 2; |
| 69 | int x_row1 = margin_r1 + 28 / 2 + 28 / 2; | ||
| 67 | kb_result_t r = kb_hit_test(x_row1, y_row1, KB_ALPHA_LOWER); | 70 | kb_result_t r = kb_hit_test(x_row1, y_row1, KB_ALPHA_LOWER); |
| 68 | ASSERT(r.action == KB_ACTION_CHAR, "Row 1 first key is a char"); | 71 | ASSERT(r.action == KB_ACTION_CHAR, "Row 1 first key is a char"); |
| 69 | ASSERT_EQ_INT('a', r.ch, "Row 1 first key = 'a'"); | 72 | ASSERT_EQ_INT('a', r.ch, "Row 1 first key = 'a'"); |
| 70 | } | 73 | } |
| 71 | 74 | ||
| 72 | { | 75 | { |
| 73 | int y_row2 = KB_START_Y + 2 * (KB_KEY_H + KB_KEY_GAP) + KB_KEY_H / 2; | 76 | int margin_r2 = (320 - (9 * 28 + 8 * 2)) / 2 + 28; |
| 74 | int x_row2 = 23 + 42 / 2; | 77 | int y_row2 = 70 + 2 * (36 + 2) + 36 / 2; |
| 78 | int x_row2 = margin_r2 + 28 / 2; | ||
| 75 | kb_result_t r = kb_hit_test(x_row2, y_row2, KB_ALPHA_LOWER); | 79 | kb_result_t r = kb_hit_test(x_row2, y_row2, KB_ALPHA_LOWER); |
| 76 | ASSERT(r.action == KB_ACTION_SHIFT, "Row 2 first key = SHIFT"); | 80 | ASSERT(r.action == KB_ACTION_SHIFT, "Row 2 first key = SHIFT"); |
| 77 | } | 81 | } |
diff --git a/tests/unit/test_touch b/tests/unit/test_touch new file mode 100755 index 0000000..43c8790 --- /dev/null +++ b/tests/unit/test_touch | |||
| Binary files differ | |||
diff --git a/tests/unit/test_wifi_setup b/tests/unit/test_wifi_setup new file mode 100755 index 0000000..aa0e0b4 --- /dev/null +++ b/tests/unit/test_wifi_setup | |||
| Binary files differ | |||