#include <QGuiApplication>
#include <QtTest>

#include "window-thumbnail-config.h"

class window_thumbnail_config_test : public QObject
{
    Q_OBJECT

private slots:
    void realTimeThumbnailIsAlwaysEnabled();
    void nonWaylandPlatformUsesXThumbnail();
};

void window_thumbnail_config_test::realTimeThumbnailIsAlwaysEnabled()
{
    QVERIFY(WindowThumbnailConfig::realTimeThumbnailEnable());
}

void window_thumbnail_config_test::nonWaylandPlatformUsesXThumbnail()
{
    WindowThumbnailConfig config;

    QVERIFY(!qGuiApp->platformName().startsWith(QStringLiteral("wayland")));
    QVERIFY(config.xThumbnailEnable());
    QVERIFY(!config.pipewireThumbnailEnable());
    QVERIFY(!config.kywlcomWindowThumbnailEnable());
}

int main(int argc, char *argv[])
{
    qputenv("QT_QPA_PLATFORM", "offscreen");
    qputenv("QT_QPA_PLATFORMTHEME", "generic");
    qputenv("GSETTINGS_BACKEND", "memory");

    QGuiApplication app(argc, argv);
    window_thumbnail_config_test testCase;
    return QTest::qExec(&testCase, argc, argv);
}

#include "test-window-thumbnail-config.moc"
