diff options
author | Eirik Aavitsland <[email protected]> | 2022-01-10 15:16:18 +0100 |
---|---|---|
committer | Eirik Aavitsland <[email protected]> | 2022-01-13 14:56:37 +0100 |
commit | 7719fcea4b174da078b6630df24345c63e6cc75d (patch) | |
tree | ce2200c31efb0abf7ee84b5b16ddc2cfce14103e | |
parent | 657a18c7faac28d7025350834dc7686e689ac358 (diff) |
Add a couple of utility functions to the baseline test framework
Adds a function for setting the baseline Project name, which selects
the top level server directory and hence config settings.
Also adds a function that lets the client override the server config
setting for the project image keys (ItemPathKeys). This is the list of
properties that will be used to determine which clients are "the
same", i.e. which baseline to compare against. Overriding that is
handy since it allows experimentation and customization of clients
without involving changes in the project config on the baseline
server.
Pick-to: 6.3 6.2
Change-Id: Id3998356494a9a2cb71c009b43593d3dc1b6963a
Reviewed-by: Volker Hilsheimer <[email protected]>
Reviewed-by: Axel Spoerl <[email protected]>
-rw-r--r-- | tests/baseline/shared/baselineprotocol.cpp | 1 | ||||
-rw-r--r-- | tests/baseline/shared/baselineprotocol.h | 1 | ||||
-rw-r--r-- | tests/baseline/shared/qbaselinetest.cpp | 16 | ||||
-rw-r--r-- | tests/baseline/shared/qbaselinetest.h | 2 | ||||
-rw-r--r-- | tests/baseline/shared/qwidgetbaselinetest.cpp | 2 |
5 files changed, 19 insertions, 3 deletions
diff --git a/tests/baseline/shared/baselineprotocol.cpp b/tests/baseline/shared/baselineprotocol.cpp index 33620fbe5c4..297574744de 100644 --- a/tests/baseline/shared/baselineprotocol.cpp +++ b/tests/baseline/shared/baselineprotocol.cpp @@ -42,6 +42,7 @@ #include <QRegularExpression> const QString PI_Project(QLS("Project")); +const QString PI_ProjectImageKeys(QLS("ProjectImageKeys")); const QString PI_TestCase(QLS("TestCase")); const QString PI_HostName(QLS("HostName")); const QString PI_HostAddress(QLS("HostAddress")); diff --git a/tests/baseline/shared/baselineprotocol.h b/tests/baseline/shared/baselineprotocol.h index 4151d30c9c0..3786c3390af 100644 --- a/tests/baseline/shared/baselineprotocol.h +++ b/tests/baseline/shared/baselineprotocol.h @@ -43,6 +43,7 @@ #define FileFormat "png" extern const QString PI_Project; +extern const QString PI_ProjectImageKeys; extern const QString PI_TestCase; extern const QString PI_HostName; extern const QString PI_HostAddress; diff --git a/tests/baseline/shared/qbaselinetest.cpp b/tests/baseline/shared/qbaselinetest.cpp index 004d8013f1c..493be4bd7a4 100644 --- a/tests/baseline/shared/qbaselinetest.cpp +++ b/tests/baseline/shared/qbaselinetest.cpp @@ -238,8 +238,10 @@ bool connectToBaselineServer(QByteArray *msg, const QString &testProject, const bool dummy; QByteArray dummyMsg; - definedTestProject = testProject; - definedTestCase = testCase; + if (!testProject.isEmpty()) + definedTestProject = testProject; + if (!testCase.isEmpty()) + definedTestCase = testCase; return connect(msg ? msg : &dummyMsg, &dummy); } @@ -255,6 +257,16 @@ void setSimFail(bool fail) simfail = fail; } +void setProject(const QString &projectName) +{ + definedTestProject = projectName; +} + +void setProjectImageKeys(const QStringList &keys) +{ + QString keyList = keys.join(QLC(',')); + addClientProperty(PI_ProjectImageKeys, keyList); +} void modifyImage(QImage *img) { diff --git a/tests/baseline/shared/qbaselinetest.h b/tests/baseline/shared/qbaselinetest.h index c525fc8466c..df99348488d 100644 --- a/tests/baseline/shared/qbaselinetest.h +++ b/tests/baseline/shared/qbaselinetest.h @@ -36,6 +36,8 @@ namespace QBaselineTest { void setAutoMode(bool mode); void setSimFail(bool fail); void handleCmdLineArgs(int *argcp, char ***argvp); +void setProject(const QString &projectName); // Selects server config settings and top level dir +void setProjectImageKeys(const QStringList &keys); // Overrides the ItemPathKeys config setting void addClientProperty(const QString& key, const QString& value); bool connectToBaselineServer(QByteArray *msg = nullptr, const QString &testProject = QString(), const QString &testCase = QString()); bool checkImage(const QImage& img, const char *name, quint16 checksum, QByteArray *msg, bool *error, int manualdatatag = 0); diff --git a/tests/baseline/shared/qwidgetbaselinetest.cpp b/tests/baseline/shared/qwidgetbaselinetest.cpp index 90e2af26ea5..1553a2d82f3 100644 --- a/tests/baseline/shared/qwidgetbaselinetest.cpp +++ b/tests/baseline/shared/qwidgetbaselinetest.cpp @@ -37,7 +37,7 @@ QT_BEGIN_NAMESPACE QWidgetBaselineTest::QWidgetBaselineTest() { - QBaselineTest::addClientProperty("Project", "Widgets"); + QBaselineTest::setProject("Widgets"); // Set key platform properties that are relevant for the appearance of widgets const QString platformName = QGuiApplication::platformName() + "-" + QSysInfo::productType(); |