screenshot_test.cpp¶
file tests/app/screenshot_test.cpp ยท Test suite
Hidden test that captures nmeasim::app::MainWindow for the documentation screenshots.
Source tests/app/screenshot_test.cpp
The test runs the default profile with a destination set (Aegina, so that the map and the dashboard show a leg), waits six seconds for the dashboard, the console and the map tiles to fill in, and saves the window at 1440 by 1000 pixels twice: in the night bridge theme as main-window.png and in the daylight theme as main-window-day.png. The documentation site and the AppStream metadata show both images from docs/assets/screenshots/.
The tag [.screenshot] starts with a dot, which hides the test: Catch2 runs it only when the tag is named on the command line, so ctest never runs it. Without the environment variable NMEASIM_SCREENSHOT_DIR the test skips itself. To regenerate the images from the repository root, with the build directory of a CMake preset such as dev:
export NMEASIM_SCREENSHOT_DIR=docs/assets/screenshots
build/dev/tests/nmeasim_app_tests "[.screenshot]"
The window is rendered by the offscreen platform set up in main.cpp. main.cpp also switches tile downloads off and gives the run an empty temporary tile cache, so this test switches its window's downloads back on: the map tiles are fetched from the tile server on every run, and the chart only appears with network access.
Test cases¶
1 test cases, in source order.
| Test case | Tags |
|---|---|
| capture the main window for the documentation | [.screenshot] |