lv_test_screenshot_compare.h

API reference for lv_test_screenshot_compare.h

Report on GitHub

Functions

lv_test_screenshot_compare

Invalidate and redraw the current screen and compare its content with a reference PNG image

  • If the reference image is not found it will be created automatically from the rendered screen.
  • If the compare fails an <image_name>_err.png file will be created with the rendered content next to the reference image.

It requires lodepng.

 
lv_test_screenshot_result_t lv_test_screenshot_compare(const char *fn_ref)
Parameters
NameTypeDescription
fn_refconst char *path to the reference image. Will be appended to REF_IMGS_PATH if set.

Returns: lv_test_screenshot_result_t — An element of lv_test_screenshot_result_t

This function assumes that the default display is the test display that was created by lv_test_display_create()

lv_test_screenshot_compare_core

Works the same way as lv_test_screenshot_compare but it doesn't invalidate and redraw the screen but uses its current content. (lv_refr_now(NULL) might be called earlier)

 
lv_test_screenshot_result_t lv_test_screenshot_compare_core(const char *fn_ref)
Parameters
NameTypeDescription
fn_refconst char *reference image path

Enums

lv_test_screenshot_result_t

Return value of lv_test_screenshot_compare

NameDescription
LV_TEST_SCREENSHOT_RESULT_FAILEDThe screenshot is different than the reference image
LV_TEST_SCREENSHOT_RESULT_PASSEDThe screenshot is the same as the reference image. It is also returned if LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE is enabled and the reference image was missing.
LV_TEST_SCREENSHOT_RESULT_NO_REFERENCE_IMAGEIf LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE is not enabled and the reference image is missing.

Dependencies

Indirect dependencies

How is this guide?

Last updated on

On this page