1 2 #ifndef LV_UNITY_SUPPORT_H 3 #define LV_UNITY_SUPPORT_H 4 5 #ifdef __cplusplus 6 extern "C" { 7 #endif 8 9 #include <stdbool.h> 10 #include "../../lvgl.h" 11 #include "../src/lv_test_helpers.h" 12 13 bool lv_test_assert_image_eq(const char * fn_ref); 14 15 16 #if LV_COLOR_DEPTH != 32 17 # define TEST_ASSERT_EQUAL_SCREENSHOT(path) TEST_IGNORE_MESSAGE("Requires LV_COLOR_DEPTH 32"); 18 # define TEST_ASSERT_EQUAL_SCREENSHOT_MESSAGE(path, msg) TEST_PRINTF(msg); TEST_IGNORE_MESSAGE("Requires LV_COLOR_DEPTH 32"); 19 #else 20 21 # define TEST_ASSERT_EQUAL_SCREENSHOT(path) if(LV_HOR_RES != 800 || LV_VER_RES != 480) { \ 22 TEST_IGNORE_MESSAGE("Requires 800x480 resolution"); \ 23 } else { \ 24 TEST_ASSERT_MESSAGE(lv_test_assert_image_eq(path), path); \ 25 } 26 27 # define TEST_ASSERT_EQUAL_SCREENSHOT_MESSAGE(path, msg) if(LV_HOR_RES != 800 || LV_VER_RES != 480) { \ 28 TEST_PRINTF(msg); \ 29 TEST_IGNORE_MESSAGE("Requires 800x480 resolution"); \ 30 } else { \ 31 TEST_ASSERT_MESSAGE(lv_test_assert_image_eq(path), msg); \ 32 } 33 #endif 34 35 # define TEST_ASSERT_EQUAL_COLOR(c1, c2) TEST_ASSERT_TRUE(lv_color_eq(c1, c2)) 36 # define TEST_ASSERT_EQUAL_COLOR_MESSAGE(c1, c2, msg) TEST_ASSERT_TRUE(lv_color_eq(c1, c2), msg) 37 38 # define TEST_ASSERT_EQUAL_COLOR32(c1, c2) TEST_ASSERT_TRUE(lv_color32_eq(c1, c2)) 39 # define TEST_ASSERT_EQUAL_COLOR32_MESSAGE(c1, c2, msg) TEST_ASSERT_TRUE(lv_color32_eq(c1, c2), msg) 40 41 42 # define TEST_ASSERT_MEM_LEAK_LESS_THAN(prev_usage, threshold) TEST_ASSERT_LESS_OR_EQUAL(threshold, LV_ABS((int64_t)(prev_usage) - (int64_t)lv_test_get_free_mem())); 43 44 #ifdef __cplusplus 45 } /*extern "C"*/ 46 #endif 47 48 #endif /*LV_UNITY_SUPPORT_H*/ 49