summaryrefslogtreecommitdiffstats
path: root/tests/auto/lancelot
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-12-16 08:59:43 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-12-16 08:59:43 (GMT)
commit64e1f888586f2c988b08bcc93579990e970b7206 (patch)
tree57ac2bb3463c68e7f25712e082f1a78cc90ee081 /tests/auto/lancelot
parentbf6ddf2631fbad3b7f1bac6469771910451bf84d (diff)
parent0ef5464cc2c79d834f565153111d48ae63249b97 (diff)
downloadQt-64e1f888586f2c988b08bcc93579990e970b7206.zip
Qt-64e1f888586f2c988b08bcc93579990e970b7206.tar.gz
Qt-64e1f888586f2c988b08bcc93579990e970b7206.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Satisfy the maketestselftest autotst Make the lancelot/baseline test system generically usable Make protocol less lancelot-specific, prepare use in other testcases Added new View command on reports Avoid race condition: don't quit until new executable is ready
Diffstat (limited to 'tests/auto/lancelot')
-rw-r--r--tests/auto/lancelot/lancelot.pro5
-rw-r--r--tests/auto/lancelot/tst_lancelot.cpp67
2 files changed, 34 insertions, 38 deletions
diff --git a/tests/auto/lancelot/lancelot.pro b/tests/auto/lancelot/lancelot.pro
index 4535b83..6d6edf8 100644
--- a/tests/auto/lancelot/lancelot.pro
+++ b/tests/auto/lancelot/lancelot.pro
@@ -7,9 +7,6 @@ SOURCES += tst_lancelot.cpp \
HEADERS += $$QT_SOURCE_TREE/tests/arthur/common/paintcommands.h
RESOURCES += $$QT_SOURCE_TREE/tests/arthur/common/images.qrc
-include($$QT_SOURCE_TREE/tests/arthur/common/baselineprotocol.pri)
-win32|symbian*:MKSPEC=$$replace(QMAKESPEC, \\\\, /)
-else:MKSPEC=$$QMAKESPEC
-DEFINES += QMAKESPEC=\\\"$$MKSPEC\\\"
+include($$QT_SOURCE_TREE/tests/arthur/common/qbaselinetest.pri)
!symbian:!wince*:DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp
index 7c6fe66..4bde927 100644
--- a/tests/auto/lancelot/tst_lancelot.cpp
+++ b/tests/auto/lancelot/tst_lancelot.cpp
@@ -66,10 +66,15 @@ public:
static bool simfail;
private:
- ImageItem render(const ImageItem &item);
+ enum GraphicsEngine {
+ Raster = 0,
+ OpenGL = 1
+ };
+
+ bool setupTestSuite(const QStringList& blacklist);
+ void runTestSuite(GraphicsEngine engine, QImage::Format format);
+ ImageItem render(const ImageItem &item, GraphicsEngine engine, QImage::Format format);
void paint(QPaintDevice *device, const QStringList &script, const QString &filePath);
- void runTestSuite();
- bool setupTestSuite(ImageItem::GraphicsEngine engine, QImage::Format format, const QStringList& blacklist);
BaselineProtocol proto;
ImageItemList baseList;
@@ -108,7 +113,7 @@ void tst_Lancelot::initTestCase()
#if defined(Q_OS_SOMEPLATFORM)
QSKIP("This test is not supported on this platform.", SkipAll);
#endif
- if (!proto.connect(&dryRunMode))
+ if (!proto.connect(QLatin1String("tst_Lancelot"), &dryRunMode))
QSKIP(qPrintable(proto.errorMessage()), SkipAll);
QDir qpsDir(scriptsDir);
@@ -125,8 +130,8 @@ void tst_Lancelot::initTestCase()
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->itemName = fileName;
+ it->itemChecksum = qChecksum(cont.constData(), cont.size());
it++;
}
}
@@ -135,42 +140,42 @@ void tst_Lancelot::initTestCase()
void tst_Lancelot::testRasterARGB32PM_data()
{
QStringList localBlacklist;
- if (!setupTestSuite(ImageItem::Raster, QImage::Format_ARGB32_Premultiplied, localBlacklist))
+ if (!setupTestSuite(localBlacklist))
QSKIP("Communication with baseline image server failed.", SkipAll);
}
void tst_Lancelot::testRasterARGB32PM()
{
- runTestSuite();
+ runTestSuite(Raster, QImage::Format_ARGB32_Premultiplied);
}
void tst_Lancelot::testRasterRGB32_data()
{
QStringList localBlacklist;
- if (!setupTestSuite(ImageItem::Raster, QImage::Format_RGB32, localBlacklist))
+ if (!setupTestSuite(localBlacklist))
QSKIP("Communication with baseline image server failed.", SkipAll);
}
void tst_Lancelot::testRasterRGB32()
{
- runTestSuite();
+ runTestSuite(Raster, QImage::Format_RGB32);
}
void tst_Lancelot::testRasterRGB16_data()
{
QStringList localBlacklist;
- if (!setupTestSuite(ImageItem::Raster, QImage::Format_RGB16, localBlacklist))
+ if (!setupTestSuite(localBlacklist))
QSKIP("Communication with baseline image server failed.", SkipAll);
}
void tst_Lancelot::testRasterRGB16()
{
- runTestSuite();
+ runTestSuite(Raster, QImage::Format_RGB16);
}
@@ -178,7 +183,7 @@ void tst_Lancelot::testRasterRGB16()
void tst_Lancelot::testOpenGL_data()
{
QStringList localBlacklist = QStringList() << QLatin1String("rasterops.qps");
- if (!setupTestSuite(ImageItem::OpenGL, QImage::Format_RGB32, localBlacklist))
+ if (!setupTestSuite(localBlacklist))
QSKIP("Communication with baseline image server failed.", SkipAll);
}
@@ -197,45 +202,39 @@ void tst_Lancelot::testOpenGL()
ok = true;
}
if (ok)
- runTestSuite();
+ runTestSuite(OpenGL, QImage::Format_RGB32);
else
QSKIP("System under test does not meet preconditions for GL testing. Skipping.", SkipAll);
}
#endif
-bool tst_Lancelot::setupTestSuite(ImageItem::GraphicsEngine engine, QImage::Format format, const QStringList& blacklist)
+bool tst_Lancelot::setupTestSuite(const QStringList& blacklist)
{
QTest::addColumn<ImageItem>("baseline");
ImageItemList itemList(baseList);
-
- for(ImageItemList::iterator it = itemList.begin(); it != itemList.end(); it++) {
- it->engine = engine;
- it->renderFormat = format;
- }
-
- if (!proto.requestBaselineChecksums(&itemList)) {
+ if (!proto.requestBaselineChecksums(QTest::currentTestFunction(), &itemList)) {
QWARN(qPrintable(proto.errorMessage()));
return false;
}
foreach(const ImageItem& item, itemList) {
- if (!blacklist.contains(item.scriptName))
- QTest::newRow(item.scriptName.toLatin1()) << item;
+ if (!blacklist.contains(item.itemName))
+ QTest::newRow(item.itemName.toLatin1()) << item;
}
return true;
}
-void tst_Lancelot::runTestSuite()
+void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format)
{
QFETCH(ImageItem, baseline);
if (baseline.status == ImageItem::IgnoreItem)
QSKIP("Blacklisted by baseline server.", SkipSingle);
- ImageItem rendered = render(baseline);
+ ImageItem rendered = render(baseline, engine, format);
if (rendered.image.isNull()) { // Assume an error in the test environment, not Qt
QWARN("Error: Failed to render image.");
QSKIP("Aborted due to errors.", SkipSingle);
@@ -253,26 +252,26 @@ void tst_Lancelot::runTestSuite()
if (dryRunMode)
qDebug() << "Dryrun mode, ignoring detected mismatch." << serverMsg;
else
- QFAIL("Rendered image differs from baseline.\n" + serverMsg);
+ QFAIL("Rendered image differs from baseline. Report:\n " + serverMsg);
}
}
-ImageItem tst_Lancelot::render(const ImageItem &item)
+ImageItem tst_Lancelot::render(const ImageItem &item, GraphicsEngine engine, QImage::Format format)
{
ImageItem res = item;
res.imageChecksums.clear();
res.image = QImage();
- QString filePath = scriptsDir + item.scriptName;
- QStringList script = scripts.value(item.scriptName);
+ QString filePath = scriptsDir + item.itemName;
+ QStringList script = scripts.value(item.itemName);
- if (item.engine == ImageItem::Raster) {
- QImage img(800, 800, item.renderFormat);
+ if (engine == Raster) {
+ QImage img(800, 800, format);
paint(&img, script, QFileInfo(filePath).absoluteFilePath()); // eh yuck (filePath stuff)
res.image = img;
res.imageChecksums.append(ImageItem::computeChecksum(img));
#ifndef QT_NO_OPENGL
- } else if (item.engine == ImageItem::OpenGL) {
+ } else if (engine == OpenGL) {
QGLWidget glWidget;
if (glWidget.isValid()) {
glWidget.makeCurrent();
@@ -281,7 +280,7 @@ ImageItem tst_Lancelot::render(const ImageItem &item)
fboFormat.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
QGLFramebufferObject fbo(800, 800, fboFormat);
paint(&fbo, script, QFileInfo(filePath).absoluteFilePath()); // eh yuck (filePath stuff)
- res.image = fbo.toImage().convertToFormat(item.renderFormat);
+ res.image = fbo.toImage().convertToFormat(format);
res.imageChecksums.append(ImageItem::computeChecksum(res.image));
}
#endif