2021-06-03 16:38:58 +02:00
|
|
|
|
|
|
|
#ifndef LV_UNITY_SUPPORT_H
|
|
|
|
#define LV_UNITY_SUPPORT_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2022-03-21 18:25:51 +08:00
|
|
|
#include <stdbool.h>
|
2021-06-03 16:38:58 +02:00
|
|
|
#include "../../lvgl.h"
|
2024-02-20 04:43:57 +08:00
|
|
|
#include "../src/lv_test_helpers.h"
|
2021-06-03 16:38:58 +02:00
|
|
|
|
2023-09-14 20:12:31 +02:00
|
|
|
bool lv_test_assert_image_eq(const char * fn_ref);
|
2021-06-03 16:38:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
#if LV_COLOR_DEPTH != 32
|
|
|
|
# define TEST_ASSERT_EQUAL_SCREENSHOT(path) TEST_IGNORE_MESSAGE("Requires LV_COLOR_DEPTH 32");
|
|
|
|
# define TEST_ASSERT_EQUAL_SCREENSHOT_MESSAGE(path, msg) TEST_PRINTF(msg); TEST_IGNORE_MESSAGE("Requires LV_COLOR_DEPTH 32");
|
|
|
|
#else
|
|
|
|
|
|
|
|
# define TEST_ASSERT_EQUAL_SCREENSHOT(path) if(LV_HOR_RES != 800 || LV_VER_RES != 480) { \
|
2023-02-20 20:50:58 +01:00
|
|
|
TEST_IGNORE_MESSAGE("Requires 800x480 resolution"); \
|
|
|
|
} else { \
|
2023-09-14 20:12:31 +02:00
|
|
|
TEST_ASSERT_MESSAGE(lv_test_assert_image_eq(path), path); \
|
2023-02-20 20:50:58 +01:00
|
|
|
}
|
2022-03-21 18:25:51 +08:00
|
|
|
|
2021-06-03 16:38:58 +02:00
|
|
|
# define TEST_ASSERT_EQUAL_SCREENSHOT_MESSAGE(path, msg) if(LV_HOR_RES != 800 || LV_VER_RES != 480) { \
|
2023-02-20 20:50:58 +01:00
|
|
|
TEST_PRINTF(msg); \
|
|
|
|
TEST_IGNORE_MESSAGE("Requires 800x480 resolution"); \
|
|
|
|
} else { \
|
2023-09-14 20:12:31 +02:00
|
|
|
TEST_ASSERT_MESSAGE(lv_test_assert_image_eq(path), msg); \
|
2023-02-20 20:50:58 +01:00
|
|
|
}
|
2021-06-03 16:38:58 +02:00
|
|
|
#endif
|
|
|
|
|
2023-07-05 13:05:19 +02:00
|
|
|
# define TEST_ASSERT_EQUAL_COLOR(c1, c2) TEST_ASSERT_TRUE(lv_color_eq(c1, c2))
|
|
|
|
# define TEST_ASSERT_EQUAL_COLOR_MESSAGE(c1, c2, msg) TEST_ASSERT_TRUE(lv_color_eq(c1, c2), msg)
|
2021-06-03 16:38:58 +02:00
|
|
|
|
2023-07-05 13:05:19 +02:00
|
|
|
# define TEST_ASSERT_EQUAL_COLOR32(c1, c2) TEST_ASSERT_TRUE(lv_color32_eq(c1, c2))
|
|
|
|
# define TEST_ASSERT_EQUAL_COLOR32_MESSAGE(c1, c2, msg) TEST_ASSERT_TRUE(lv_color32_eq(c1, c2), msg)
|
2023-02-20 20:50:58 +01:00
|
|
|
|
2023-09-25 10:49:54 +02:00
|
|
|
|
2024-02-20 04:43:57 +08:00
|
|
|
# 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()));
|
2023-09-25 10:49:54 +02:00
|
|
|
|
2021-06-03 16:38:58 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} /*extern "C"*/
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /*LV_UNITY_SUPPORT_H*/
|