feat(test_keyboard): add keyboard test (#5739)
Signed-off-by: lhdjply <lhdjply@126.com>
This commit is contained in:
BIN
tests/ref_imgs/widgets/keyboard_1.png
Normal file
BIN
tests/ref_imgs/widgets/keyboard_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
tests/ref_imgs/widgets/keyboard_2.png
Normal file
BIN
tests/ref_imgs/widgets/keyboard_2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
BIN
tests/ref_imgs/widgets/keyboard_3.png
Normal file
BIN
tests/ref_imgs/widgets/keyboard_3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
BIN
tests/ref_imgs/widgets/keyboard_4.png
Normal file
BIN
tests/ref_imgs/widgets/keyboard_4.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.7 KiB |
41
tests/src/test_cases/widgets/test_keyboard.c
Normal file
41
tests/src/test_cases/widgets/test_keyboard.c
Normal file
@@ -0,0 +1,41 @@
|
||||
#if LV_BUILD_TEST
|
||||
#include "../lvgl.h"
|
||||
|
||||
#include "unity/unity.h"
|
||||
|
||||
static lv_obj_t * active_screen = NULL;
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
active_screen = lv_screen_active();
|
||||
}
|
||||
|
||||
void tearDown(void)
|
||||
{
|
||||
lv_obj_clean(active_screen);
|
||||
}
|
||||
|
||||
void test_keyboard_mode(void)
|
||||
{
|
||||
lv_obj_t * keyboard = lv_keyboard_create(active_screen);
|
||||
lv_obj_set_size(keyboard, LV_PCT(100), LV_PCT(50));
|
||||
lv_obj_align(keyboard, LV_ALIGN_BOTTOM_MID, 0, 0);
|
||||
lv_obj_set_style_text_font(keyboard, &lv_font_dejavu_16_persian_hebrew, LV_PART_MAIN);
|
||||
lv_keyboard_set_mode(keyboard, LV_KEYBOARD_MODE_TEXT_LOWER);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/keyboard_1.png");
|
||||
|
||||
lv_keyboard_set_mode(keyboard, LV_KEYBOARD_MODE_TEXT_UPPER);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/keyboard_2.png");
|
||||
|
||||
lv_keyboard_set_mode(keyboard, LV_KEYBOARD_MODE_SPECIAL);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/keyboard_3.png");
|
||||
|
||||
lv_keyboard_set_mode(keyboard, LV_KEYBOARD_MODE_NUMBER);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/keyboard_4.png");
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user