summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-05-05 13:01:42 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-05-05 13:01:42 (GMT)
commit0ca404def7262ad7293592bbb7888a6df5ea27b7 (patch)
treebdb81cd468bfcc1bb957c2ab9768b89c51c01525 /tests
parentd1ac6af4f30e822e161fd8772104aa2e30e55a2f (diff)
parent2d8852d51b15ed48e8e665882b5d70c298201299 (diff)
downloadQt-0ca404def7262ad7293592bbb7888a6df5ea27b7.zip
Qt-0ca404def7262ad7293592bbb7888a6df5ea27b7.tar.gz
Qt-0ca404def7262ad7293592bbb7888a6df5ea27b7.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging: Compile on Windows Support gamma correction of text on GL Remove QFontEngineFT::loadGlyphMetrics Make autotest more resilient against network timeout Do not filter adhoc clients Lancelot: Add configurable client filtering to baseline server Improve error reporting on failure to connect to baseline server Fixed bug in X11 backend when creating translucent windows. Only cleanup share widget if it has been created. Add required font metrics functions to QRawFont Fixed bug in QPdfEngine::addImage causing mono images to be made 32 bit Make pixel size a qreal in QRawFont Make sure removed QTextBlock is invalid Make sure QFont's resolve mask is copied on compilers with C++0x support Fix glyph position issue with fallback fonts
Diffstat (limited to 'tests')
-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/auto/lancelot/tst_lancelot.cpp3
-rw-r--r--tests/auto/qrawfont/tst_qrawfont.cpp32
6 files changed, 59 insertions, 33 deletions
diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp
index 0c0871a..97ee80c 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 cae490f..0dcd4ea 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 88cea36..8879b78 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 8a99ace..bc1a3eb 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/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp
index 9721665..2eb3f20 100644
--- a/tests/auto/lancelot/tst_lancelot.cpp
+++ b/tests/auto/lancelot/tst_lancelot.cpp
@@ -254,7 +254,8 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format)
if (baseline.status == ImageItem::BaselineNotFound) {
- proto.submitNewBaseline(rendered, 0);
+ if (!proto.submitNewBaseline(rendered, 0))
+ QWARN("Failed to submit new baseline: " + proto.errorMessage().toLatin1());
QSKIP("Baseline not found; new baseline created.", SkipSingle);
}
diff --git a/tests/auto/qrawfont/tst_qrawfont.cpp b/tests/auto/qrawfont/tst_qrawfont.cpp
index 3aa4006..4b42c74 100644
--- a/tests/auto/qrawfont/tst_qrawfont.cpp
+++ b/tests/auto/qrawfont/tst_qrawfont.cpp
@@ -104,7 +104,7 @@ void tst_QRawFont::invalidRawFont()
{
QRawFont font;
QVERIFY(!font.isValid());
- QCOMPARE(font.pixelSize(), -1);
+ QCOMPARE(font.pixelSize(), 0.0);
QVERIFY(font.familyName().isEmpty());
QCOMPARE(font.style(), QFont::StyleNormal);
QCOMPARE(font.weight(), -1);
@@ -165,7 +165,7 @@ void tst_QRawFont::correctFontData_data()
QTest::addColumn<QFont::Weight>("weight");
QTest::addColumn<QFont::HintingPreference>("hintingPreference");
QTest::addColumn<qreal>("unitsPerEm");
- QTest::addColumn<int>("pixelSize");
+ QTest::addColumn<qreal>("pixelSize");
int hintingPreferences[] = {
int(QFont::PreferDefaultHinting),
@@ -189,7 +189,7 @@ void tst_QRawFont::correctFontData_data()
<< QFont::Normal
<< QFont::HintingPreference(*hintingPreference)
<< 1000.0
- << 10;
+ << 10.0;
fileName = QLatin1String(SRCDIR "testfont_bold_italic.ttf");
title = fileName
@@ -203,7 +203,7 @@ void tst_QRawFont::correctFontData_data()
<< QFont::Bold
<< QFont::HintingPreference(*hintingPreference)
<< 1000.0
- << 10;
+ << 10.0;
++hintingPreference;
}
@@ -217,7 +217,7 @@ void tst_QRawFont::correctFontData()
QFETCH(QFont::Weight, weight);
QFETCH(QFont::HintingPreference, hintingPreference);
QFETCH(qreal, unitsPerEm);
- QFETCH(int, pixelSize);
+ QFETCH(qreal, pixelSize);
QRawFont font(fileName, 10, hintingPreference);
QVERIFY(font.isValid());
@@ -284,7 +284,7 @@ void tst_QRawFont::textLayout()
QString familyName = QString::fromLatin1("QtBidiTestFont");
QFont font(familyName);
- font.setPixelSize(18);
+ font.setPixelSize(18.0);
QCOMPARE(QFontInfo(font).family(), familyName);
QTextLayout layout(QLatin1String("Foobar"));
@@ -301,7 +301,7 @@ void tst_QRawFont::textLayout()
QRawFont rawFont = glyphs.font();
QVERIFY(rawFont.isValid());
QCOMPARE(rawFont.familyName(), familyName);
- QCOMPARE(rawFont.pixelSize(), 18);
+ QCOMPARE(rawFont.pixelSize(), 18.0);
QVector<quint32> expectedGlyphIndices;
expectedGlyphIndices << 44 << 83 << 83 << 70 << 69 << 86;
@@ -597,12 +597,12 @@ void tst_QRawFont::fromFont()
QFont font(familyName);
font.setHintingPreference(hintingPreference);
- font.setPixelSize(26);
+ font.setPixelSize(26.0);
QRawFont rawFont = QRawFont::fromFont(font, writingSystem);
QVERIFY(rawFont.isValid());
QCOMPARE(rawFont.familyName(), familyName);
- QCOMPARE(rawFont.pixelSize(), 26);
+ QCOMPARE(rawFont.pixelSize(), 26.0);
QVERIFY(fontDatabase.removeApplicationFont(id));
}
@@ -623,7 +623,7 @@ void tst_QRawFont::copyConstructor()
{
QString rawFontFamilyName;
- int rawFontPixelSize;
+ qreal rawFontPixelSize;
qreal rawFontAscent;
qreal rawFontDescent;
int rawFontTableSize;
@@ -691,7 +691,7 @@ void tst_QRawFont::detach()
{
QString rawFontFamilyName;
- int rawFontPixelSize;
+ qreal rawFontPixelSize;
qreal rawFontAscent;
qreal rawFontDescent;
int rawFontTableSize;
@@ -773,15 +773,15 @@ void tst_QRawFont::unsupportedWritingSystem()
QFont font("QtBidiTestFont");
font.setHintingPreference(hintingPreference);
- font.setPixelSize(12);
+ font.setPixelSize(12.0);
QRawFont rawFont = QRawFont::fromFont(font, QFontDatabase::Any);
QCOMPARE(rawFont.familyName(), QString::fromLatin1("QtBidiTestFont"));
- QCOMPARE(rawFont.pixelSize(), 12);
+ QCOMPARE(rawFont.pixelSize(), 12.0);
rawFont = QRawFont::fromFont(font, QFontDatabase::Hebrew);
QCOMPARE(rawFont.familyName(), QString::fromLatin1("QtBidiTestFont"));
- QCOMPARE(rawFont.pixelSize(), 12);
+ QCOMPARE(rawFont.pixelSize(), 12.0);
QString arabicText = QFontDatabase::writingSystemSample(QFontDatabase::Arabic);
@@ -798,11 +798,11 @@ void tst_QRawFont::unsupportedWritingSystem()
QGlyphs glyphs = glyphss.at(0);
QRawFont layoutFont = glyphs.font();
QVERIFY(layoutFont.familyName() != QString::fromLatin1("QtBidiTestFont"));
- QCOMPARE(layoutFont.pixelSize(), 12);
+ QCOMPARE(layoutFont.pixelSize(), 12.0);
rawFont = QRawFont::fromFont(font, QFontDatabase::Arabic);
QCOMPARE(rawFont.familyName(), layoutFont.familyName());
- QCOMPARE(rawFont.pixelSize(), 12);
+ QCOMPARE(rawFont.pixelSize(), 12.0);
fontDatabase.removeApplicationFont(id);
}