Skip to content

ScreenshotAnalyzer#

A screenshot of the current window contents which can be analyzed in tests.

Header:#include <AUI/Test/UI/ScreenshotAnalyzer.h>
CMake:aui_link(my_target PUBLIC aui::uitests)

Detailed Description#

Most of the time, you don't need this class directly; averageColor and pixelColorAt assertions use it. Use it when you need something custom:

auto screenshot = ScreenshotAnalyzer::makeScreenshot().clip(By::name("#preview").one());
EXPECT_EQ(screenshot.image().size(), glm::uvec2(64, 64));

See Screenshots and pixels.

Public Methods#

makeScreenshot#


static ScreenshotAnalyzer ScreenshotAnalyzer::makeScreenshot()

Takes a screenshot of the current window.

Examples:

examples/ui/embedded_sdl/src/main.cpp

SDL3 — This code demonstrates how to integrate the AUI Framework with SDL3 to create a window with OpenGL rendering.

    }

    void destroyNativeWindow(ASurface& window) override {}

    AImage makeScreenshot() override {
        return {};
    }

    void beginPaint(ASurface& window) override {
        glBindFramebuffer(GL_FRAMEBUFFER, 0);