# lv_test_screenshot_compare.h (/api/debugging/test/lv_test_screenshot_compare_h)



<ApiSummary functions="2" enums="1" />

Functions [#functions]

<ApiMember kind="function" name="lv_test_screenshot_compare" file="debugging/test/lv_test_screenshot_compare.h" line="67" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/debugging/test/lv_test_screenshot_compare.h#L67">
  lv_test_screenshot_compare [#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.

  ```c title=" " lineNumbers=1
  lv_test_screenshot_result_t lv_test_screenshot_compare(const char *fn_ref)
  ```

  <span className="sr-only">
    Parameters
  </span>

  | Name     | Type           | Description                                                              |
  | -------- | -------------- | ------------------------------------------------------------------------ |
  | `fn_ref` | `const char *` | path to the reference image. Will be appended to REF\_IMGS\_PATH if set. |

  **Returns:** <ApiLink name="lv_test_screenshot_result_t" /> — An element of `lv_test_screenshot_result_t`

  <Callout type="info">
    This function assumes that the default display is the test display that was created by <ApiLink name="lv_test_display_create" display="lv_test_display_create()" />
  </Callout>
</ApiMember>

<ApiMember kind="function" name="lv_test_screenshot_compare_core" file="debugging/test/lv_test_screenshot_compare.h" line="75" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/debugging/test/lv_test_screenshot_compare.h#L75">
  lv_test_screenshot_compare_core [#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)

  ```c title=" " lineNumbers=1
  lv_test_screenshot_result_t lv_test_screenshot_compare_core(const char *fn_ref)
  ```

  <span className="sr-only">
    Parameters
  </span>

  | Name     | Type           | Description          |
  | -------- | -------------- | -------------------- |
  | `fn_ref` | `const char *` | reference image path |
</ApiMember>

Enums [#enums]

<ApiMember kind="enum" name="lv_test_screenshot_result_t" file="debugging/test/lv_test_screenshot_compare.h" line="30" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/debugging/test/lv_test_screenshot_compare.h#L30">
  lv_test_screenshot_result_t [#lv_test_screenshot_result_t]

  Return value of `lv_test_screenshot_compare`

  | Name                                           | Description                                                                                                                                                           |
  | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `LV_TEST_SCREENSHOT_RESULT_FAILED`             | The screenshot is different than the reference image                                                                                                                  |
  | `LV_TEST_SCREENSHOT_RESULT_PASSED`             | The 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_IMAGE` | If `LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE` is not enabled and the reference image is missing.                                                                     |
</ApiMember>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_conf_internal.h&#x22;]" includedBy="[&#x22;lv_test.h&#x22;]" transitiveIncludes="[&#x22;lv_conf_kconfig.h&#x22;]" />
