introduce lv_anim_path_t to encapsulate the path cb

This commit is contained in:
Gabor Kiss-Vamosi
2020-04-27 11:51:18 +02:00
parent 930332ed99
commit 43e873108a
12 changed files with 190 additions and 410 deletions

View File

@@ -85,7 +85,7 @@ static void empty_style(void)
found = lv_style_list_get_opa(&style_list, LV_STYLE_BG_OPA, &opa);
lv_test_assert_int_eq(LV_RES_INV, found, "Get an 'opa' property");
found = lv_style_list_get_data_ptr(&style_list, LV_STYLE_TEXT_FONT, &ptr);
found = lv_style_list_get_ptr(&style_list, LV_STYLE_TEXT_FONT, &ptr);
lv_test_assert_int_eq(LV_RES_INV, found, "Get a 'ptr' property");
found = lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR, &color);
@@ -120,7 +120,7 @@ static void add_remove_read_prop(void)
found = lv_style_list_get_opa(&style_list, LV_STYLE_BG_OPA, &opa);
lv_test_assert_int_eq(LV_RES_INV, found, "Get a non existing 'opa' property");
found = lv_style_list_get_data_ptr(&style_list, LV_STYLE_TEXT_FONT, &ptr);
found = lv_style_list_get_ptr(&style_list, LV_STYLE_TEXT_FONT, &ptr);
lv_test_assert_int_eq(LV_RES_INV, found, "Get a non existing 'ptr' property");
found = lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR, &color);
@@ -129,7 +129,7 @@ static void add_remove_read_prop(void)
lv_test_print("Set properties and read back the values");
_lv_style_set_int(&style, LV_STYLE_TEXT_LINE_SPACE, 5);
_lv_style_set_opa(&style, LV_STYLE_BG_OPA, LV_OPA_50);
_lv_style_set_data_ptr(&style, LV_STYLE_TEXT_FONT, LV_THEME_DEFAULT_FONT_NORMAL);
_lv_style_set_ptr(&style, LV_STYLE_TEXT_FONT, LV_THEME_DEFAULT_FONT_NORMAL);
_lv_style_set_color(&style, LV_STYLE_BG_COLOR, LV_COLOR_RED);
found = lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE, &value);
@@ -140,7 +140,7 @@ static void add_remove_read_prop(void)
lv_test_assert_int_eq(LV_RES_OK, found, "Get an existing 'opa' property");
lv_test_assert_int_eq(LV_OPA_50, opa, "Get the value of an 'opa' property");
found = lv_style_list_get_data_ptr(&style_list, LV_STYLE_TEXT_FONT, &ptr);
found = lv_style_list_get_ptr(&style_list, LV_STYLE_TEXT_FONT, &ptr);
lv_test_assert_int_eq(LV_RES_OK, found, "Get an existing 'ptr' property");
lv_test_assert_ptr_eq(LV_THEME_DEFAULT_FONT_NORMAL, ptr, "Get the value of a 'ptr' property");
@@ -156,7 +156,7 @@ static void add_remove_read_prop(void)
found = lv_style_list_get_opa(&style_list, LV_STYLE_BG_OPA, &opa);
lv_test_assert_int_eq(LV_RES_INV, found, "Get an 'opa' property from a reseted style");
found = lv_style_list_get_data_ptr(&style_list, LV_STYLE_TEXT_FONT, &ptr);
found = lv_style_list_get_ptr(&style_list, LV_STYLE_TEXT_FONT, &ptr);
lv_test_assert_int_eq(LV_RES_INV, found, "Get an 'ptr' property from a reseted style");
found = lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR, &color);
@@ -194,7 +194,7 @@ static void cascade(void)
_lv_style_set_int(&style_first, LV_STYLE_TEXT_LINE_SPACE, 5);
_lv_style_set_opa(&style_first, LV_STYLE_BG_OPA, LV_OPA_50);
_lv_style_set_data_ptr(&style_first, LV_STYLE_TEXT_FONT, LV_THEME_DEFAULT_FONT_NORMAL);
_lv_style_set_ptr(&style_first, LV_STYLE_TEXT_FONT, LV_THEME_DEFAULT_FONT_NORMAL);
_lv_style_set_color(&style_first, LV_STYLE_BG_COLOR, LV_COLOR_RED);
found = lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE, &value);
@@ -205,7 +205,7 @@ static void cascade(void)
lv_test_assert_int_eq(LV_RES_OK, found, "Get an 'opa' property");
lv_test_assert_int_eq(LV_OPA_50, opa, "Get the value of an 'opa' property");
found = lv_style_list_get_data_ptr(&style_list, LV_STYLE_TEXT_FONT, &ptr);
found = lv_style_list_get_ptr(&style_list, LV_STYLE_TEXT_FONT, &ptr);
lv_test_assert_int_eq(LV_RES_OK, found, "Get an 'ptr' property");
lv_test_assert_ptr_eq(LV_THEME_DEFAULT_FONT_NORMAL, ptr, "Get the value of a 'ptr' property");
@@ -217,7 +217,7 @@ static void cascade(void)
_lv_style_set_int(&style_second, LV_STYLE_TEXT_LINE_SPACE, 10);
_lv_style_set_opa(&style_second, LV_STYLE_BG_OPA, LV_OPA_60);
_lv_style_set_data_ptr(&style_second, LV_STYLE_TEXT_FONT, LV_THEME_DEFAULT_FONT_NORMAL + 1);
_lv_style_set_ptr(&style_second, LV_STYLE_TEXT_FONT, LV_THEME_DEFAULT_FONT_NORMAL + 1);
_lv_style_set_color(&style_second, LV_STYLE_BG_COLOR, LV_COLOR_BLUE);
found = lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE, &value);
@@ -228,7 +228,7 @@ static void cascade(void)
lv_test_assert_int_eq(LV_RES_OK, found, "Get an overwritten 'opa' property");
lv_test_assert_int_eq(LV_OPA_60, opa, "Get the value of an overwritten 'opa' property");
found = lv_style_list_get_data_ptr(&style_list, LV_STYLE_TEXT_FONT, &ptr);
found = lv_style_list_get_ptr(&style_list, LV_STYLE_TEXT_FONT, &ptr);
lv_test_assert_int_eq(LV_RES_OK, found, "Get an overwritten 'ptr' property");
lv_test_assert_ptr_eq(LV_THEME_DEFAULT_FONT_NORMAL + 1, ptr, "Get the value of an overwritten 'ptr' property");
@@ -240,7 +240,7 @@ static void cascade(void)
lv_test_print("Overwrite the properties with the local style");
lv_style_list_set_local_int(&style_list, LV_STYLE_TEXT_LINE_SPACE, 20);
lv_style_list_set_local_opa(&style_list, LV_STYLE_BG_OPA, LV_OPA_70);
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_TEXT_FONT, LV_THEME_DEFAULT_FONT_NORMAL + 2);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_TEXT_FONT, LV_THEME_DEFAULT_FONT_NORMAL + 2);
lv_style_list_set_local_color(&style_list, LV_STYLE_BG_COLOR, LV_COLOR_LIME);
found = lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE, &value);
@@ -251,7 +251,7 @@ static void cascade(void)
lv_test_assert_int_eq(LV_RES_OK, found, "Get a local 'opa' property");
lv_test_assert_int_eq(LV_OPA_70, opa, "Get the value of a local 'opa' property");
found = lv_style_list_get_data_ptr(&style_list, LV_STYLE_TEXT_FONT, &ptr);
found = lv_style_list_get_ptr(&style_list, LV_STYLE_TEXT_FONT, &ptr);
lv_test_assert_int_eq(LV_RES_OK, found, "Get a local 'ptr' property");
lv_test_assert_ptr_eq(LV_THEME_DEFAULT_FONT_NORMAL + 2, ptr, "Get the value of a local'ptr' property");
@@ -470,17 +470,17 @@ static void mem_leak(void)
lv_test_print("Use local style");
lv_mem_monitor(&mon_start);
for(i = 0; i < 100; i++) {
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED) << LV_STYLE_STATE_POS, LV_THEME_DEFAULT_FONT_NORMAL);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED) << LV_STYLE_STATE_POS, LV_THEME_DEFAULT_FONT_NORMAL);
lv_style_list_reset(&style_list);
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED) << LV_STYLE_STATE_POS, NULL);
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED) << LV_STYLE_STATE_POS, NULL);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_reset(&style_list);
}
@@ -559,7 +559,7 @@ static void mem_leak(void)
for(i = 0; i < 100; i++) {
if(i % 2 == 0) {
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_CLOSE);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_CLOSE);
}
_lv_style_set_color(&style1, LV_STYLE_LINE_COLOR, LV_COLOR_RED);
@@ -571,7 +571,7 @@ static void mem_leak(void)
if(i % 4 == 0) {
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_CLOSE);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_CLOSE);
}
lv_style_list_remove_style(&style_list, &style1);
@@ -586,7 +586,7 @@ static void mem_leak(void)
lv_style_list_add_style(&style_list, &style2);
if(i % 8 == 0) {
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_CLOSE);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_CLOSE);
}
lv_style_list_add_style(&style_list, &style2);
@@ -604,14 +604,14 @@ static void mem_leak(void)
_lv_style_set_int(&style3, LV_STYLE_PAD_LEFT, 12);
_lv_style_set_int(&style3, LV_STYLE_PAD_RIGHT, 23);
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED) << LV_STYLE_STATE_POS, LV_THEME_DEFAULT_FONT_NORMAL);
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED) << LV_STYLE_STATE_POS, NULL);
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_data_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED) << LV_STYLE_STATE_POS, LV_THEME_DEFAULT_FONT_NORMAL);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED) << LV_STYLE_STATE_POS, NULL);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK);
lv_style_list_add_style(&style_list, &style3);
lv_style_list_add_style(&style_list, &style2);