From 58a0b5fd115d9687a1292e5e82e6b9fa8454b930 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 19 May 2026 01:44:11 +0530 Subject: 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) --- tests/unit/test_keyboard | Bin 0 -> 35416 bytes tests/unit/test_keyboard.c | 22 +++++++++++++--------- tests/unit/test_touch | Bin 0 -> 30304 bytes tests/unit/test_wifi_setup | Bin 0 -> 33336 bytes 4 files changed, 13 insertions(+), 9 deletions(-) create mode 100755 tests/unit/test_keyboard create mode 100755 tests/unit/test_touch create mode 100755 tests/unit/test_wifi_setup (limited to 'tests/unit') diff --git a/tests/unit/test_keyboard b/tests/unit/test_keyboard new file mode 100755 index 0000000..61cc9f5 Binary files /dev/null and b/tests/unit/test_keyboard 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) kb_result_t r = kb_hit_test(160, 10, KB_ALPHA_LOWER); ASSERT(r.action == KB_ACTION_NONE, "Touch above keyboard = NONE"); - r = kb_hit_test(160, KB_START_Y + KB_ROW_COUNT * (KB_KEY_H + KB_KEY_GAP) + 10, KB_ALPHA_LOWER); + r = kb_hit_test(160, 70 + 4 * (36 + 2) + 10, KB_ALPHA_LOWER); ASSERT(r.action == KB_ACTION_NONE, "Touch below keyboard = NONE"); } { - int mid_x = 5 + KB_KEY_W / 2; - int mid_y = KB_START_Y + KB_KEY_H / 2; + int margin_r0 = (320 - (10 * 28 + 9 * 2)) / 2; + int mid_x = margin_r0 + 28 / 2; + int mid_y = 70 + 36 / 2; kb_result_t r = kb_hit_test(mid_x, mid_y, KB_ALPHA_LOWER); ASSERT(r.action == KB_ACTION_CHAR, "Row 0 first key is a char"); ASSERT_EQ_INT('q', r.ch, "Row 0 first key = 'q'"); } { - int x = 5 + KB_KEY_W + KB_KEY_GAP + KB_KEY_W / 2; - int y = KB_START_Y + KB_KEY_H / 2; + int margin_r0 = (320 - (10 * 28 + 9 * 2)) / 2; + int x = margin_r0 + 28 + 2 + 28 / 2; + int y = 70 + 36 / 2; kb_result_t r = kb_hit_test(x, y, KB_ALPHA_LOWER); ASSERT(r.action == KB_ACTION_CHAR, "Row 0 second key is a char"); ASSERT_EQ_INT('w', r.ch, "Row 0 second key = 'w'"); } { - int y_row1 = KB_START_Y + (KB_KEY_H + KB_KEY_GAP) + KB_KEY_H / 2; - int x_row1 = 14 + KB_KEY_W / 2; + int margin_r1 = (320 - (9 * 28 + 8 * 2)) / 2; + int y_row1 = 70 + (36 + 2) + 36 / 2; + int x_row1 = margin_r1 + 28 / 2 + 28 / 2; kb_result_t r = kb_hit_test(x_row1, y_row1, KB_ALPHA_LOWER); ASSERT(r.action == KB_ACTION_CHAR, "Row 1 first key is a char"); ASSERT_EQ_INT('a', r.ch, "Row 1 first key = 'a'"); } { - int y_row2 = KB_START_Y + 2 * (KB_KEY_H + KB_KEY_GAP) + KB_KEY_H / 2; - int x_row2 = 23 + 42 / 2; + int margin_r2 = (320 - (9 * 28 + 8 * 2)) / 2 + 28; + int y_row2 = 70 + 2 * (36 + 2) + 36 / 2; + int x_row2 = margin_r2 + 28 / 2; kb_result_t r = kb_hit_test(x_row2, y_row2, KB_ALPHA_LOWER); ASSERT(r.action == KB_ACTION_SHIFT, "Row 2 first key = SHIFT"); } diff --git a/tests/unit/test_touch b/tests/unit/test_touch new file mode 100755 index 0000000..43c8790 Binary files /dev/null and b/tests/unit/test_touch differ diff --git a/tests/unit/test_wifi_setup b/tests/unit/test_wifi_setup new file mode 100755 index 0000000..aa0e0b4 Binary files /dev/null and b/tests/unit/test_wifi_setup differ -- cgit v1.2.3