acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
test_snapshot.c (968B)
1 #if LV_BUILD_TEST 2 #include "../lvgl.h" 3 4 #if LV_USE_SNAPSHOT 5 6 #include "unity/unity.h" 7 8 9 #define NUM_SNAPSHOTS 1 10 11 void test_snapshot_should_not_leak_memory(void) 12 { 13 uint32_t idx = 0; 14 uint32_t initial_available_memory = 0; 15 uint32_t final_available_memory = 0; 16 lv_mem_monitor_t monitor; 17 18 lv_img_dsc_t * snapshots[NUM_SNAPSHOTS] = {NULL}; 19 20 lv_mem_monitor(&monitor); 21 initial_available_memory = monitor.free_size; 22 23 for(idx = 0; idx < NUM_SNAPSHOTS; idx++) { 24 snapshots[idx] = lv_snapshot_take(lv_scr_act(), LV_IMG_CF_TRUE_COLOR_ALPHA); 25 TEST_ASSERT_NOT_NULL(snapshots[idx]); 26 } 27 28 for(idx = 0; idx < NUM_SNAPSHOTS; idx++) { 29 lv_snapshot_free(snapshots[idx]); 30 } 31 32 lv_mem_monitor(&monitor); 33 final_available_memory = monitor.free_size; 34 35 TEST_ASSERT_EQUAL(initial_available_memory, final_available_memory); 36 } 37 38 #else /*LV_USE_SNAPSHOT*/ 39 40 void test_snapshot_should_not_leak_memory(void) 41 { 42 43 } 44 45 #endif 46 47 #endif