summaryrefslogtreecommitdiffstats
path: root/tools/qml
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2010-10-29 04:58:58 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2010-10-29 05:10:28 (GMT)
commit8e3a0c2df1cff2ca960555ad16654ff77f7efcc8 (patch)
tree562d0eb03ff70cd32c65e081cb1258b15acb9fb5 /tools/qml
parent03fa1fb439456428da883133d26038409462aca6 (diff)
downloadQt-8e3a0c2df1cff2ca960555ad16654ff77f7efcc8.zip
Qt-8e3a0c2df1cff2ca960555ad16654ff77f7efcc8.tar.gz
Qt-8e3a0c2df1cff2ca960555ad16654ff77f7efcc8.tar.bz2
Add 'skip' property that QML visual tests can use
This property can be set with a reason to skip the test (i.e. known bug) and the failure will not count for blocking purposes. This change also alters one of the failing tests to use the new property Task-number: QTBUG-14792 Reviewed-by: Michael Brasser
Diffstat (limited to 'tools/qml')
-rw-r--r--tools/qml/main.cpp3
-rw-r--r--tools/qml/qdeclarativetester.cpp32
-rw-r--r--tools/qml/qdeclarativetester.h1
-rw-r--r--tools/qml/qmlruntime.h3
4 files changed, 33 insertions, 6 deletions
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 00d43c1..579f1ab 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -172,6 +172,7 @@ void scriptOptsUsage()
qWarning(" play ..................................... playback an existing script");
qWarning(" testimages ............................... record images or compare images on playback");
qWarning(" testerror ................................ test 'error' property of root item on playback");
+ qWarning(" testskip ................................ test 'skip' property of root item on playback");
qWarning(" snapshot ................................. file being recorded is static,");
qWarning(" only one frame will be recorded or tested");
qWarning(" exitoncomplete ........................... cleanly exit the viewer on script completion");
@@ -305,6 +306,8 @@ static void parseScriptOptions()
scriptOptions |= QDeclarativeViewer::TestImages;
} else if (option == QLatin1String("testerror")) {
scriptOptions |= QDeclarativeViewer::TestErrorProperty;
+ } else if (option == QLatin1String("testskip")) {
+ scriptOptions |= QDeclarativeViewer::TestSkipProperty;
} else if (option == QLatin1String("exitoncomplete")) {
scriptOptions |= QDeclarativeViewer::ExitOnComplete;
} else if (option == QLatin1String("exitonfailure")) {
diff --git a/tools/qml/qdeclarativetester.cpp b/tools/qml/qdeclarativetester.cpp
index 9864df6..a0ef4a1 100644
--- a/tools/qml/qdeclarativetester.cpp
+++ b/tools/qml/qdeclarativetester.cpp
@@ -128,16 +128,35 @@ void QDeclarativeTester::executefailure()
{
hasFailed = true;
- if (options & QDeclarativeViewer::ExitOnFailure)
- exit(-1);
+ if (options & QDeclarativeViewer::ExitOnFailure){
+ testSkip();
+ exit(hasFailed?-1:0);
+ }
}
void QDeclarativeTester::imagefailure()
{
hasFailed = true;
- if (options & QDeclarativeViewer::ExitOnFailure)
- exit(-1);
+ if (options & QDeclarativeViewer::ExitOnFailure){
+ testSkip();
+ exit(hasFailed?-1:0);
+ }
+}
+
+void QDeclarativeTester::testSkip()
+{
+ if (options & QDeclarativeViewer::TestSkipProperty){
+ QString e = m_view->rootObject()->property("skip").toString();
+ if (!e.isEmpty()) {
+ if(hasFailed){
+ qWarning() << "Test failed, but skipping it: " << e;
+ }else{
+ qWarning() << "Test skipped: " << e;
+ }
+ hasFailed = 0;
+ }
+ }
}
void QDeclarativeTester::complete()
@@ -149,7 +168,10 @@ void QDeclarativeTester::complete()
hasFailed = true;
}
}
- if (options & QDeclarativeViewer::ExitOnComplete)
+
+
+ testSkip();
+ if (options & QDeclarativeViewer::ExitOnComplete)
QApplication::exit(hasFailed?-1:0);
if (hasCompleted)
diff --git a/tools/qml/qdeclarativetester.h b/tools/qml/qdeclarativetester.h
index 021869d..0cf508a 100644
--- a/tools/qml/qdeclarativetester.h
+++ b/tools/qml/qdeclarativetester.h
@@ -228,6 +228,7 @@ private:
void imagefailure();
void complete();
+ void testSkip();
enum Destination { View, ViewPort };
void addKeyEvent(Destination, QKeyEvent *);
diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h
index d1ec26d..b43aa54 100644
--- a/tools/qml/qmlruntime.h
+++ b/tools/qml/qmlruntime.h
@@ -83,7 +83,8 @@ public:
SaveOnExit = 0x00000010,
ExitOnComplete = 0x00000020,
ExitOnFailure = 0x00000040,
- Snapshot = 0x00000080
+ Snapshot = 0x00000080,
+ TestSkipProperty = 0x00000100
};
Q_DECLARE_FLAGS(ScriptOptions, ScriptOption)
void setScript(const QString &s) { m_script = s; }