From ed82a5dbe57fcc80b9d6244c73295f4b0b6e2835 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 3 Nov 2009 16:45:59 +1000 Subject: Allow example-specific test. Allow examples to report failure via error property. Workaround QTBUG-5296 by running webbrowser demo for longer. --- tests/auto/declarative/examples/data/webbrowser/webbrowser.qml | 6 ++++++ tests/auto/declarative/examples/tst_examples.cpp | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/examples/data/webbrowser/webbrowser.qml diff --git a/tests/auto/declarative/examples/data/webbrowser/webbrowser.qml b/tests/auto/declarative/examples/data/webbrowser/webbrowser.qml new file mode 100644 index 0000000..bdf3290 --- /dev/null +++ b/tests/auto/declarative/examples/data/webbrowser/webbrowser.qml @@ -0,0 +1,6 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { msec: 0 } + Frame { msec: 1000 } +} diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index ac12204..d758101 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -42,6 +42,7 @@ #include #include #include +#include class tst_examples : public QObject { @@ -179,9 +180,12 @@ void tst_examples::examples() { QFETCH(QString, file); + QFileInfo fi(file); + QFileInfo dir(fi.path()); + QFileInfo testdata("data/"+dir.baseName()+"/"+fi.baseName()); QStringList arguments; - arguments << "-script" << "data/dummytest" - << "-scriptopts" << "play,exitoncomplete,exitonfailure" + arguments << "-script" << (testdata.exists() ? testdata.filePath() : QLatin1String("data/dummytest")) + << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure" << file; QProcess p; p.start(qmlviewer, arguments); -- cgit v0.12