summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2012-10-17 11:07:04 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-17 22:51:31 +0200
commitb4e2cf5e4755828222f5a86dcb95c25584f89870 (patch)
tree60fc5fe64822fea7aa5687e21e9ac89008899659 /tests
parent5156fd1abb747b162dde52ce411968f84a42e8fd (diff)
QtQuick1: Make the examples test for QtQuick1 pass.
- Fix check to indicate immediate errors, skip the loading state and check for errors after loading again. - Exclude all broken examples. - Exclude Mac .app folders - Fix the DeclarativeViewer to check for the presence of the ImageMagick and ffmpeg executables only once, reducing test time. - Do not check for ImageMagick by running its command line tool 'convert' on Windows, since Windows has a tool of the same name that converts file systems (!). - Fix doc snippets to load correctly. - Introduce defines in case WebKit or XmlPatterns are not present (which existed in Qt 4). Task-number: QTQAINFRA-428 Change-Id: Icc0a983bc42857b41ab1d9e93336f8265bfbec36 Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com> Reviewed-by: Caroline Chao <caroline.chao@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/examples/examples.pro4
-rw-r--r--tests/auto/declarative/examples/tst_examples.cpp54
2 files changed, 41 insertions, 17 deletions
diff --git a/tests/auto/declarative/examples/examples.pro b/tests/auto/declarative/examples/examples.pro
index 111962a5..8ff6b6ef 100644
--- a/tests/auto/declarative/examples/examples.pro
+++ b/tests/auto/declarative/examples/examples.pro
@@ -2,6 +2,9 @@ CONFIG += testcase
testcase.timeout = 400 # this test is slow
TARGET = tst_examples
+!contains(QT_CONFIG, webkit): DEFINES += QT_NO_WEBKIT
+!contains(QT_CONFIG, xmlpatterns): DEFINES += QT_NO_XMLPATTERNS
+
QT += testlib
contains(QT_CONFIG,declarative): QT += declarative
macx:CONFIG -= app_bundle
@@ -14,5 +17,4 @@ DEFINES += SRCDIR=\\\"$$PWD\\\"
CONFIG += parallel_test
-CONFIG+=insignificant_test # QTQAINFRA-428
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp
index 199a5d2c..0a74b643 100644
--- a/tests/auto/declarative/examples/tst_examples.cpp
+++ b/tests/auto/declarative/examples/tst_examples.cpp
@@ -67,19 +67,30 @@ private:
tst_examples::tst_examples()
{
// Add directories you want excluded here
- excludedDirs << "doc/src/snippets/declarative/visualdatamodel_rootindex";
- excludedDirs << "doc/src/snippets/declarative/qtbinding";
+ excludedDirs << "doc/src/snippets/declarative/visualdatamodel_rootindex"
+ << "doc/src/snippets/declarative/qtbinding";
+ // Known to violate naming conventions, QTQAINFRA-428
+ excludedDirs << "demos/mobile/qtbubblelevel/qml"
+ << "demos/mobile/quickhit";
+ // Layouts do not install, QTQAINFRA-428
+ excludedDirs << "examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qml/qgraphicsgridlayout"
+ << "examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qml/qgraphicslinearlayout";
+ // Various QML errors, QTQAINFRA-428
+ excludedDirs << "doc/src/snippets/declarative/imports";
#ifdef QT_NO_WEBKIT
- excludedDirs << "examples/declarative/modelviews/webview";
- excludedDirs << "demos/declarative/webbrowser";
+ excludedDirs << "examples/declarative/modelviews/webview"
+ << "demos/declarative/webbrowser"
+ << "doc/src/snippets/declarative/webview";
#endif
#ifdef QT_NO_XMLPATTERNS
- excludedDirs << "examples/declarative/xml/xmldata";
- excludedDirs << "demos/declarative/twitter";
- excludedDirs << "demos/declarative/flickr";
- excludedDirs << "demos/declarative/photoviewer";
+ excludedDirs << "examples/declarative/xml/xmldata"
+ << "demos/declarative/twitter"
+ << "demos/declarative/flickr"
+ << "demos/declarative/photoviewer"
+ << "demos/declarative/rssnews/qml/rssnews"
+ << "doc/src/snippets/declarative";
#endif
}
@@ -128,11 +139,14 @@ void tst_examples::namingConvention()
QStringList tst_examples::findQmlFiles(const QDir &d)
{
- for (int ii = 0; ii < excludedDirs.count(); ++ii) {
- QString s = excludedDirs.at(ii);
- if (d.absolutePath().endsWith(s))
+ const QString absolutePath = d.absolutePath();
+#ifdef Q_OS_MAC // Mac: Do not recurse into bundle folders of built examples.
+ if (absolutePath.endsWith(QLatin1String(".app")))
+ return QStringList();
+#endif
+ foreach (const QString &excludedDir, excludedDirs)
+ if (absolutePath.endsWith(excludedDir))
return QStringList();
- }
QStringList rv;
@@ -186,6 +200,13 @@ static void silentErrorsMsgHandler(QtMsgType, const QMessageLogContext &, const
{
}
+static inline QByteArray msgViewerErrors(const QList<QDeclarativeError> &l)
+{
+ QString errors;
+ QDebug(&errors) << '\n' << l;
+ return errors.toLocal8Bit();
+}
+
void tst_examples::examples()
{
QFETCH(QString, file);
@@ -195,11 +216,12 @@ void tst_examples::examples()
QtMessageHandler old = qInstallMessageHandler(silentErrorsMsgHandler);
QVERIFY(viewer.open(file));
qInstallMessageHandler(old);
+ QVERIFY2(viewer.view()->status() != QDeclarativeView::Error,
+ msgViewerErrors(viewer.view()->errors()).constData());
+ QTRY_VERIFY(viewer.view()->status() != QDeclarativeView::Loading);
+ QVERIFY2(viewer.view()->status() == QDeclarativeView::Ready,
+ msgViewerErrors(viewer.view()->errors()).constData());
- if (viewer.view()->status() == QDeclarativeView::Error)
- qWarning() << viewer.view()->errors();
-
- QCOMPARE(viewer.view()->status(), QDeclarativeView::Ready);
viewer.show();
QVERIFY(QTest::qWaitForWindowActive(&viewer));