unity_support.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef LV_UNITY_SUPPORT_H
  2. #define LV_UNITY_SUPPORT_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <stdbool.h>
  7. #include "../../lvgl.h"
  8. bool lv_test_assert_img_eq(const char * fn_ref);
  9. #if LV_COLOR_DEPTH != 32
  10. # define TEST_ASSERT_EQUAL_SCREENSHOT(path) TEST_IGNORE_MESSAGE("Requires LV_COLOR_DEPTH 32");
  11. # define TEST_ASSERT_EQUAL_SCREENSHOT_MESSAGE(path, msg) TEST_PRINTF(msg); TEST_IGNORE_MESSAGE("Requires LV_COLOR_DEPTH 32");
  12. #else
  13. # define TEST_ASSERT_EQUAL_SCREENSHOT(path) if(LV_HOR_RES != 800 || LV_VER_RES != 480) { \
  14. TEST_IGNORE_MESSAGE("Requires 800x480 resolution"); \
  15. } else { \
  16. TEST_ASSERT(lv_test_assert_img_eq(path)); \
  17. }
  18. # define TEST_ASSERT_EQUAL_SCREENSHOT_MESSAGE(path, msg) if(LV_HOR_RES != 800 || LV_VER_RES != 480) { \
  19. TEST_PRINTF(msg); \
  20. TEST_IGNORE_MESSAGE("Requires 800x480 resolution"); \
  21. } else { \
  22. TEST_ASSERT_MESSAGE(lv_test_assert_img_eq(path), msg); \
  23. }
  24. #endif
  25. # define TEST_ASSERT_EQUAL_COLOR(c1, c2) TEST_ASSERT_EQUAL_UINT32(c1.full, c2.full)
  26. # define TEST_ASSERT_EQUAL_COLOR_MESSAGE(c1, c2, msg) TEST_ASSERT_EQUAL_UINT32_MESSAGE(c1.full, c2.full, msg)
  27. #ifdef __cplusplus
  28. } /*extern "C"*/
  29. #endif
  30. #endif /*LV_UNITY_SUPPORT_H*/