mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-28 13:36:27 +08:00
chore(test): format test cases (#3071)
This commit is contained in:
@@ -0,0 +1,26 @@
|
|||||||
|
--style=kr
|
||||||
|
--indent=spaces=4
|
||||||
|
--indent-classes
|
||||||
|
--indent-switches
|
||||||
|
--indent-cases
|
||||||
|
--indent-preproc-block
|
||||||
|
--indent-preproc-define
|
||||||
|
--indent-col1-comments
|
||||||
|
--pad-oper
|
||||||
|
--unpad-paren
|
||||||
|
--align-pointer=middle
|
||||||
|
--align-reference=middle
|
||||||
|
--convert-tabs
|
||||||
|
--max-code-length=120
|
||||||
|
--break-after-logical
|
||||||
|
--break-closing-braces
|
||||||
|
--attach-closing-while
|
||||||
|
--min-conditional-indent=0
|
||||||
|
--max-continuation-indent=120
|
||||||
|
--mode=c
|
||||||
|
--lineend=linux
|
||||||
|
--recursive
|
||||||
|
--suffix=none
|
||||||
|
--preserve-date
|
||||||
|
--formatted
|
||||||
|
--exclude=../tests/src/test_cases/_test_template.c
|
||||||
@@ -3,3 +3,4 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
os.system('astyle --options=code-format.cfg "../src/*.c,*.h"')
|
os.system('astyle --options=code-format.cfg "../src/*.c,*.h"')
|
||||||
|
os.system('astyle --options=code-format-tests.cfg "../tests/src/test_cases/*.c"')
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ void test_arc_should_update_angles_when_changing_to_symmetrical_mode(void);
|
|||||||
void test_arc_should_update_angles_when_changing_to_symmetrical_mode_value_more_than_middle_range(void);
|
void test_arc_should_update_angles_when_changing_to_symmetrical_mode_value_more_than_middle_range(void);
|
||||||
void test_arc_angles_when_reversed(void);
|
void test_arc_angles_when_reversed(void);
|
||||||
|
|
||||||
static lv_obj_t *active_screen = NULL;
|
static lv_obj_t * active_screen = NULL;
|
||||||
static lv_obj_t *arc = NULL;
|
static lv_obj_t * arc = NULL;
|
||||||
static uint32_t event_cnt;
|
static uint32_t event_cnt;
|
||||||
|
|
||||||
static void dummy_event_cb(lv_event_t * e);
|
static void dummy_event_cb(lv_event_t * e);
|
||||||
@@ -109,13 +109,13 @@ void test_arc_angles_when_reversed(void)
|
|||||||
uint16_t expected_end_angle = 90;
|
uint16_t expected_end_angle = 90;
|
||||||
int16_t expected_value = 40;
|
int16_t expected_value = 40;
|
||||||
|
|
||||||
lv_obj_t *arcBlack;
|
lv_obj_t * arcBlack;
|
||||||
arcBlack = lv_arc_create(lv_scr_act());
|
arcBlack = lv_arc_create(lv_scr_act());
|
||||||
|
|
||||||
lv_arc_set_mode(arcBlack, LV_ARC_MODE_REVERSE);
|
lv_arc_set_mode(arcBlack, LV_ARC_MODE_REVERSE);
|
||||||
|
|
||||||
lv_arc_set_bg_angles(arcBlack, 0, 90);
|
lv_arc_set_bg_angles(arcBlack, 0, 90);
|
||||||
|
|
||||||
lv_arc_set_value(arcBlack, expected_value);
|
lv_arc_set_value(arcBlack, expected_value);
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_UINT16(expected_start_angle, lv_arc_get_angle_start(arcBlack));
|
TEST_ASSERT_EQUAL_UINT16(expected_start_angle, lv_arc_get_angle_start(arcBlack));
|
||||||
@@ -131,22 +131,22 @@ void test_arc_click_area_with_adv_hittest(void)
|
|||||||
lv_obj_add_flag(arc, LV_OBJ_FLAG_ADV_HITTEST);
|
lv_obj_add_flag(arc, LV_OBJ_FLAG_ADV_HITTEST);
|
||||||
lv_obj_add_event_cb(arc, dummy_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
lv_obj_add_event_cb(arc, dummy_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
||||||
lv_obj_set_ext_click_area(arc, 5);
|
lv_obj_set_ext_click_area(arc, 5);
|
||||||
|
|
||||||
/*No click detected at the middle*/
|
/*No click detected at the middle*/
|
||||||
event_cnt = 0;
|
event_cnt = 0;
|
||||||
lv_test_mouse_click_at(50, 50);
|
lv_test_mouse_click_at(50, 50);
|
||||||
TEST_ASSERT_EQUAL_UINT32(0, event_cnt);
|
TEST_ASSERT_EQUAL_UINT32(0, event_cnt);
|
||||||
|
|
||||||
/*No click close to the radius - bg_arc - ext_click_area*/
|
/*No click close to the radius - bg_arc - ext_click_area*/
|
||||||
event_cnt = 0;
|
event_cnt = 0;
|
||||||
lv_test_mouse_click_at(83, 50);
|
lv_test_mouse_click_at(83, 50);
|
||||||
TEST_ASSERT_EQUAL_UINT32(0, event_cnt);
|
TEST_ASSERT_EQUAL_UINT32(0, event_cnt);
|
||||||
|
|
||||||
/*Click on the radius - bg_arc - ext_click_area*/
|
/*Click on the radius - bg_arc - ext_click_area*/
|
||||||
event_cnt = 0;
|
event_cnt = 0;
|
||||||
lv_test_mouse_click_at(86, 50);
|
lv_test_mouse_click_at(86, 50);
|
||||||
TEST_ASSERT_GREATER_THAN(0, event_cnt);
|
TEST_ASSERT_GREATER_THAN(0, event_cnt);
|
||||||
|
|
||||||
/*Click on the radius + ext_click_area*/
|
/*Click on the radius + ext_click_area*/
|
||||||
event_cnt = 0;
|
event_cnt = 0;
|
||||||
lv_test_mouse_click_at(104, 50);
|
lv_test_mouse_click_at(104, 50);
|
||||||
@@ -158,10 +158,10 @@ void test_arc_click_area_with_adv_hittest(void)
|
|||||||
TEST_ASSERT_EQUAL_UINT32(0, event_cnt);
|
TEST_ASSERT_EQUAL_UINT32(0, event_cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dummy_event_cb(lv_event_t * e)
|
static void dummy_event_cb(lv_event_t * e)
|
||||||
{
|
{
|
||||||
LV_UNUSED(e);
|
LV_UNUSED(e);
|
||||||
event_cnt++;
|
event_cnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
#include "lv_test_indev.h"
|
#include "lv_test_indev.h"
|
||||||
|
|
||||||
static lv_obj_t *active_screen = NULL;
|
static lv_obj_t * active_screen = NULL;
|
||||||
static lv_obj_t *bar = NULL;
|
static lv_obj_t * bar = NULL;
|
||||||
|
|
||||||
void setUp(void)
|
void setUp(void)
|
||||||
{
|
{
|
||||||
@@ -67,7 +67,7 @@ void test_bar_should_update_indicator_right_coordinate_based_on_bar_value(void)
|
|||||||
lv_test_indev_wait(50);
|
lv_test_indev_wait(50);
|
||||||
|
|
||||||
int32_t actual_coord = lv_area_get_width(&bar_ptr->indic_area);
|
int32_t actual_coord = lv_area_get_width(&bar_ptr->indic_area);
|
||||||
|
|
||||||
/* Calculate bar indicator right coordinate, using rule of 3 */
|
/* Calculate bar indicator right coordinate, using rule of 3 */
|
||||||
lv_coord_t bar_max_value = lv_bar_get_max_value(bar);
|
lv_coord_t bar_max_value = lv_bar_get_max_value(bar);
|
||||||
lv_coord_t indicator_part_width = lv_obj_get_content_width(bar);
|
lv_coord_t indicator_part_width = lv_obj_get_content_width(bar);
|
||||||
|
|||||||
@@ -12,16 +12,16 @@ void test_checkbox_should_have_default_text_when_created(void);
|
|||||||
void test_checkbox_should_return_dinamically_allocated_text(void);
|
void test_checkbox_should_return_dinamically_allocated_text(void);
|
||||||
void test_checkbox_should_allocate_memory_for_static_text(void);
|
void test_checkbox_should_allocate_memory_for_static_text(void);
|
||||||
|
|
||||||
static lv_obj_t *active_screen = NULL;
|
static lv_obj_t * active_screen = NULL;
|
||||||
static lv_obj_t *checkbox = NULL;
|
static lv_obj_t * checkbox = NULL;
|
||||||
|
|
||||||
static volatile bool event_called = false;
|
static volatile bool event_called = false;
|
||||||
|
|
||||||
static void event_handler(lv_event_t *e)
|
static void event_handler(lv_event_t * e)
|
||||||
{
|
{
|
||||||
lv_event_code_t code = lv_event_get_code(e);
|
lv_event_code_t code = lv_event_get_code(e);
|
||||||
|
|
||||||
if (LV_EVENT_VALUE_CHANGED == code) {
|
if(LV_EVENT_VALUE_CHANGED == code) {
|
||||||
event_called = true;
|
event_called = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38,20 +38,20 @@ void test_checkbox_should_call_event_handler_on_click_when_enabled(void)
|
|||||||
{
|
{
|
||||||
active_screen = lv_scr_act();
|
active_screen = lv_scr_act();
|
||||||
checkbox = lv_checkbox_create(active_screen);
|
checkbox = lv_checkbox_create(active_screen);
|
||||||
|
|
||||||
lv_obj_add_state(checkbox, LV_STATE_CHECKED);
|
lv_obj_add_state(checkbox, LV_STATE_CHECKED);
|
||||||
lv_obj_add_event_cb(checkbox, event_handler, LV_EVENT_ALL, NULL);
|
lv_obj_add_event_cb(checkbox, event_handler, LV_EVENT_ALL, NULL);
|
||||||
|
|
||||||
lv_test_mouse_click_at(checkbox->coords.x1, checkbox->coords.y1);
|
lv_test_mouse_click_at(checkbox->coords.x1, checkbox->coords.y1);
|
||||||
|
|
||||||
TEST_ASSERT_TRUE(event_called);
|
TEST_ASSERT_TRUE(event_called);
|
||||||
|
|
||||||
event_called = false;
|
event_called = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_checkbox_should_have_default_text_when_created(void)
|
void test_checkbox_should_have_default_text_when_created(void)
|
||||||
{
|
{
|
||||||
const char *default_text = "Check box";
|
const char * default_text = "Check box";
|
||||||
|
|
||||||
active_screen = lv_scr_act();
|
active_screen = lv_scr_act();
|
||||||
checkbox = lv_checkbox_create(active_screen);
|
checkbox = lv_checkbox_create(active_screen);
|
||||||
@@ -62,7 +62,7 @@ void test_checkbox_should_have_default_text_when_created(void)
|
|||||||
|
|
||||||
void test_checkbox_should_return_dinamically_allocated_text(void)
|
void test_checkbox_should_return_dinamically_allocated_text(void)
|
||||||
{
|
{
|
||||||
const char *message = "Hello World!";
|
const char * message = "Hello World!";
|
||||||
|
|
||||||
active_screen = lv_scr_act();
|
active_screen = lv_scr_act();
|
||||||
checkbox = lv_checkbox_create(active_screen);
|
checkbox = lv_checkbox_create(active_screen);
|
||||||
@@ -76,7 +76,7 @@ void test_checkbox_should_return_dinamically_allocated_text(void)
|
|||||||
void test_checkbox_should_allocate_memory_for_static_text(void)
|
void test_checkbox_should_allocate_memory_for_static_text(void)
|
||||||
{
|
{
|
||||||
uint32_t initial_available_memory = 0;
|
uint32_t initial_available_memory = 0;
|
||||||
const char *static_text = "Keep me while you exist";
|
const char * static_text = "Keep me while you exist";
|
||||||
|
|
||||||
lv_mem_monitor_t m1;
|
lv_mem_monitor_t m1;
|
||||||
lv_mem_monitor(&m1);
|
lv_mem_monitor(&m1);
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ void test_config(void);
|
|||||||
|
|
||||||
void test_config(void)
|
void test_config(void)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_EQUAL(130, LV_DPI_DEF);
|
TEST_ASSERT_EQUAL(130, LV_DPI_DEF);
|
||||||
TEST_ASSERT_EQUAL(130, lv_disp_get_dpi(NULL));
|
TEST_ASSERT_EQUAL(130, lv_disp_get_dpi(NULL));
|
||||||
TEST_ASSERT_EQUAL(800, LV_HOR_RES);
|
TEST_ASSERT_EQUAL(800, LV_HOR_RES);
|
||||||
TEST_ASSERT_EQUAL(800, lv_disp_get_hor_res(NULL));
|
TEST_ASSERT_EQUAL(800, lv_disp_get_hor_res(NULL));
|
||||||
TEST_ASSERT_EQUAL(480, LV_VER_RES);
|
TEST_ASSERT_EQUAL(480, LV_VER_RES);
|
||||||
TEST_ASSERT_EQUAL(480, lv_disp_get_ver_res(NULL));
|
TEST_ASSERT_EQUAL(480, lv_disp_get_ver_res(NULL));
|
||||||
TEST_ASSERT_EQUAL(32, LV_COLOR_DEPTH);
|
TEST_ASSERT_EQUAL(32, LV_COLOR_DEPTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
static void loop_through_stress_test(void)
|
static void loop_through_stress_test(void)
|
||||||
{
|
{
|
||||||
#if LV_USE_DEMO_STRESS
|
#if LV_USE_DEMO_STRESS
|
||||||
lv_test_indev_wait(LV_DEMO_STRESS_TIME_STEP*33); /* FIXME: remove magic number of states */
|
lv_test_indev_wait(LV_DEMO_STRESS_TIME_STEP * 33); /* FIXME: remove magic number of states */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
void test_demo_stress(void)
|
void test_demo_stress(void)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "unity/unity.h"
|
#include "unity/unity.h"
|
||||||
|
|
||||||
static void event_object_deletion_cb(const lv_obj_class_t *cls, lv_event_t *e)
|
static void event_object_deletion_cb(const lv_obj_class_t * cls, lv_event_t * e)
|
||||||
{
|
{
|
||||||
LV_UNUSED(cls);
|
LV_UNUSED(cls);
|
||||||
if(lv_event_get_code(e) == LV_EVENT_VALUE_CHANGED) {
|
if(lv_event_get_code(e) == LV_EVENT_VALUE_CHANGED) {
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ static int compare_fonts(lv_font_t * f1, lv_font_t * f2)
|
|||||||
TEST_ASSERT_NOT_NULL_MESSAGE(f1, "font not null");
|
TEST_ASSERT_NOT_NULL_MESSAGE(f1, "font not null");
|
||||||
TEST_ASSERT_NOT_NULL_MESSAGE(f2, "font not null");
|
TEST_ASSERT_NOT_NULL_MESSAGE(f2, "font not null");
|
||||||
|
|
||||||
// Skip these test because -Wpedantic tells
|
// Skip these test because -Wpedantic tells
|
||||||
// ISO C forbids passing argument 1 of ‘lv_test_assert_ptr_eq’ between function pointer and ‘void *’
|
// ISO C forbids passing argument 1 of ‘lv_test_assert_ptr_eq’ between function pointer and ‘void *’
|
||||||
// TEST_ASSERT_EQUAL_PTR_MESSAGE(f1->get_glyph_dsc, f2->get_glyph_dsc, "glyph_dsc");
|
// TEST_ASSERT_EQUAL_PTR_MESSAGE(f1->get_glyph_dsc, f2->get_glyph_dsc, "glyph_dsc");
|
||||||
// TEST_ASSERT_EQUAL_PTR_MESSAGE(f1->get_glyph_bitmap, f2->get_glyph_bitmap, "glyph_bitmap");
|
// TEST_ASSERT_EQUAL_PTR_MESSAGE(f1->get_glyph_bitmap, f2->get_glyph_bitmap, "glyph_bitmap");
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_INT_MESSAGE(f1->line_height, f2->line_height, "line_height");
|
TEST_ASSERT_EQUAL_INT_MESSAGE(f1->line_height, f2->line_height, "line_height");
|
||||||
TEST_ASSERT_EQUAL_INT_MESSAGE(f1->base_line, f2->base_line, "base_line");
|
TEST_ASSERT_EQUAL_INT_MESSAGE(f1->base_line, f2->base_line, "base_line");
|
||||||
@@ -96,10 +96,10 @@ static int compare_fonts(lv_font_t * f1, lv_font_t * f2)
|
|||||||
TEST_ASSERT_TRUE_MESSAGE(cmaps1->unicode_list && cmaps2->unicode_list, "unicode_list");
|
TEST_ASSERT_TRUE_MESSAGE(cmaps1->unicode_list && cmaps2->unicode_list, "unicode_list");
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(
|
TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(
|
||||||
(uint8_t *)cmaps1->unicode_list,
|
(uint8_t *)cmaps1->unicode_list,
|
||||||
(uint8_t *)cmaps2->unicode_list,
|
(uint8_t *)cmaps2->unicode_list,
|
||||||
sizeof(uint16_t) * cmaps1->list_length,
|
sizeof(uint16_t) * cmaps1->list_length,
|
||||||
"unicode_list");
|
"unicode_list");
|
||||||
total_glyphs += cmaps1->list_length;
|
total_glyphs += cmaps1->list_length;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -119,45 +119,45 @@ static int compare_fonts(lv_font_t * f1, lv_font_t * f2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// kern_dsc
|
// kern_dsc
|
||||||
if (dsc1->kern_classes == 1 && dsc2->kern_classes == 1) {
|
if(dsc1->kern_classes == 1 && dsc2->kern_classes == 1) {
|
||||||
lv_font_fmt_txt_kern_classes_t * kern1 = (lv_font_fmt_txt_kern_classes_t *)dsc1->kern_dsc;
|
lv_font_fmt_txt_kern_classes_t * kern1 = (lv_font_fmt_txt_kern_classes_t *)dsc1->kern_dsc;
|
||||||
lv_font_fmt_txt_kern_classes_t * kern2 = (lv_font_fmt_txt_kern_classes_t *)dsc2->kern_dsc;
|
lv_font_fmt_txt_kern_classes_t * kern2 = (lv_font_fmt_txt_kern_classes_t *)dsc2->kern_dsc;
|
||||||
if (kern1 != NULL && kern2 != NULL) {
|
if(kern1 != NULL && kern2 != NULL) {
|
||||||
TEST_ASSERT_EQUAL_INT_MESSAGE(kern1->right_class_cnt, kern2->right_class_cnt, "right_class_cnt");
|
TEST_ASSERT_EQUAL_INT_MESSAGE(kern1->right_class_cnt, kern2->right_class_cnt, "right_class_cnt");
|
||||||
TEST_ASSERT_EQUAL_INT_MESSAGE(kern1->left_class_cnt, kern2->left_class_cnt, "left_class_cnt");
|
TEST_ASSERT_EQUAL_INT_MESSAGE(kern1->left_class_cnt, kern2->left_class_cnt, "left_class_cnt");
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(
|
TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(
|
||||||
(uint8_t *)kern1->left_class_mapping,
|
(uint8_t *)kern1->left_class_mapping,
|
||||||
(uint8_t *)kern2->left_class_mapping,
|
(uint8_t *)kern2->left_class_mapping,
|
||||||
kern1->left_class_cnt,
|
kern1->left_class_cnt,
|
||||||
"left_class_mapping");
|
"left_class_mapping");
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(
|
TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(
|
||||||
(uint8_t *)kern1->right_class_mapping,
|
(uint8_t *)kern1->right_class_mapping,
|
||||||
(uint8_t *)kern2->right_class_mapping,
|
(uint8_t *)kern2->right_class_mapping,
|
||||||
kern1->right_class_cnt,
|
kern1->right_class_cnt,
|
||||||
"right_class_mapping");
|
"right_class_mapping");
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(
|
TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(
|
||||||
(uint8_t *)kern1->class_pair_values,
|
(uint8_t *)kern1->class_pair_values,
|
||||||
(uint8_t *)kern2->class_pair_values,
|
(uint8_t *)kern2->class_pair_values,
|
||||||
kern1->right_class_cnt * kern1->left_class_cnt,
|
kern1->right_class_cnt * kern1->left_class_cnt,
|
||||||
"class_pair_values");
|
"class_pair_values");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TEST_ASSERT_EQUAL_PTR_MESSAGE(kern1, kern2, "kern");
|
TEST_ASSERT_EQUAL_PTR_MESSAGE(kern1, kern2, "kern");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (dsc1->kern_classes == 0 && dsc2->kern_classes == 0) {
|
else if(dsc1->kern_classes == 0 && dsc2->kern_classes == 0) {
|
||||||
lv_font_fmt_txt_kern_pair_t * kern1 = (lv_font_fmt_txt_kern_pair_t *)dsc1->kern_dsc;
|
lv_font_fmt_txt_kern_pair_t * kern1 = (lv_font_fmt_txt_kern_pair_t *)dsc1->kern_dsc;
|
||||||
lv_font_fmt_txt_kern_pair_t * kern2 = (lv_font_fmt_txt_kern_pair_t *)dsc2->kern_dsc;
|
lv_font_fmt_txt_kern_pair_t * kern2 = (lv_font_fmt_txt_kern_pair_t *)dsc2->kern_dsc;
|
||||||
if (kern1 != NULL && kern2 != NULL) {
|
if(kern1 != NULL && kern2 != NULL) {
|
||||||
TEST_ASSERT_EQUAL_INT_MESSAGE(kern1->glyph_ids_size, kern2->glyph_ids_size, "glyph_ids_size");
|
TEST_ASSERT_EQUAL_INT_MESSAGE(kern1->glyph_ids_size, kern2->glyph_ids_size, "glyph_ids_size");
|
||||||
TEST_ASSERT_EQUAL_INT_MESSAGE(kern1->pair_cnt, kern2->pair_cnt, "pair_cnt");
|
TEST_ASSERT_EQUAL_INT_MESSAGE(kern1->pair_cnt, kern2->pair_cnt, "pair_cnt");
|
||||||
|
|
||||||
int ids_size;
|
int ids_size;
|
||||||
|
|
||||||
if (kern1->glyph_ids_size == 0) {
|
if(kern1->glyph_ids_size == 0) {
|
||||||
ids_size = sizeof(int8_t) * 2 * kern1->pair_cnt;
|
ids_size = sizeof(int8_t) * 2 * kern1->pair_cnt;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -166,10 +166,10 @@ static int compare_fonts(lv_font_t * f1, lv_font_t * f2)
|
|||||||
|
|
||||||
TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(kern1->glyph_ids, kern2->glyph_ids, ids_size, "glyph_ids");
|
TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(kern1->glyph_ids, kern2->glyph_ids, ids_size, "glyph_ids");
|
||||||
TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(
|
TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(
|
||||||
(uint8_t * ) kern1->values,
|
(uint8_t *) kern1->values,
|
||||||
(uint8_t * ) kern2->values,
|
(uint8_t *) kern2->values,
|
||||||
kern1->pair_cnt,
|
kern1->pair_cnt,
|
||||||
"glyph_values");
|
"glyph_values");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,14 +177,14 @@ static int compare_fonts(lv_font_t * f1, lv_font_t * f2)
|
|||||||
lv_font_fmt_txt_glyph_dsc_t * glyph_dsc2 = (lv_font_fmt_txt_glyph_dsc_t *)dsc2->glyph_dsc;
|
lv_font_fmt_txt_glyph_dsc_t * glyph_dsc2 = (lv_font_fmt_txt_glyph_dsc_t *)dsc2->glyph_dsc;
|
||||||
|
|
||||||
for(int i = 0; i < total_glyphs; ++i) {
|
for(int i = 0; i < total_glyphs; ++i) {
|
||||||
if (i < total_glyphs - 1) {
|
if(i < total_glyphs - 1) {
|
||||||
int size1 = glyph_dsc1[i+1].bitmap_index - glyph_dsc1[i].bitmap_index;
|
int size1 = glyph_dsc1[i + 1].bitmap_index - glyph_dsc1[i].bitmap_index;
|
||||||
|
|
||||||
if (size1 > 0) {
|
if(size1 > 0) {
|
||||||
TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(
|
TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(
|
||||||
dsc1->glyph_bitmap + glyph_dsc1[i].bitmap_index,
|
dsc1->glyph_bitmap + glyph_dsc1[i].bitmap_index,
|
||||||
dsc2->glyph_bitmap + glyph_dsc2[i].bitmap_index,
|
dsc2->glyph_bitmap + glyph_dsc2[i].bitmap_index,
|
||||||
size1 - 1, "glyph_bitmap");
|
size1 - 1, "glyph_bitmap");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TEST_ASSERT_EQUAL_INT_MESSAGE(glyph_dsc1[i].adv_w, glyph_dsc2[i].adv_w, "adv_w");
|
TEST_ASSERT_EQUAL_INT_MESSAGE(glyph_dsc1[i].adv_w, glyph_dsc2[i].adv_w, "adv_w");
|
||||||
|
|||||||
@@ -8,32 +8,32 @@ void test_obj_tree_2(void);
|
|||||||
|
|
||||||
void test_obj_tree_1(void)
|
void test_obj_tree_1(void)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(lv_scr_act()), 0);
|
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(lv_scr_act()), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_obj_tree_2(void)
|
void test_obj_tree_2(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
lv_obj_create(lv_scr_act());
|
lv_obj_create(lv_scr_act());
|
||||||
lv_obj_t * o2 = lv_obj_create(lv_scr_act());
|
lv_obj_t * o2 = lv_obj_create(lv_scr_act());
|
||||||
lv_obj_create(lv_scr_act());
|
lv_obj_create(lv_scr_act());
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(lv_scr_act()), 3);
|
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(lv_scr_act()), 3);
|
||||||
|
|
||||||
lv_obj_del(o2);
|
lv_obj_del(o2);
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(lv_scr_act()), 2);
|
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(lv_scr_act()), 2);
|
||||||
|
|
||||||
lv_obj_clean(lv_scr_act());
|
lv_obj_clean(lv_scr_act());
|
||||||
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(lv_scr_act()), 0);
|
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(lv_scr_act()), 0);
|
||||||
|
|
||||||
lv_color_t c1 = lv_color_hex(0x444444);
|
lv_color_t c1 = lv_color_hex(0x444444);
|
||||||
lv_color_t c2 = lv_color_hex3(0x444);
|
lv_color_t c2 = lv_color_hex3(0x444);
|
||||||
TEST_ASSERT_EQUAL_COLOR(c1, c2);
|
TEST_ASSERT_EQUAL_COLOR(c1, c2);
|
||||||
|
|
||||||
lv_obj_remove_style_all(lv_scr_act());
|
lv_obj_remove_style_all(lv_scr_act());
|
||||||
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0x112233), 0);
|
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0x112233), 0);
|
||||||
lv_obj_set_style_bg_opa(lv_scr_act(), LV_OPA_COVER, 0);
|
lv_obj_set_style_bg_opa(lv_scr_act(), LV_OPA_COVER, 0);
|
||||||
|
|
||||||
//TEST_ASSERT_EQUAL_SCREENSHOT("scr1.png")
|
//TEST_ASSERT_EQUAL_SCREENSHOT("scr1.png")
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ void test_snapshot_should_not_leak_memory(void)
|
|||||||
uint32_t final_available_memory = 0;
|
uint32_t final_available_memory = 0;
|
||||||
lv_mem_monitor_t monitor;
|
lv_mem_monitor_t monitor;
|
||||||
|
|
||||||
lv_img_dsc_t *snapshots[NUM_SNAPSHOTS] = {NULL};
|
lv_img_dsc_t * snapshots[NUM_SNAPSHOTS] = {NULL};
|
||||||
|
|
||||||
lv_mem_monitor(&monitor);
|
lv_mem_monitor(&monitor);
|
||||||
initial_available_memory = monitor.free_size;
|
initial_available_memory = monitor.free_size;
|
||||||
@@ -24,11 +24,11 @@ void test_snapshot_should_not_leak_memory(void)
|
|||||||
snapshots[idx] = lv_snapshot_take(lv_scr_act(), LV_IMG_CF_TRUE_COLOR_ALPHA);
|
snapshots[idx] = lv_snapshot_take(lv_scr_act(), LV_IMG_CF_TRUE_COLOR_ALPHA);
|
||||||
TEST_ASSERT_NOT_NULL(snapshots[idx]);
|
TEST_ASSERT_NOT_NULL(snapshots[idx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(idx = 0; idx < NUM_SNAPSHOTS; idx++) {
|
for(idx = 0; idx < NUM_SNAPSHOTS; idx++) {
|
||||||
lv_snapshot_free(snapshots[idx]);
|
lv_snapshot_free(snapshots[idx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_mem_monitor(&monitor);
|
lv_mem_monitor(&monitor);
|
||||||
final_available_memory = monitor.free_size;
|
final_available_memory = monitor.free_size;
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
#define SWITCHES_CNT 10
|
#define SWITCHES_CNT 10
|
||||||
|
|
||||||
uint8_t value_changed_event_cnt = 0;
|
uint8_t value_changed_event_cnt = 0;
|
||||||
lv_obj_t *scr = NULL;
|
lv_obj_t * scr = NULL;
|
||||||
lv_obj_t *sw = NULL;
|
lv_obj_t * sw = NULL;
|
||||||
|
|
||||||
void setUp(void)
|
void setUp(void)
|
||||||
{
|
{
|
||||||
@@ -30,11 +30,11 @@ static void mouse_click_on_switch(void)
|
|||||||
lv_test_mouse_click_at(sw->coords.x1, sw->coords.y1);
|
lv_test_mouse_click_at(sw->coords.x1, sw->coords.y1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void event_handler(lv_event_t *e)
|
static void event_handler(lv_event_t * e)
|
||||||
{
|
{
|
||||||
lv_event_code_t event = lv_event_get_code(e);
|
lv_event_code_t event = lv_event_get_code(e);
|
||||||
|
|
||||||
if (LV_EVENT_VALUE_CHANGED == event) {
|
if(LV_EVENT_VALUE_CHANGED == event) {
|
||||||
value_changed_event_cnt++;
|
value_changed_event_cnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,19 +52,19 @@ void test_switch_should_not_leak_memory_after_deletion(void)
|
|||||||
uint32_t initial_available_memory = 0;
|
uint32_t initial_available_memory = 0;
|
||||||
uint32_t final_available_memory = 0;
|
uint32_t final_available_memory = 0;
|
||||||
lv_mem_monitor_t monitor;
|
lv_mem_monitor_t monitor;
|
||||||
lv_obj_t *switches[SWITCHES_CNT] = {NULL};
|
lv_obj_t * switches[SWITCHES_CNT] = {NULL};
|
||||||
|
|
||||||
lv_mem_monitor(&monitor);
|
lv_mem_monitor(&monitor);
|
||||||
initial_available_memory = monitor.free_size;
|
initial_available_memory = monitor.free_size;
|
||||||
|
|
||||||
for (idx = 0; idx < SWITCHES_CNT; idx++) {
|
for(idx = 0; idx < SWITCHES_CNT; idx++) {
|
||||||
switches[idx] = lv_switch_create(scr);
|
switches[idx] = lv_switch_create(scr);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (idx = 0; idx < SWITCHES_CNT; idx++) {
|
for(idx = 0; idx < SWITCHES_CNT; idx++) {
|
||||||
lv_obj_del(switches[idx]);
|
lv_obj_del(switches[idx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_mem_monitor(&monitor);
|
lv_mem_monitor(&monitor);
|
||||||
final_available_memory = monitor.free_size;
|
final_available_memory = monitor.free_size;
|
||||||
|
|
||||||
|
|||||||
@@ -73,8 +73,8 @@ void test_txt_should_identify_space_after_parameter(void)
|
|||||||
|
|
||||||
void test_txt_should_insert_string_into_another(void)
|
void test_txt_should_insert_string_into_another(void)
|
||||||
{
|
{
|
||||||
const char *msg = "Hello ";
|
const char * msg = "Hello ";
|
||||||
const char *suffix = "World";
|
const char * suffix = "World";
|
||||||
char target[20] = {0};
|
char target[20] = {0};
|
||||||
size_t msg_len = strlen(msg);
|
size_t msg_len = strlen(msg);
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ void test_txt_should_insert_string_into_another(void)
|
|||||||
|
|
||||||
void test_txt_should_handle_null_pointers_when_inserting(void)
|
void test_txt_should_handle_null_pointers_when_inserting(void)
|
||||||
{
|
{
|
||||||
const char *msg = "Hello ";
|
const char * msg = "Hello ";
|
||||||
char target[20] = {0};
|
char target[20] = {0};
|
||||||
size_t msg_len = strlen(msg);
|
size_t msg_len = strlen(msg);
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ void test_txt_get_encoded_next_detect_invalid_4_byte_input(void)
|
|||||||
/* See #2615 for more information */
|
/* See #2615 for more information */
|
||||||
void test_txt_next_line_should_handle_empty_string(void)
|
void test_txt_next_line_should_handle_empty_string(void)
|
||||||
{
|
{
|
||||||
const lv_font_t *font_ptr = NULL;
|
const lv_font_t * font_ptr = NULL;
|
||||||
lv_coord_t letter_space = 0;
|
lv_coord_t letter_space = 0;
|
||||||
lv_coord_t max_width = 0;
|
lv_coord_t max_width = 0;
|
||||||
lv_text_flag_t flag = LV_TEXT_FLAG_NONE;
|
lv_text_flag_t flag = LV_TEXT_FLAG_NONE;
|
||||||
|
|||||||
Reference in New Issue
Block a user