summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2010-11-19 09:31:01 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2010-11-19 09:31:01 (GMT)
commit18205faa87abd85d0848291738821666928b5769 (patch)
treecc4e0c8d5d5c165f2eb88689339ef25b9f7deb3f
parent9f5a4d10fdf052bc50e0a3066ff9a45743d7fa7b (diff)
downloadQt-18205faa87abd85d0848291738821666928b5769.zip
Qt-18205faa87abd85d0848291738821666928b5769.tar.gz
Qt-18205faa87abd85d0848291738821666928b5769.tar.bz2
Move qmlvisualaids to another repo
Moved to a personal repo, since its fate is a little uncertain so it shouldn't draw this much attention. Task-number: QTBUG-14792
-rw-r--r--tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Button.qml19
-rw-r--r--tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Comparison.qml75
-rw-r--r--tests/auto/declarative/qmlvisual/shared/qmlvisualaids/main.cpp14
-rw-r--r--tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.cpp74
-rw-r--r--tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.h31
-rw-r--r--tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.pro26
-rw-r--r--tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.qrc6
-rw-r--r--tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.cpp96
-rw-r--r--tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.h50
9 files changed, 0 insertions, 391 deletions
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Button.qml b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Button.qml
deleted file mode 100644
index 600079f..0000000
--- a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Button.qml
+++ /dev/null
@@ -1,19 +0,0 @@
-import Qt 4.7
-
-Rectangle {
- width: txt.width + 16
- height: txt.height + 8
- radius: 4
- border.color: "black"
- property alias caption: txt.text
- signal triggered
- Text{
- id: txt
- text: "Button"
- anchors.centerIn: parent
- }
- MouseArea{
- anchors.fill: parent
- onClicked: parent.triggered()
- }
-}
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Comparison.qml b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Comparison.qml
deleted file mode 100644
index 43b10d4..0000000
--- a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Comparison.qml
+++ /dev/null
@@ -1,75 +0,0 @@
-import Qt 4.7
-
-Item{
- width: 1000
- height:800
- Row{
- spacing: 4
- Button{
- caption: "run"
- onTriggered: test.runTest()
- }
-
- Button{
- caption: "update"
- onTriggered: test.updateVisuals()
- }
-
- Button{
- caption: "platform"
- onTriggered: test.updatePlatformVisuals()
- }
- }
-
- Rectangle {
- y: 180
- width: 1000
- height: 620
- Row{
- id: grid
- spacing: 4
- Text{
- width: 300
- height: 200
- text: test.testName
- clip: true; wrapMode: Text.WordWrap
- }
- Text{
- width: 300
- height: 200
- text: test.testCase
- clip: true; wrapMode: Text.WordWrap
- }
- Text{
- width: 300
- height: 200
- text: test.testScript
- clip: true; wrapMode: Text.WordWrap
- }
- }
- Item{
- y: 200
- Row{
- ListView{
- width: 200; height: 400
- delegate: Rectangle{ width: 200; height: 200; color: "blue"; Image{ source: modelData }}
- model: test.goodImages;
- }
- ListView{
- width: 200; height: 400
- delegate: Rectangle{ width: 200; height: 200; color: "blue"; Image{ source: modelData }}
- model: test.diffImages;
- }
- ListView{
- width: 200; height: 400
- delegate: Rectangle{ width: 200; height: 200; color: "blue"; Image{ source: modelData }}
- model: test.badImages;
- }
- }
- }
- MouseArea{
- anchors.fill: parent
- onClicked: test.moveOn();
- }
- }
-}
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/main.cpp b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/main.cpp
deleted file mode 100644
index 2d35350..0000000
--- a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/main.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <QtGui/QApplication>
-#include <QtDeclarative>
-#include "mainwindow.h"
-#include <cstring>
-#include <cstdio>
-#include <cstdlib>
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
- MainWindow *m = new MainWindow;
- m->show();
- return a.exec();
-}
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.cpp b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.cpp
deleted file mode 100644
index 49614ec..0000000
--- a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-#include "mainwindow.h"
-#include <QMessageBox>
-#include <QDebug>
-
-MainWindow::MainWindow(QWidget *parent) :
- QMainWindow(parent), testIdx(-1)
-{
- createMenus();
- view = new QDeclarativeView(this);
- setCentralWidget(view);
- view->setResizeMode(QDeclarativeView::SizeViewToRootObject);
- curTest = new TestModel(this);
- connect(curTest, SIGNAL(moveOn()),
- this, SLOT(runTests()));
-
- view->engine()->rootContext()->setContextProperty("test", curTest);
- view->setSource(QUrl("qrc:qml/Comparison.qml"));
-}
-
-void MainWindow::runAllTests()
-{
- tests.clear();
- testIdx = 0;
-
- QString visualTest = "./tst_qmlvisual";//TODO: Crossplatform
-
- QProcess p;//TODO: Error checking here
- p.setProcessChannelMode(QProcess::MergedChannels);
- p.start(visualTest, QStringList());
- p.waitForFinished(-1);//Can't time out, because it takes an indeterminate and long time
-
- QString output = QString(p.readAllStandardOutput());
- QRegExp re("QDeclarativeTester\\( \"([^\"]*)\" \\)");
- int offset=0;
- while((offset = re.indexIn(output, offset)) != -1){
- tests << re.cap(1);
- offset++;
- }
-
- if(tests.count())
- QMessageBox::information(this, "Test Results", QString("Tests completed. %1 test failures occurred.").arg(tests.count()));
- else
- QMessageBox::information(this, "Test Results", "Tests completed. All tests passed!");
-
- runTests();
-}
-
-void MainWindow::runTests()
-{
- if(testIdx >= tests.size())
- testIdx = -1;
- if(testIdx == -1)
- return;
- showFixScreen(tests[testIdx++]);
-}
-
-void MainWindow::showFixScreen(const QString &path)
-{
- if(curTest->setTest(path)){
- view->engine()->rootContext()->setContextProperty("test", curTest); //signal connects to runTests
- }else{
- QMessageBox::critical(this, "Test Error", QString("Cannot find test %1.").arg(path));
- runTests();
- }
-}
-
-void MainWindow::createMenus()
-{
- QMenu *tests = this->menuBar()->addMenu("Tests");
- tests->addAction("Run All", this, SLOT(runAllTests()));
- tests->addSeparator();
- tests->addAction("About Qt...", qApp, SLOT(aboutQt()));
- tests->addAction("Quit", qApp, SLOT(quit()));
-}
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.h b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.h
deleted file mode 100644
index 0209064..0000000
--- a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QMainWindow>
-#include <QtDeclarative>
-#include <QtGui>
-#include <QtCore>
-#include "testmodel.h"
-
-class MainWindow : public QMainWindow
-{
- Q_OBJECT
-public:
- explicit MainWindow(QWidget *parent = 0);
- void createMenus();
-
-signals:
-
-public slots:
- void runTests();
- void runAllTests();
- void showFixScreen(const QString& path);
-
-private:
- QDeclarativeView* view;
- TestModel *curTest;
- QStringList tests;
- int testIdx;
-};
-
-#endif // MAINWINDOW_H
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.pro b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.pro
deleted file mode 100644
index d18c235..0000000
--- a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.pro
+++ /dev/null
@@ -1,26 +0,0 @@
-#-------------------------------------------------
-#
-# Project created by QtCreator 2010-11-19T09:48:39
-#
-#-------------------------------------------------
-
-QT += core gui declarative
-
-TARGET = ../../qmlvisualaids
-TEMPLATE = app
-
-
-SOURCES += main.cpp \
- testmodel.cpp \
- mainwindow.cpp
-
-HEADERS += \
- testmodel.h \
- mainwindow.h
-
-OTHER_FILES += \
- Comparison.qml \
- Button.qml
-
-RESOURCES += \
- qmlvisual.qrc
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.qrc b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.qrc
deleted file mode 100644
index d79b64c..0000000
--- a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.qrc
+++ /dev/null
@@ -1,6 +0,0 @@
-<RCC>
- <qresource prefix="/qml" lang="qml">
- <file>Comparison.qml</file>
- <file>Button.qml</file>
- </qresource>
-</RCC>
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.cpp b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.cpp
deleted file mode 100644
index 4aec14b..0000000
--- a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-#include "testmodel.h"
-#include <QProcess>
-#include <QDebug>
-#include <QFile>
-
-TestModel::TestModel(QObject *parent) :
- QObject(parent), _testName("Invalid")
-{
-
-}
-
-//testPath is the path to the test script, and assumes the file under test has the same name and is in the dir above
-bool TestModel::setTest(const QString &testPath)
-{
- _good.clear();
- _bad.clear();
- _diff.clear();
-
- _testScriptPath = testPath;
- if(!_testScriptPath.endsWith(".qml"))
- _testScriptPath += ".qml";
- _testName = _testScriptPath.split('/').last();
-
- //Assumed that the test case is in the directory above and has the same name as the script
- _testPath = _testScriptPath.left(_testScriptPath.lastIndexOf('/', _testScriptPath.lastIndexOf('/') - 1))
- + '/' + _testName;
-
- bool ret = QFile::exists(_testPath) && QFile::exists(_testScriptPath);
- if(!ret)
- return ret;
-
- QFile test(_testPath);
- test.open(QFile::ReadOnly | QFile::Text);
- _testCase = test.readAll();
-
- QFile script(_testScriptPath);
- script.open(QFile::ReadOnly | QFile::Text);
- _testScript = script.readAll();
-
- QString base = _testScriptPath;
- base.chop(4);//remove .qml, replace with .%1.png
- base += ".%1.png";
- int c = 0;
- while (QFile::exists(base.arg(c))) {
- _good << "file://" + base.arg(c);
- if(QFile::exists(base.arg(c) + ".reject.png"))
- _bad << "file://" + base.arg(c) + ".reject.png";
- else
- _bad << "";
-
- if(QFile::exists(base.arg(c) + ".diff.png"))
- _diff << "file://" + base.arg(c) + ".diff.png";
- else
- _diff << "";
-
- c++;
- }
-
- return ret;
-}
-
-//returns true iff running the test changed the failure images.
-bool TestModel::runTest()
-{
- launchTester("-play");
- return false;//TODO: Actually check that
-}
-
-void TestModel::updateVisuals()
-{
- launchTester("-updatevisuals");
-}
-
-void TestModel::updatePlatformVisuals()
-{
- launchTester("-updateplatformvisuals");
-}
-
-void TestModel::launchTester(const QString &args)
-{
- QStringList arguments;
- arguments << args << _testPath;
-
- QString visualTest;
-#if defined(Q_WS_WIN) || defined(Q_WS_S60)
- visualTest = "tst_qmlvisual.exe";
-#else
- visualTest = "./tst_qmlvisual";
-#endif
-
- QProcess p;
- p.setProcessChannelMode(QProcess::ForwardedChannels);
- p.start(visualTest, arguments);
- p.waitForFinished();
-}
-
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.h b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.h
deleted file mode 100644
index fd64dc2..0000000
--- a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef TESTMODEL_H
-#define TESTMODEL_H
-
-#include <QObject>
-#include <QString>
-#include <QStringList>
-
-class TestModel : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int snapshotCount READ snapshotCount CONSTANT)
- Q_PROPERTY(QStringList goodImages READ goodImages CONSTANT)//List of image locatoins
- Q_PROPERTY(QStringList badImages READ badImages CONSTANT)
- Q_PROPERTY(QStringList diffImages READ diffImages CONSTANT)
- Q_PROPERTY(QString testName READ testName CONSTANT) //The qml file name
- Q_PROPERTY(QString testCase READ testCase CONSTANT) //The actual contents, not the location
- Q_PROPERTY(QString testScript READ testScript CONSTANT) //The actual contents, not the location
-public:
- explicit TestModel(QObject *parent = 0);
- bool setTest(const QString &testPath);//testPath is the path to the test script, and assumes the file under test has the same name and is in the dir above
-
- int snapshotCount() { return _count; }
- QString testCase() { return _testCase; }
- QString testName() { return _testName; }
- QString testScript() {return _testScript; }
- QStringList goodImages() {return _good;}
- QStringList badImages() { return _bad; }
- QStringList diffImages() {return _diff;}
-
-signals:
- void moveOn();
-
-public slots:
- bool runTest();//returns true iff running the test changed the failure images.
- void updateVisuals();
- void updatePlatformVisuals();
-
-private:
- void launchTester(const QString &args);
-
- int _count;
- QStringList _good,_bad,_diff;
- QString _testCase;
- QString _testScript;
- QString _testPath;
- QString _testScriptPath;
- QString _testName;
-};
-
-#endif // TESTMODEL_H