diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-09-05 15:17:53 +0200 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-09-13 09:42:47 +0200 |
commit | 04d92f9f9c16ace63a33ee18756ab8d40a1c1a66 (patch) | |
tree | f02c641e922bcc97bdd5e53a0f020361bbd1a902 | |
parent | 69f62dc8efc738dff1fac50f8a6d8b2b09e654cf (diff) |
lancelot graphics test: support shadow build and install
Use the QFINDTESTDATA mechanism to locate the test suite directory,
and add the data directory and qmlscenegrabber to the installs.
As a driveby, improve runtime by cutting down on needlessly long
waiting time between test scenes.
Change-Id: Id8452c843eef198d8548b196b0a2b5f0bc6be8ba
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r-- | tests/manual/scenegraph_lancelot/scenegraph/scenegraph.pro | 4 | ||||
-rw-r--r-- | tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp | 20 |
2 files changed, 15 insertions, 9 deletions
diff --git a/tests/manual/scenegraph_lancelot/scenegraph/scenegraph.pro b/tests/manual/scenegraph_lancelot/scenegraph/scenegraph.pro index 65819ab5bf..dd0ef268b1 100644 --- a/tests/manual/scenegraph_lancelot/scenegraph/scenegraph.pro +++ b/tests/manual/scenegraph_lancelot/scenegraph/scenegraph.pro @@ -9,3 +9,7 @@ SOURCES += tst_scenegraph.cpp # Include Lancelot protocol code to communicate with baseline server. # Assuming that we are in a normal Qt5 source code tree include(../../../../../qtbase/tests/baselineserver/shared/qbaselinetest.pri) + +TEST_HELPER_INSTALLS += .././qmlscenegrabber + +TESTDATA += ../data diff --git a/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp b/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp index 95188ec0f8..40b17ec2a2 100644 --- a/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp +++ b/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp @@ -68,6 +68,7 @@ private: bool renderAndGrab(const QString& qmlFile, const QStringList& extraArgs, QImage *screenshot, QString *errMsg); quint16 checksumFileOrDir(const QString &path); + QString testSuitePath; int consecutiveErrors; // Not test failures (image mismatches), but system failures (so no image at all) bool aborted; // This run given up because of too many system failures }; @@ -81,6 +82,14 @@ tst_Scenegraph::tst_Scenegraph() void tst_Scenegraph::initTestCase() { + QString dataDir = QFINDTESTDATA("../data/."); + if (dataDir.isEmpty()) + dataDir = QStringLiteral("data"); + QFileInfo fi(dataDir); + if (!fi.exists() || !fi.isDir() || !fi.isReadable()) + QSKIP("Test suite data directory missing or unreadable: " + fi.canonicalFilePath().toLatin1()); + testSuitePath = fi.canonicalFilePath(); + const char *backendVarName = "QT_QUICK_BACKEND"; const QString backend = qEnvironmentVariable(backendVarName, QString::fromLatin1("default")); QBaselineTest::addClientProperty(QString::fromLatin1(backendVarName), backend); @@ -95,7 +104,7 @@ void tst_Scenegraph::cleanup() { // Allow subsystems time to settle if (!aborted) - QTest::qWait(200); + QTest::qWait(20); } void tst_Scenegraph::testNoTextRendering_data() @@ -131,13 +140,6 @@ void tst_Scenegraph::setupTestSuite(const QByteArray& filter) QTest::addColumn<QString>("qmlFile"); int numItems = 0; - QString testSuiteDir = QLatin1String("data"); - QString testSuiteLocation = QCoreApplication::applicationDirPath(); - QString testSuitePath = testSuiteLocation + QDir::separator() + testSuiteDir; - QFileInfo fi(testSuitePath); - if (!fi.exists() || !fi.isDir() || !fi.isReadable()) - QSKIP("Test suite data directory missing or unreadable: " + testSuitePath.toLatin1()); - QStringList ignoreItems; QFile ignoreFile(testSuitePath + "/Ignore"); if (ignoreFile.open(QIODevice::ReadOnly)) { @@ -237,7 +239,7 @@ quint16 tst_Scenegraph::checksumFileOrDir(const QString &path) QFile f(path); f.open(QIODevice::ReadOnly); QByteArray contents = f.readAll(); - return qChecksum(contents.constData(), contents.size()); + return qChecksum(contents.constData(), uint(contents.size())); } if (fi.isDir()) { static const QStringList nameFilters = QStringList() << "*.qml" << "*.cpp" << "*.png" << "*.jpg"; |