summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraavit <qt-info@nokia.com>2010-09-13 12:05:31 (GMT)
committeraavit <qt-info@nokia.com>2010-09-13 12:05:31 (GMT)
commit1ac37675969d31fb508d9f46f2e39b0e2b68dc20 (patch)
treee139bbce5cf0645dfd0d50a17c3c14af33c26924
parent738b93fd6676a24880e1ae1c603f9457b43de831 (diff)
downloadQt-1ac37675969d31fb508d9f46f2e39b0e2b68dc20.zip
Qt-1ac37675969d31fb508d9f46f2e39b0e2b68dc20.tar.gz
Qt-1ac37675969d31fb508d9f46f2e39b0e2b68dc20.tar.bz2
Checksumming of the script files added.
If the scripts themselves are modfied, it will not cause mismatch.
-rw-r--r--tests/arthur/baselineserver/src/baselineserver.cpp4
-rw-r--r--tests/auto/lancelot/tst_lancelot.cpp28
2 files changed, 13 insertions, 19 deletions
diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp
index 63b79ca..d58313f 100644
--- a/tests/arthur/baselineserver/src/baselineserver.cpp
+++ b/tests/arthur/baselineserver/src/baselineserver.cpp
@@ -225,6 +225,8 @@ QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline)
QString itemName = item.scriptName;
if (itemName.contains(QLC('.')))
itemName.replace(itemName.lastIndexOf(QLC('.')), 1, QLC('_'));
+ itemName.append(QLC('_'));
+ itemName.append(QString::number(item.scriptChecksum, 16).rightJustified(4, QLC('0')));
return storePath + itemName + QLC('.');
}
@@ -232,7 +234,7 @@ QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline)
void BaselineHandler::testPathMapping()
{
- qDebug() << "Storeage prefix:" << BaselineServer::storagePath();
+ qDebug() << "Storage prefix:" << BaselineServer::storagePath();
QStringList hosts;
hosts << QLS("bq-ubuntu910-x86-01")
diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp
index 2b1329f..5ec1667 100644
--- a/tests/auto/lancelot/tst_lancelot.cpp
+++ b/tests/auto/lancelot/tst_lancelot.cpp
@@ -49,6 +49,7 @@
#include <QPainter>
#include <QLibraryInfo>
#include <baselineprotocol.h>
+#include <QHash>
#include <QtOpenGL>
@@ -68,12 +69,12 @@ public:
private:
ImageItem render(const ImageItem &item);
void paint(QPaintDevice *device, const QStringList &script, const QString &filePath);
- QStringList loadScriptFile(const QString &filePath);
void runTestSuite();
bool setupTestSuite(ImageItem::GraphicsEngine engine, QImage::Format format, const QStringList& blacklist);
BaselineProtocol proto;
ImageItemList baseList;
+ QHash<QString, QStringList> scripts;
private slots:
void initTestCase();
@@ -120,9 +121,13 @@ void tst_Lancelot::initTestCase()
baseList.resize(files.count());
ImageItemList::iterator it = baseList.begin();
- foreach(const QString& file, files) {
- it->scriptName = file;
- // tbd: also load, split and generate checksums for scripts
+ foreach(const QString& fileName, files) {
+ QFile file(scriptsDir + fileName);
+ file.open(QFile::ReadOnly);
+ QByteArray cont = file.readAll();
+ scripts.insert(fileName, QString::fromLatin1(cont).split(QLatin1Char('\n'), QString::SkipEmptyParts));
+ it->scriptName = fileName;
+ it->scriptChecksum = qChecksum(cont.constData(), cont.size());
it++;
}
}
@@ -255,9 +260,7 @@ ImageItem tst_Lancelot::render(const ImageItem &item)
res.imageChecksums.clear();
res.image = QImage();
QString filePath = scriptsDir + item.scriptName;
- QStringList script = loadScriptFile(filePath);
- if (script.isEmpty())
- return res;
+ QStringList script = scripts.value(item.scriptName);
if (item.engine == ImageItem::Raster) {
QImage img(800, 800, item.renderFormat);
@@ -291,16 +294,5 @@ void tst_Lancelot::paint(QPaintDevice *device, const QStringList &script, const
p.end();
}
-QStringList tst_Lancelot::loadScriptFile(const QString &filePath)
-{
- QFile file(filePath);
- if (!file.open(QFile::ReadOnly)) {
- return QStringList();
- }
- //# use the new readscript function instead?
- QTextStream stream(&file);
- return stream.readAll().split(QLatin1Char('\n'), QString::SkipEmptyParts);
-}
-
QTEST_MAIN(tst_Lancelot)
#include "tst_lancelot.moc"