diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-05-08 05:04:29 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-05-08 05:04:29 (GMT) |
commit | df7dce62777fb953d26fcd30d6f56dc16c945ac0 (patch) | |
tree | 79047a96a5b699d55c117719b757e99d593ca3d0 /tests/auto/declarative/namespaces | |
parent | 309de75f1e0ce2e85b2f58e34b876f902c9d0292 (diff) | |
download | Qt-df7dce62777fb953d26fcd30d6f56dc16c945ac0.zip Qt-df7dce62777fb953d26fcd30d6f56dc16c945ac0.tar.gz Qt-df7dce62777fb953d26fcd30d6f56dc16c945ac0.tar.bz2 |
Autotest format conversion.
Diffstat (limited to 'tests/auto/declarative/namespaces')
-rw-r--r-- | tests/auto/declarative/namespaces/data/Red/Rect.qml | 2 | ||||
-rw-r--r-- | tests/auto/declarative/namespaces/namespaces.pro | 6 | ||||
-rw-r--r-- | tests/auto/declarative/namespaces/tst_namespaces.cpp | 94 |
3 files changed, 0 insertions, 102 deletions
diff --git a/tests/auto/declarative/namespaces/data/Red/Rect.qml b/tests/auto/declarative/namespaces/data/Red/Rect.qml deleted file mode 100644 index c7b3d8c..0000000 --- a/tests/auto/declarative/namespaces/data/Red/Rect.qml +++ /dev/null @@ -1,2 +0,0 @@ -<Text objectName="x" text="Pretending to be a Rect" color="red"> -</Text> diff --git a/tests/auto/declarative/namespaces/namespaces.pro b/tests/auto/declarative/namespaces/namespaces.pro deleted file mode 100644 index f232770..0000000 --- a/tests/auto/declarative/namespaces/namespaces.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -SOURCES += tst_namespaces.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/namespaces/tst_namespaces.cpp b/tests/auto/declarative/namespaces/tst_namespaces.cpp deleted file mode 100644 index e9529ff..0000000 --- a/tests/auto/declarative/namespaces/tst_namespaces.cpp +++ /dev/null @@ -1,94 +0,0 @@ -#include <qtest.h> -#include <QtDeclarative/qfxview.h> -#include <QtDeclarative/qmlcontext.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qfxrect.h> -#include <QtDeclarative/qfxtext.h> -#include <QDir> - -class tst_namespaces : public QObject - -{ - Q_OBJECT -public: - tst_namespaces(); - -private slots: - void simple(); - void simple_data(); -}; - -tst_namespaces::tst_namespaces() -{ -} - -void tst_namespaces::simple_data() -{ - QTest::addColumn<QString>("qml"); - QTest::addColumn<bool>("valid"); - QTest::addColumn<QString>("texts"); - QTest::addColumn<QString>("rects"); - - QTest::newRow("Control") << - "<Rect objectName=\"a\">" - "<Rect objectName=\"b\"/>" - "</Rect>" - << true << "" << "ab"; - - QTest::newRow("Control2") << - "<Rect objectName=\"a\">" - "<Text objectName=\"b\"/>" - "</Rect>" - << true << "b" << "a"; - - QTest::newRow("Replace builtin") << - "<Rect objectName=\"a\" xmlns:rs=\"http://nokia.com/qml/Red\">" - "<rs:Rect objectName=\"b\"/>" - "</Rect>" - << true << "b" << "a"; -} - -void tst_namespaces::simple() -{ - QFETCH(QString, qml); - QFETCH(bool, valid); - QFETCH(QString, texts); - QFETCH(QString, rects); - - QFxView canvas(0); - canvas.rootContext()->engine()->addNameSpacePath("http://nokia.com/qml", SRCDIR "/data"); - canvas.setQml(qml); - canvas.execute(); - qApp->processEvents(); - - QFxItem *testObject = qobject_cast<QFxItem*>(canvas.root()); - - QCOMPARE((testObject != 0),valid); - - if (valid && testObject != 0) { - QString textids; - QList<QFxText*> textobjects = testObject->findChildren<QFxText*>(); - if (qobject_cast<QFxText*>(testObject)) - textids += testObject->objectName(); - foreach (QFxText *obj, textobjects) { - textids += obj->objectName(); - } - if (textids != texts) - testObject->dump(); - QCOMPARE(textids,texts); - - QString rectids; - QList<QFxRect*> rectobjects = testObject->findChildren<QFxRect*>(); - if (qobject_cast<QFxRect*>(testObject)) - rectids += testObject->objectName(); - foreach (QFxRect *obj, rectobjects) - rectids += obj->objectName(); - if (rectids != rects) - testObject->dump(); - QCOMPARE(rectids,rects); - } -} - -QTEST_MAIN(tst_namespaces) - -#include "tst_namespaces.moc" |