From f4a8e940eda1904ed2fba247c1d2752106ccc5c9 Mon Sep 17 00:00:00 2001 From: aavit Date: Mon, 29 Oct 2012 10:34:20 +0100 Subject: Qt5 updates to the QPainter lancelot autotest a) Use the new Qt5 OpenGL API for testing of GL painting b) Simplify: Use the higher-level QBaselineTest API instead of the low-level baselineprotocol API. Change-Id: Ib5f47f6fe68837dfdc8dc3a74638c5cb0b724614 Reviewed-by: aavit --- tests/baselineserver/shared/qbaselinetest.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'tests/baselineserver/shared') diff --git a/tests/baselineserver/shared/qbaselinetest.cpp b/tests/baselineserver/shared/qbaselinetest.cpp index 0c28f6eb46..5951010d98 100644 --- a/tests/baselineserver/shared/qbaselinetest.cpp +++ b/tests/baselineserver/shared/qbaselinetest.cpp @@ -51,10 +51,12 @@ namespace QBaselineTest { static char *fargv[MAXCMDLINEARGS]; static bool simfail = false; static PlatformInfo customInfo; +static bool customAutoModeSet = false; static BaselineProtocol proto; static bool connected = false; static bool triedConnecting = false; +static bool dryRunMode = false; static QByteArray curFunction; static ImageItemList itemList; @@ -81,8 +83,10 @@ void handleCmdLineArgs(int *argcp, char ***argvp) if (arg == "-simfail") { simfail = true; } else if (arg == "-auto") { + customAutoModeSet = true; customInfo.setAdHocRun(false); } else if (arg == "-adhoc") { + customAutoModeSet = true; customInfo.setAdHocRun(true); } else if (arg == "-compareto") { i++; @@ -135,7 +139,7 @@ void addClientProperty(const QString& key, const QString& value) */ void fetchCustomClientProperties() { - QString script = "hostinfo.sh"; //### TBD: better name + QString script = "hostinfo.sh"; //### TBD: Windows implementation (hostinfo.bat) QProcess runScript; runScript.setWorkingDirectory(QCoreApplication::applicationDirPath()); @@ -181,6 +185,8 @@ bool connect(QByteArray *msg, bool *error) if (!clientInfo.contains(key)) clientInfo.insert(key, defaultInfo.value(key)); } + if (!customAutoModeSet) + clientInfo.setAdHocRun(defaultInfo.isAdHocRun()); if (!definedTestProject.isEmpty()) clientInfo.insert(PI_Project, definedTestProject); @@ -195,8 +201,7 @@ bool connect(QByteArray *msg, bool *error) return false; } - bool dummy; // ### TBD: dryrun handling - if (!proto.connect(testCase, &dummy, clientInfo)) { + if (!proto.connect(testCase, &dryRunMode, clientInfo)) { *msg += "Failed to connect to baseline server: " + proto.errorMessage().toLatin1(); *error = true; return false; @@ -230,6 +235,7 @@ bool connectToBaselineServer(QByteArray *msg, const QString &testProject, const void setAutoMode(bool mode) { customInfo.setAdHocRun(!mode); + customAutoModeSet = true; } void setSimFail(bool fail) @@ -277,7 +283,10 @@ bool compareItem(const ImageItem &baseline, const QImage &img, QByteArray *msg, return true; break; case ImageItem::BaselineNotFound: - // ### TBD: don't submit if have overrides; will be rejected anyway + if (!customInfo.overrides().isEmpty()) { + qWarning() << "Cannot compare to other system's baseline: No such baseline found on server."; + return true; + } if (proto.submitNewBaseline(item, &srvMsg)) qDebug() << msg->constData() << "Baseline not found on server. New baseline uploaded."; else @@ -304,6 +313,10 @@ bool compareItem(const ImageItem &baseline, const QImage &img, QByteArray *msg, return true; // The server decides: a fuzzy match means no mismatch } *msg += "Mismatch. See report:\n " + srvMsg; + if (dryRunMode) { + qDebug() << "Dryrun, so ignoring" << *msg; + return true; + } return false; } -- cgit v1.2.3