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 <volker.hilsheimer@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
Eirik Aavitsland 2022-01-10 15:16:18 +01:00
parent 657a18c7fa
commit 7719fcea4b
5 changed files with 19 additions and 3 deletions

View File

@ -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"));

View File

@ -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;

View File

@ -238,7 +238,9 @@ bool connectToBaselineServer(QByteArray *msg, const QString &testProject, const
bool dummy;
QByteArray dummyMsg;
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)
{

View File

@ -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);

View File

@ -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();