From 49ea02f435876d514898d587700a21e1a8972f09 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 7 Aug 2015 09:42:41 +0200 Subject: [PATCH] windows: Verify the built-in GPU blacklist in autotests Have an autotest to prevent introducing JSON syntax errors that become apparent only at runtime. Change-Id: If2bcbf4d227fddcbeb9c095b7986bada078131d7 Reviewed-by: Giuseppe D'Angelo Reviewed-by: Friedemann Kleint --- .../auto/gui/qopenglconfig/tst_qopenglconfig.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp b/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp index 3bf59910f3b..48a15641b21 100644 --- a/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp +++ b/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include @@ -107,6 +108,7 @@ private slots: void testConfiguration(); void testGlConfiguration(); void testBugList(); + void testDefaultWindowsBlacklist(); }; static void dumpConfiguration(QTextStream &str) @@ -284,6 +286,20 @@ void tst_QOpenGlConfig::testBugList() msgSetMismatch(expectedFeatures, actualFeatures)); } +void tst_QOpenGlConfig::testDefaultWindowsBlacklist() +{ + if (qGuiApp->platformName() != QStringLiteral("windows")) + QSKIP("Only applicable to Windows"); + + QFile f(QStringLiteral(":/qt-project.org/windows/openglblacklists/default.json")); + QVERIFY(f.open(QIODevice::ReadOnly | QIODevice::Text)); + QJsonParseError err; + QJsonDocument doc = QJsonDocument::fromJson(f.readAll(), &err); + QVERIFY2(err.error == 0, + QStringLiteral("Failed to parse built-in Windows GPU blacklist. %1 : %2") + .arg(err.offset).arg(err.errorString()).toLatin1()); +} + QTEST_MAIN(tst_QOpenGlConfig) #include "tst_qopenglconfig.moc"