summaryrefslogtreecommitdiffstats
path: root/tests/arthur
diff options
context:
space:
mode:
Diffstat (limited to 'tests/arthur')
-rw-r--r--tests/arthur/baselineserver/src/baselineserver.cpp39
-rw-r--r--tests/arthur/baselineserver/src/baselineserver.h4
-rw-r--r--tests/arthur/common/baselineprotocol.cpp12
-rw-r--r--tests/arthur/common/baselineprotocol.h2
-rw-r--r--tests/arthur/common/paintcommands.cpp34
-rw-r--r--tests/arthur/common/paintcommands.h1
-rw-r--r--tests/arthur/data/qps/radial_gradients_extended.qps95
-rw-r--r--tests/arthur/data/qps/radial_gradients_extended_qps.pngbin0 -> 107978 bytes
8 files changed, 169 insertions, 18 deletions
diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp
index 0c0871ae6f..97ee80ce7c 100644
--- a/tests/arthur/baselineserver/src/baselineserver.cpp
+++ b/tests/arthur/baselineserver/src/baselineserver.cpp
@@ -60,6 +60,7 @@ const QString PI_CreationDate(QLS("CreationDate"));
QString BaselineServer::storage;
QString BaselineServer::url;
+QString BaselineServer::settingsFile;
BaselineServer::BaselineServer(QObject *parent)
: QTcpServer(parent), lastRunIdIdx(0)
@@ -91,6 +92,15 @@ QString BaselineServer::baseUrl()
return url;
}
+QString BaselineServer::settingsFilePath()
+{
+ if (settingsFile.isEmpty()) {
+ QString exeName = QCoreApplication::applicationFilePath().section(QLC('/'), -1);
+ settingsFile = storagePath() + QLC('/') + exeName + QLS(".ini");
+ }
+ return settingsFile;
+}
+
void BaselineServer::incomingConnection(int socketDescriptor)
{
QString runId = QDateTime::currentDateTime().toString(QLS("MMMdd-hhmmss"));
@@ -144,6 +154,8 @@ void BaselineThread::run()
BaselineHandler::BaselineHandler(const QString &runId, int socketDescriptor)
: QObject(), runId(runId), connectionEstablished(false)
{
+ settings = new QSettings(BaselineServer::settingsFilePath(), QSettings::IniFormat, this);
+
if (socketDescriptor == -1)
return;
@@ -162,6 +174,7 @@ bool BaselineHandler::establishConnection()
{
if (!proto.acceptConnection(&plat)) {
qWarning() << runId << logtime() << "Accepting new connection from" << proto.socket.peerAddress().toString() << "failed." << proto.errorMessage();
+ proto.sendBlock(BaselineProtocol::Abort, proto.errorMessage().toLatin1()); // In case the client can hear us, tell it what's wrong.
proto.socket.disconnectFromHost();
return false;
}
@@ -173,17 +186,23 @@ bool BaselineHandler::establishConnection()
qDebug() << runId << logtime() << "Connection established with" << plat.value(PI_HostName)
<< "[" << qPrintable(plat.value(PI_HostAddress)) << "]" << logMsg;
- // Filter on branch
- QString branch = plat.value(PI_PulseGitBranch);
- if (branch.isEmpty()) {
- // Not run by Pulse, i.e. ad hoc run: Ok.
- }
- else if (branch != QLS("master-integration") || !plat.value(PI_GitCommit).contains(QLS("Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging into master-integration"))) {
- qDebug() << runId << logtime() << "Did not pass branch/staging repo filter, disconnecting.";
- proto.sendBlock(BaselineProtocol::Abort, QByteArray("This branch/staging repo is not assigned to be tested."));
- proto.socket.disconnectFromHost();
- return false;
+ settings->beginGroup("ClientFilters");
+ if (!settings->childKeys().isEmpty() && !plat.value(PI_PulseGitBranch).isEmpty()) { // i.e. not adhoc client
+ // Abort if client does not match the filters
+ foreach (QString filterKey, settings->childKeys()) {
+ QString filter = settings->value(filterKey).toString();
+ QString platVal = plat.value(filterKey);
+ if (filter.isEmpty() || platVal.isEmpty())
+ continue; // tbd: add a syntax for specifying a "value-must-be-present" filter
+ if (!platVal.contains(filter)) {
+ qDebug() << runId << logtime() << "Did not pass client filter on" << filterKey << "; disconnecting.";
+ proto.sendBlock(BaselineProtocol::Abort, QByteArray("Configured to not do testing for this client or repo, ref. ") + BaselineServer::settingsFilePath().toLatin1());
+ proto.socket.disconnectFromHost();
+ return false;
+ }
+ }
}
+ settings->endGroup();
proto.sendBlock(BaselineProtocol::Ack, QByteArray());
diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h
index cae490fb0b..0dcd4ea5ac 100644
--- a/tests/arthur/baselineserver/src/baselineserver.h
+++ b/tests/arthur/baselineserver/src/baselineserver.h
@@ -48,6 +48,7 @@
#include <QScopedPointer>
#include <QTimer>
#include <QDateTime>
+#include <QSettings>
#include "baselineprotocol.h"
#include "report.h"
@@ -65,6 +66,7 @@ public:
static QString storagePath();
static QString baseUrl();
+ static QString settingsFilePath();
protected:
void incomingConnection(int socketDescriptor);
@@ -79,6 +81,7 @@ private:
int lastRunIdIdx;
static QString storage;
static QString url;
+ static QString settingsFile;
};
@@ -132,6 +135,7 @@ private:
QString runId;
bool connectionEstablished;
Report report;
+ QSettings *settings;
};
#endif // BASELINESERVER_H
diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp
index 88cea362ee..8879b78670 100644
--- a/tests/arthur/common/baselineprotocol.cpp
+++ b/tests/arthur/common/baselineprotocol.cpp
@@ -374,7 +374,7 @@ bool BaselineProtocol::connect(const QString &testCase, bool *dryrun)
Command cmd = UnknownError;
if (!receiveBlock(&cmd, &block)) {
- errMsg += QLS("Failed to get response from server.");
+ errMsg.prepend(QLS("Failed to get response from server. "));
return false;
}
@@ -424,15 +424,17 @@ bool BaselineProtocol::requestBaselineChecksums(const QString &testFunction, Ima
it->testFunction = testFunction;
QByteArray block;
- QDataStream ds(&block, QIODevice::ReadWrite);
+ QDataStream ds(&block, QIODevice::WriteOnly);
ds << *itemList;
if (!sendBlock(RequestBaselineChecksums, block))
return false;
+
Command cmd;
- if (!receiveBlock(&cmd, &block))
+ QByteArray rcvBlock;
+ if (!receiveBlock(&cmd, &rcvBlock) || cmd != BaselineProtocol::Ack)
return false;
- ds.device()->seek(0);
- ds >> *itemList;
+ QDataStream rds(&rcvBlock, QIODevice::ReadOnly);
+ rds >> *itemList;
return true;
}
diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h
index 8a99ace6ee..bc1a3eb7b6 100644
--- a/tests/arthur/common/baselineprotocol.h
+++ b/tests/arthur/common/baselineprotocol.h
@@ -146,7 +146,7 @@ public:
enum Constant {
ProtocolVersion = 5,
ServerPort = 54129,
- Timeout = 5000
+ Timeout = 15000
};
enum Command {
diff --git a/tests/arthur/common/paintcommands.cpp b/tests/arthur/common/paintcommands.cpp
index 7a018e3ce6..9273142905 100644
--- a/tests/arthur/common/paintcommands.cpp
+++ b/tests/arthur/common/paintcommands.cpp
@@ -346,8 +346,12 @@ void PaintCommands::staticInit()
"gradient_setLinear 1.0 1.0 2.0 2.0");
DECL_PAINTCOMMAND("gradient_setRadial", command_gradient_setRadial,
"^gradient_setRadial\\s+([\\w.]*)\\s+([\\w.]*)\\s+([\\w.]*)\\s?([\\w.]*)\\s?([\\w.]*)$",
- "gradient_setRadial <cx> <cy> <rad> <fx> <fy>\n - C is the center\n - rad is the angle in degrees\n - F is the focal point",
+ "gradient_setRadial <cx> <cy> <rad> <fx> <fy>\n - C is the center\n - rad is the radius\n - F is the focal point",
"gradient_setRadial 1.0 1.0 45.0 2.0 2.0");
+ DECL_PAINTCOMMAND("gradient_setRadialExtended", command_gradient_setRadialExtended,
+ "^gradient_setRadialExtended\\s+([\\w.]*)\\s+([\\w.]*)\\s+([\\w.]*)\\s?([\\w.]*)\\s?([\\w.]*)\\s?([\\w.]*)$",
+ "gradient_setRadialExtended <cx> <cy> <rad> <fx> <fy> <frad>\n - C is the center\n - rad is the center radius\n - F is the focal point\n - frad is the focal radius",
+ "gradient_setRadialExtended 1.0 1.0 45.0 2.0 2.0 45.0");
DECL_PAINTCOMMAND("gradient_setLinearPen", command_gradient_setLinearPen,
"^gradient_setLinearPen\\s+([\\w.]*)\\s+([\\w.]*)\\s+([\\w.]*)\\s+([\\w.]*)$",
"gradient_setLinearPen <x1> <y1> <x2> <y2>",
@@ -2400,7 +2404,7 @@ void PaintCommands::command_gradient_setRadial(QRegExp re)
double fy = convertToDouble(caps.at(5));
if (m_verboseMode)
- printf(" -(lance) gradient_setRadial center=(%.2f, %.2f), radius=%.2f focal=(%.2f, %.2f), "
+ printf(" -(lance) gradient_setRadial center=(%.2f, %.2f), radius=%.2f, focal=(%.2f, %.2f), "
"spread=%d\n",
cx, cy, rad, fx, fy, m_gradientSpread);
@@ -2415,6 +2419,32 @@ void PaintCommands::command_gradient_setRadial(QRegExp re)
}
/***************************************************************************************************/
+void PaintCommands::command_gradient_setRadialExtended(QRegExp re)
+{
+ QStringList caps = re.capturedTexts();
+ double cx = convertToDouble(caps.at(1));
+ double cy = convertToDouble(caps.at(2));
+ double rad = convertToDouble(caps.at(3));
+ double fx = convertToDouble(caps.at(4));
+ double fy = convertToDouble(caps.at(5));
+ double frad = convertToDouble(caps.at(6));
+
+ if (m_verboseMode)
+ printf(" -(lance) gradient_setRadialExtended center=(%.2f, %.2f), radius=%.2f, focal=(%.2f, %.2f), "
+ "focal radius=%.2f, spread=%d\n",
+ cx, cy, rad, fx, fy, frad, m_gradientSpread);
+
+ QRadialGradient rg(QPointF(cx, cy), rad, QPointF(fx, fy), frad);
+ rg.setStops(m_gradientStops);
+ rg.setSpread(m_gradientSpread);
+ rg.setCoordinateMode(m_gradientCoordinate);
+ QBrush brush(rg);
+ QTransform brush_matrix = m_painter->brush().transform();
+ brush.setTransform(brush_matrix);
+ m_painter->setBrush(brush);
+}
+
+/***************************************************************************************************/
void PaintCommands::command_gradient_setConical(QRegExp re)
{
QStringList caps = re.capturedTexts();
diff --git a/tests/arthur/common/paintcommands.h b/tests/arthur/common/paintcommands.h
index 2740412654..08c0e25a7b 100644
--- a/tests/arthur/common/paintcommands.h
+++ b/tests/arthur/common/paintcommands.h
@@ -179,6 +179,7 @@ private:
void command_gradient_setConical(QRegExp re);
void command_gradient_setLinear(QRegExp re);
void command_gradient_setRadial(QRegExp re);
+ void command_gradient_setRadialExtended(QRegExp re);
void command_gradient_setLinearPen(QRegExp re);
void command_gradient_setSpread(QRegExp re);
void command_gradient_setCoordinateMode(QRegExp re);
diff --git a/tests/arthur/data/qps/radial_gradients_extended.qps b/tests/arthur/data/qps/radial_gradients_extended.qps
new file mode 100644
index 0000000000..d80a149252
--- /dev/null
+++ b/tests/arthur/data/qps/radial_gradients_extended.qps
@@ -0,0 +1,95 @@
+path_addRect path 400 0 80 80
+path_addEllipse path 440 40 60 60
+
+setRenderHint Antialiasing
+
+setPen black
+
+begin_block gradients
+gradient_clearStops
+gradient_appendStop 0 red
+gradient_appendStop 0.25 orange
+gradient_appendStop 0.5 yellow
+gradient_appendStop 0.8 green
+gradient_appendStop 1 cyan
+
+gradient_setSpread PadSpread
+gradient_setRadialExtended 0 0 20 40 40 10
+drawRect 0 0 100 100
+
+gradient_setSpread ReflectSpread
+gradient_setRadialExtended 120 20 20 140 40 10
+drawEllipse 100 0 100 100
+
+gradient_setSpread RepeatSpread
+gradient_setRadialExtended 240 20 20 260 40 10
+drawRoundRect 200 0 100 100
+
+gradient_clearStops
+gradient_appendStop 0 3f7f7fff
+gradient_appendStop 0.5 dfdfffff
+gradient_appendStop 1 7f00007f
+
+gradient_setSpread PadSpread
+gradient_setRadialExtended 320 20 20 340 40 10
+drawPolygon [300 0 390 0 350 99]
+
+gradient_setSpread ReflectSpread
+gradient_setRadialExtended 420 20 20 440 40 10
+drawPath path
+
+gradient_setSpread RepeatSpread
+gradient_setRadialExtended 520 20 20 540 40 10
+drawPie 500 0 100 100 720 4320
+end_block
+
+translate 0 100
+scale 1 2
+repeat_block gradients
+
+resetMatrix
+translate 0 300
+brushTranslate 30 0
+brushScale 0.9 0.9
+repeat_block gradients
+
+# Some helpful info perhaps?
+resetMatrix
+setPen black
+
+drawText 610 50 "No XForm"
+drawText 610 200 "scale 1x2"
+drawText 610 300 "brush transform"
+drawText 10 450 "Pad"
+drawText 110 450 "Reflect"
+drawText 210 450 "Repeat"
+drawText 310 450 "Pad w/alpha"
+drawText 410 450 "Reflect w/alpha"
+drawText 510 450 "Repeat w/alpha"
+
+# Radius and focal indicators
+setPen 3f000000
+setBrush nobrush
+
+begin_block ellipse_draw
+setClipRect 0 0 100 100
+drawEllipse -30 -30 100 100
+drawEllipse 35 35 11 11
+translate 100 0
+end_block
+
+repeat_block ellipse_draw
+repeat_block ellipse_draw
+repeat_block ellipse_draw
+repeat_block ellipse_draw
+repeat_block ellipse_draw
+
+resetMatrix
+translate 0 100
+scale 1 2
+repeat_block ellipse_draw
+repeat_block ellipse_draw
+repeat_block ellipse_draw
+repeat_block ellipse_draw
+repeat_block ellipse_draw
+repeat_block ellipse_draw
diff --git a/tests/arthur/data/qps/radial_gradients_extended_qps.png b/tests/arthur/data/qps/radial_gradients_extended_qps.png
new file mode 100644
index 0000000000..45a3e6036c
--- /dev/null
+++ b/tests/arthur/data/qps/radial_gradients_extended_qps.png
Binary files differ