mirror of
https://github.com/lvgl/lvgl.git
synced 2026-09-28 16:10:54 +08:00
fix(warning): fix shadown variable warning
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
This commit is contained in:
+1
@@ -34,6 +34,7 @@ static lv_cache_compare_res_t compare_cb(const test_data * lhs, const test_data
|
||||
|
||||
static void free_cb(test_data * node, void * user_data)
|
||||
{
|
||||
LV_UNUSED(user_data);
|
||||
lv_free(node->data);
|
||||
}
|
||||
|
||||
|
||||
@@ -234,6 +234,7 @@ static void draw_lines(lv_layer_t * layer)
|
||||
|
||||
static void canvas_draw(const char * name, void (*draw_cb)(lv_layer_t *))
|
||||
{
|
||||
LV_UNUSED(name);
|
||||
lv_obj_t * canvas = lv_canvas_create(lv_screen_active());
|
||||
uint32_t stride = 640 * 4 + 128; /*Test non-default stride*/
|
||||
lv_draw_buf_t * draw_buf = lv_draw_buf_create(640, 480, LV_COLOR_FORMAT_ARGB8888, stride);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,23 +22,23 @@ void test_calendar_event_key_down_gui(void);
|
||||
void test_calendar_get_pressed_date_null(void);
|
||||
void test_calendar_get_btnmatrix(void);
|
||||
|
||||
static lv_obj_t * active_screen = NULL;
|
||||
static lv_obj_t * calendar = NULL;
|
||||
static lv_obj_t * g_active_screen = NULL;
|
||||
static lv_obj_t * g_calendar = NULL;
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
active_screen = lv_screen_active();
|
||||
calendar = lv_calendar_create(active_screen);
|
||||
g_active_screen = lv_screen_active();
|
||||
g_calendar = lv_calendar_create(g_active_screen);
|
||||
}
|
||||
|
||||
void tearDown(void)
|
||||
{
|
||||
lv_obj_clean(active_screen);
|
||||
lv_obj_clean(g_active_screen);
|
||||
}
|
||||
|
||||
void test_calendar_creation_successful(void)
|
||||
{
|
||||
TEST_ASSERT_NOT_NULL(calendar);
|
||||
TEST_ASSERT_NOT_NULL(g_calendar);
|
||||
}
|
||||
|
||||
void test_calendar_set_today_date(void)
|
||||
@@ -49,9 +49,9 @@ void test_calendar_set_today_date(void)
|
||||
today.month = 9;
|
||||
today.day = 21;
|
||||
|
||||
lv_calendar_set_today_date(calendar, today.year, today.month, today.day);
|
||||
lv_calendar_set_today_date(g_calendar, today.year, today.month, today.day);
|
||||
|
||||
const lv_calendar_date_t * date_after_test = lv_calendar_get_today_date(calendar);
|
||||
const lv_calendar_date_t * date_after_test = lv_calendar_get_today_date(g_calendar);
|
||||
|
||||
TEST_ASSERT_EQUAL_INT16(today.year, date_after_test->year);
|
||||
TEST_ASSERT_EQUAL_INT16(today.month, date_after_test->month);
|
||||
@@ -66,15 +66,15 @@ void test_calendar_set_today_date_gui(void)
|
||||
today.month = 9;
|
||||
today.day = 21;
|
||||
|
||||
lv_calendar_set_today_date(calendar, today.year, today.month, today.day);
|
||||
lv_calendar_set_showed_date(calendar, 2022, 9);
|
||||
lv_calendar_set_today_date(g_calendar, today.year, today.month, today.day);
|
||||
lv_calendar_set_showed_date(g_calendar, 2022, 9);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/calendar_01.png");
|
||||
}
|
||||
|
||||
void test_calendar_set_showed_date_gui(void)
|
||||
{
|
||||
lv_calendar_set_showed_date(calendar, 2022, 9);
|
||||
lv_calendar_set_showed_date(g_calendar, 2022, 9);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/calendar_02.png");
|
||||
}
|
||||
@@ -95,9 +95,9 @@ void test_calendar_set_highlighted_dates(void)
|
||||
highlighted_days[2].month = 2;
|
||||
highlighted_days[2].day = 22;
|
||||
|
||||
lv_calendar_set_highlighted_dates(calendar, highlighted_days, 3);
|
||||
lv_calendar_set_highlighted_dates(g_calendar, highlighted_days, 3);
|
||||
|
||||
const lv_calendar_date_t * highlighted_days_after_test = lv_calendar_get_highlighted_dates(calendar);
|
||||
const lv_calendar_date_t * highlighted_days_after_test = lv_calendar_get_highlighted_dates(g_calendar);
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
TEST_ASSERT_EQUAL_INT16(highlighted_days[i].year, highlighted_days_after_test[i].year);
|
||||
@@ -122,9 +122,9 @@ void test_calendar_set_highlighted_dates_gui(void)
|
||||
highlighted_days[2].month = 2;
|
||||
highlighted_days[2].day = 22;
|
||||
|
||||
lv_calendar_set_highlighted_dates(calendar, highlighted_days, 3);
|
||||
lv_calendar_set_highlighted_dates(g_calendar, highlighted_days, 3);
|
||||
|
||||
lv_calendar_set_showed_date(calendar, 2022, 2);
|
||||
lv_calendar_set_showed_date(g_calendar, 2022, 2);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/calendar_03.png");
|
||||
}
|
||||
@@ -133,9 +133,9 @@ void test_calendar_set_day_names_gui(void)
|
||||
{
|
||||
static const char * day_names[7] = {"Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa"};
|
||||
|
||||
lv_calendar_set_day_names(calendar, day_names);
|
||||
lv_calendar_set_day_names(g_calendar, day_names);
|
||||
|
||||
lv_calendar_set_showed_date(calendar, 2022, 9);
|
||||
lv_calendar_set_showed_date(g_calendar, 2022, 9);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/calendar_04.png");
|
||||
}
|
||||
@@ -156,25 +156,25 @@ void test_calendar_get_highlighted_dates_num(void)
|
||||
highlighted_days[2].month = 2;
|
||||
highlighted_days[2].day = 22;
|
||||
|
||||
lv_calendar_set_highlighted_dates(calendar, highlighted_days, 3);
|
||||
lv_calendar_set_highlighted_dates(g_calendar, highlighted_days, 3);
|
||||
|
||||
TEST_ASSERT_EQUAL_INT16(3, lv_calendar_get_highlighted_dates_num(calendar));
|
||||
TEST_ASSERT_EQUAL_INT16(3, lv_calendar_get_highlighted_dates_num(g_calendar));
|
||||
}
|
||||
|
||||
void test_calendar_header_dropdown_create_gui(void)
|
||||
{
|
||||
lv_calendar_header_dropdown_create(calendar);
|
||||
lv_calendar_header_dropdown_create(g_calendar);
|
||||
|
||||
lv_calendar_set_showed_date(calendar, 2022, 9);
|
||||
lv_calendar_set_showed_date(g_calendar, 2022, 9);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/calendar_05.png");
|
||||
}
|
||||
|
||||
void test_calendar_header_arrow_create_gui(void)
|
||||
{
|
||||
lv_calendar_header_arrow_create(calendar);
|
||||
lv_calendar_header_arrow_create(g_calendar);
|
||||
|
||||
lv_calendar_set_showed_date(calendar, 2022, 10); // Use October to avoid month name sliding
|
||||
lv_calendar_set_showed_date(g_calendar, 2022, 10); // Use October to avoid month name sliding
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/calendar_06.png");
|
||||
}
|
||||
@@ -183,27 +183,27 @@ void test_calendar_event_key_down_gui(void)
|
||||
{
|
||||
uint32_t key = LV_KEY_DOWN;
|
||||
|
||||
lv_calendar_set_showed_date(calendar, 2022, 9);
|
||||
lv_calendar_set_showed_date(g_calendar, 2022, 9);
|
||||
|
||||
lv_obj_send_event(calendar, LV_EVENT_KEY, (void *) &key);
|
||||
lv_obj_send_event(g_calendar, LV_EVENT_KEY, (void *) &key);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/calendar_07.png");
|
||||
}
|
||||
|
||||
void test_calendar_get_pressed_date_null(void)
|
||||
{
|
||||
lv_calendar_set_showed_date(calendar, 2022, 9);
|
||||
lv_calendar_set_showed_date(g_calendar, 2022, 9);
|
||||
|
||||
lv_calendar_date_t pressed_date;
|
||||
|
||||
lv_result_t result = lv_calendar_get_pressed_date(calendar, &pressed_date);
|
||||
lv_result_t result = lv_calendar_get_pressed_date(g_calendar, &pressed_date);
|
||||
|
||||
TEST_ASSERT_EQUAL(result, LV_RESULT_INVALID);
|
||||
}
|
||||
|
||||
void test_calendar_get_btnmatrix(void)
|
||||
{
|
||||
lv_obj_t * btnm = lv_calendar_get_btnmatrix(calendar);
|
||||
lv_obj_t * btnm = lv_calendar_get_btnmatrix(g_calendar);
|
||||
|
||||
TEST_ASSERT_NOT_NULL(btnm);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user