summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-04-09 16:49:34 +0200
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-04-16 16:47:43 +0000
commitf3fad26bc9e0fde3bcf1625da731aeb02b04a7a5 (patch)
treebe126a58542a181646178a4bdb4c265bb6f7421d /tests
parent71e3ce7f0b671ac8bb6607d18d4fa16c6c81f737 (diff)
Add matching by GL_VENDOR to QOpenGLConfig
This will be essential on Linux, especially Embedded where PCI IDs are not that useful. Change-Id: I2fa8ca07236e8aae203e21fe629d12aab092c7fd Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/qopenglconfig/buglist.json8
-rw-r--r--tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp38
2 files changed, 33 insertions, 13 deletions
diff --git a/tests/auto/gui/qopenglconfig/buglist.json b/tests/auto/gui/qopenglconfig/buglist.json
index d2d06645aa..c7b8e61bc8 100644
--- a/tests/auto/gui/qopenglconfig/buglist.json
+++ b/tests/auto/gui/qopenglconfig/buglist.json
@@ -101,6 +101,14 @@
"features": [
"feature1"
]
+ },
+ {
+ "id": 128,
+ "description": "check for matching GL_VENDOR",
+ "gl_vendor": "The Qt Company",
+ "features": [
+ "cool_feature"
+ ]
}
]
}
diff --git a/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp b/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp
index bfb2623508..f88cbdc758 100644
--- a/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp
+++ b/tests/auto/gui/qopenglconfig/tst_qopenglconfig.cpp
@@ -217,6 +217,11 @@ void tst_QOpenGlConfig::testGlConfiguration()
context.doneCurrent();
qDebug().noquote() << '\n' << result;
+
+ // fromContext either uses the current context or creates a temporary dummy one.
+ QOpenGLConfig::Gpu gpu = QOpenGLConfig::Gpu::fromContext();
+ qDebug().noquote() << '\n' << "GL_VENDOR queried by QOpenGLConfig::Gpu:" << gpu.glVendor;
+ QVERIFY(!gpu.glVendor.isEmpty());
}
static inline QByteArray msgSetMismatch(const QSet<QString> &expected,
@@ -235,21 +240,28 @@ void tst_QOpenGlConfig::testBugList()
const QString fileName = QFINDTESTDATA("buglist.json");
QVERIFY(!fileName.isEmpty());
- QSet<QString> expectedFeatures;
- expectedFeatures << "feature1";
+ QSet<QString> expectedFeatures;
+ expectedFeatures << "feature1";
- QOpenGLConfig::Gpu gpu;
- gpu.vendorId = 0x10DE;
- gpu.deviceId = 0x0DE9;
+ QVersionNumber driverVersion(QVector<int>() << 9 << 18 << 13 << 4460);
+ QOpenGLConfig::Gpu gpu = QOpenGLConfig::Gpu::fromDevice(0x10DE, 0x0DE9, driverVersion);
-#ifdef Q_COMPILER_INITIALIZER_LISTS
- gpu.driverVersion = QVersionNumber({9, 18, 13, 4460});
-#else
- gpu.driverVersion = QVersionNumber(QVector<int>() << 9 << 18 << 13 << 4460);
-#endif
- const QSet<QString> actualFeatures =
- QOpenGLConfig::gpuFeatures(gpu, QStringLiteral("win"),
- QVersionNumber(6, 3), fileName);
+ QSet<QString> actualFeatures = QOpenGLConfig::gpuFeatures(gpu, QStringLiteral("win"),
+ QVersionNumber(6, 3), fileName);
+ QVERIFY2(expectedFeatures == actualFeatures,
+ msgSetMismatch(expectedFeatures, actualFeatures));
+
+ gpu = QOpenGLConfig::Gpu::fromGLVendor(QByteArrayLiteral("Somebody Else"));
+ expectedFeatures.clear();
+ actualFeatures = QOpenGLConfig::gpuFeatures(gpu, QStringLiteral("linux"),
+ QVersionNumber(1, 0), fileName);
+ QVERIFY2(expectedFeatures == actualFeatures,
+ msgSetMismatch(expectedFeatures, actualFeatures));
+
+ gpu = QOpenGLConfig::Gpu::fromGLVendor(QByteArrayLiteral("The Qt Company"));
+ expectedFeatures = QSet<QString>() << "cool_feature";
+ actualFeatures = QOpenGLConfig::gpuFeatures(gpu, QStringLiteral("linux"),
+ QVersionNumber(1, 0), fileName);
QVERIFY2(expectedFeatures == actualFeatures,
msgSetMismatch(expectedFeatures, actualFeatures));
}