diff options
Diffstat (limited to 'tests/auto/declarative/qmlqt')
18 files changed, 0 insertions, 560 deletions
diff --git a/tests/auto/declarative/qmlqt/data/closestangle.qml b/tests/auto/declarative/qmlqt/data/closestangle.qml deleted file mode 100644 index b5f7fc6..0000000 --- a/tests/auto/declarative/qmlqt/data/closestangle.qml +++ /dev/null @@ -1,12 +0,0 @@ -import Qt 4.6 - -QtObject { - property var testSame: Qt.closestAngle(0,1) - property var testLess: Qt.closestAngle(0,-359) - property var testMore: Qt.closestAngle(0,361) - property var testFail: Qt.closestAngle(0) - property var test5: Qt.closestAngle(0,1,2) - property var test6: Qt.closestAngle(123.45465768,1.11) - property var test7: Qt.closestAngle(-3.1415,1.11) -} - diff --git a/tests/auto/declarative/qmlqt/data/consoleLog.qml b/tests/auto/declarative/qmlqt/data/consoleLog.qml deleted file mode 100644 index e657ff1..0000000 --- a/tests/auto/declarative/qmlqt/data/consoleLog.qml +++ /dev/null @@ -1,8 +0,0 @@ -import Qt 4.6 - -QtObject { - Component.onCompleted: { - console.log("completed", "ok") - console.log("completed ok") - } -} diff --git a/tests/auto/declarative/qmlqt/data/createComponent.qml b/tests/auto/declarative/qmlqt/data/createComponent.qml deleted file mode 100644 index d9b70ec..0000000 --- a/tests/auto/declarative/qmlqt/data/createComponent.qml +++ /dev/null @@ -1,23 +0,0 @@ -import Qt 4.6 - -QtObject { - property bool incorrectArgCount1: false - property bool incorrectArgCount2: false - property bool emptyArg: false - - property string relativeUrl - property string absoluteUrl - - Component.onCompleted: { - // Test that using incorrect argument count returns a null object - incorrectArgCount1 = (createComponent() == null); - incorrectArgCount2 = (createComponent("main.qml", 10) == null); - emptyArg = (createComponent("") == null); - - var r = createComponent("createComponentData.qml"); - relativeUrl = r.url; - - var a = createComponent("http://www.example.com/test.qml"); - absoluteUrl = a.url; - } -} diff --git a/tests/auto/declarative/qmlqt/data/createComponentData.qml b/tests/auto/declarative/qmlqt/data/createComponentData.qml deleted file mode 100644 index a5e99a0..0000000 --- a/tests/auto/declarative/qmlqt/data/createComponentData.qml +++ /dev/null @@ -1,5 +0,0 @@ -import Qt 4.6 - -QtObject { - property int test: 1913 -} diff --git a/tests/auto/declarative/qmlqt/data/createQmlObject.qml b/tests/auto/declarative/qmlqt/data/createQmlObject.qml deleted file mode 100644 index 9150782..0000000 --- a/tests/auto/declarative/qmlqt/data/createQmlObject.qml +++ /dev/null @@ -1,31 +0,0 @@ -import Qt 4.6 - -Item { - id: root - - property bool incorrectArgCount1: false - property bool incorrectArgCount2: false - property bool emptyArg: false - property bool noParent: false - property bool notReady: false - property bool runtimeError: false - property bool errors: false - - property bool success: false - - Component.onCompleted: { - // errors - incorrectArgCount1 = (createQmlObject() == null); - incorrectArgCount2 = (createQmlObject("import Qt 4.6\nQtObject{}", root, "main.qml", 10) == null); - emptyArg = (createQmlObject("", root) == null); - errors = (createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13\nproperty int test: 13\n}", root, "main.qml") == null); - noParent = (createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13}", 0) == null); - notReady = (createQmlObject("import Qt 4.6\nQtObject{\nBlah{}\n}", root, "http://www.example.com/main.qml") == null); - runtimeError = (createQmlObject("import Qt 4.6\nQtObject{property int test\nonTestChanged: QtObject{}\n}", root) == null); - - var o = createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13\n}", root); - success = (o.test == 13); - - createQmlObject("import Qt 4.6\nItem {}\n", root); - } -} diff --git a/tests/auto/declarative/qmlqt/data/darker.qml b/tests/auto/declarative/qmlqt/data/darker.qml deleted file mode 100644 index 2df067e..0000000 --- a/tests/auto/declarative/qmlqt/data/darker.qml +++ /dev/null @@ -1,11 +0,0 @@ -import Qt 4.6 - -QtObject { - property var test1: Qt.darker(Qt.rgba(1, 0.8, 0.3)) - property var test2: Qt.darker() - property var test3: Qt.darker(Qt.rgba(1, 0.8, 0.3), 10) - property var test4: Qt.darker("red"); - property var test5: Qt.darker("perfectred"); // Non-existant color - property var test6: Qt.darker(10); -} - diff --git a/tests/auto/declarative/qmlqt/data/enums.qml b/tests/auto/declarative/qmlqt/data/enums.qml deleted file mode 100644 index 1efa6f5..0000000 --- a/tests/auto/declarative/qmlqt/data/enums.qml +++ /dev/null @@ -1,9 +0,0 @@ -import Qt 4.6 - -QtObject { - property int test1: Qt.Key_Escape - property int test2: Qt.DescendingOrder - property int test3: Qt.ElideMiddle - property int test4: Qt.AlignRight -} - diff --git a/tests/auto/declarative/qmlqt/data/hsla.qml b/tests/auto/declarative/qmlqt/data/hsla.qml deleted file mode 100644 index df51ccd..0000000 --- a/tests/auto/declarative/qmlqt/data/hsla.qml +++ /dev/null @@ -1,11 +0,0 @@ -import Qt 4.6 - -QtObject { - property color test1: Qt.hsla(1, 0, 0, 0.8); - property color test2: Qt.hsla(1, 0.5, 0.3); - property color test3: Qt.hsla(1, 1); - property color test4: Qt.hsla(1, 1, 1, 1, 1); - property color test5: Qt.hsla(1.2, 1, 1); - property color test6: Qt.hsla(-0.1, 1, 1); -} - diff --git a/tests/auto/declarative/qmlqt/data/lighter.qml b/tests/auto/declarative/qmlqt/data/lighter.qml deleted file mode 100644 index 4e0c431..0000000 --- a/tests/auto/declarative/qmlqt/data/lighter.qml +++ /dev/null @@ -1,10 +0,0 @@ -import Qt 4.6 - -QtObject { - property var test1: Qt.lighter(Qt.rgba(1, 0.8, 0.3)) - property var test2: Qt.lighter() - property var test3: Qt.lighter(Qt.rgba(1, 0.8, 0.3), 10) - property var test4: Qt.lighter("red"); - property var test5: Qt.lighter("perfectred"); // Non-existant color - property var test6: Qt.lighter(10); -} diff --git a/tests/auto/declarative/qmlqt/data/md5.qml b/tests/auto/declarative/qmlqt/data/md5.qml deleted file mode 100644 index c474b71..0000000 --- a/tests/auto/declarative/qmlqt/data/md5.qml +++ /dev/null @@ -1,6 +0,0 @@ -import Qt 4.6 - -QtObject { - property string test1: Qt.md5() - property string test2: Qt.md5("Hello World") -} diff --git a/tests/auto/declarative/qmlqt/data/point.qml b/tests/auto/declarative/qmlqt/data/point.qml deleted file mode 100644 index c383beb..0000000 --- a/tests/auto/declarative/qmlqt/data/point.qml +++ /dev/null @@ -1,9 +0,0 @@ -import Qt 4.6 - -QtObject { - property var test1: Qt.point(19, 34); - property var test2: Qt.point(-3, 109.2); - property var test3: Qt.point(-3); - property var test4: Qt.point(-3, 109.2, 1); -} - diff --git a/tests/auto/declarative/qmlqt/data/rect.qml b/tests/auto/declarative/qmlqt/data/rect.qml deleted file mode 100644 index 82b6428..0000000 --- a/tests/auto/declarative/qmlqt/data/rect.qml +++ /dev/null @@ -1,9 +0,0 @@ -import Qt 4.6 - -QtObject { - property var test1: Qt.rect(10, 13, 100, 109) - property var test2: Qt.rect(-10, 13, 100, 109.6) - property var test3: Qt.rect(10, 13); - property var test4: Qt.rect(10, 13, 100, 109, 10) - property var test5: Qt.rect(10, 13, 100, -109) -} diff --git a/tests/auto/declarative/qmlqt/data/rgba.qml b/tests/auto/declarative/qmlqt/data/rgba.qml deleted file mode 100644 index 6dd6565..0000000 --- a/tests/auto/declarative/qmlqt/data/rgba.qml +++ /dev/null @@ -1,10 +0,0 @@ -import Qt 4.6 - -QtObject { - property color test1: Qt.rgba(1, 0, 0, 0.8); - property color test2: Qt.rgba(1, 0.5, 0.3); - property color test3: Qt.rgba(1, 1); - property color test4: Qt.rgba(1, 1, 1, 1, 1); - property color test5: Qt.rgba(1.2, 1, 1); - property color test6: Qt.rgba(-0.1, 1, 1); -} diff --git a/tests/auto/declarative/qmlqt/data/size.qml b/tests/auto/declarative/qmlqt/data/size.qml deleted file mode 100644 index 05b0317..0000000 --- a/tests/auto/declarative/qmlqt/data/size.qml +++ /dev/null @@ -1,11 +0,0 @@ -import Qt 4.6 - -QtObject { - property var test1: Qt.size(19, 34); - property var test2: Qt.size(3, 109.2); - property var test3: Qt.size(-3, 10); - property var test4: Qt.size(3); - property var test5: Qt.size(3, 109.2, 1); -} - - diff --git a/tests/auto/declarative/qmlqt/data/tint.qml b/tests/auto/declarative/qmlqt/data/tint.qml deleted file mode 100644 index da8afe2..0000000 --- a/tests/auto/declarative/qmlqt/data/tint.qml +++ /dev/null @@ -1,9 +0,0 @@ -import Qt 4.6 - -QtObject { - property color test1: Qt.tint("red", "blue"); - property color test2: Qt.tint(Qt.rgba(1, 0, 0), Qt.rgba(0, 0, 0, 0)); - property color test3: Qt.tint("red", Qt.rgba(0, 0, 1, 0.5)); // XXX - what should this be? - property color test4: Qt.tint("red", Qt.rgba(0, 0, 1, 0.5), 10); - property color test5: Qt.tint("red") -} diff --git a/tests/auto/declarative/qmlqt/data/vector.qml b/tests/auto/declarative/qmlqt/data/vector.qml deleted file mode 100644 index a471c7a..0000000 --- a/tests/auto/declarative/qmlqt/data/vector.qml +++ /dev/null @@ -1,8 +0,0 @@ -import Qt 4.6 - -QtObject { - property var test1: Qt.vector3d(1, 0, 0.9); - property var test2: Qt.vector3d(102, -10, -982.1); - property var test3: Qt.vector3d(102, -10); - property var test4: Qt.vector3d(102, -10, -982.1, 10); -} diff --git a/tests/auto/declarative/qmlqt/qmlqt.pro b/tests/auto/declarative/qmlqt/qmlqt.pro deleted file mode 100644 index 5e79ea6..0000000 --- a/tests/auto/declarative/qmlqt/qmlqt.pro +++ /dev/null @@ -1,9 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -SOURCES += tst_qmlqt.cpp -macx:CONFIG -= app_bundle - -DEFINES += SRCDIR=\\\"$$PWD\\\" - -# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -# LIBS += -lgcov diff --git a/tests/auto/declarative/qmlqt/tst_qmlqt.cpp b/tests/auto/declarative/qmlqt/tst_qmlqt.cpp deleted file mode 100644 index c3c2521..0000000 --- a/tests/auto/declarative/qmlqt/tst_qmlqt.cpp +++ /dev/null @@ -1,369 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <qtest.h> -#include <QDebug> -#include <QmlEngine> -#include <QFileInfo> -#include <QmlComponent> -#include <QDir> -#include <QVector3D> -#include <QCryptographicHash> -#include <QmlGraphicsItem> - -class tst_qmlqt : public QObject -{ - Q_OBJECT -public: - tst_qmlqt() {} - -private slots: - void enums(); - void rgba(); - void hsla(); - void rect(); - void point(); - void size(); - void vector(); - void lighter(); - void darker(); - void tint(); - void closestAngle(); - void playSound(); - void openUrlExternally(); - void md5(); - void createComponent(); - void createQmlObject(); - void consoleLog(); - -private: - QmlEngine engine; -}; - -inline QUrl TEST_FILE(const QString &filename) -{ - return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); -} - -void tst_qmlqt::enums() -{ - QmlComponent component(&engine, TEST_FILE("enums.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test1").toInt(), (int)Qt::Key_Escape); - QCOMPARE(object->property("test2").toInt(), (int)Qt::DescendingOrder); - QCOMPARE(object->property("test3").toInt(), (int)Qt::ElideMiddle); - QCOMPARE(object->property("test4").toInt(), (int)Qt::AlignRight); - - delete object; -} - -void tst_qmlqt::rgba() -{ - QmlComponent component(&engine, TEST_FILE("rgba.qml")); - - QString warning1 = component.url().toString() + ":6: Unable to assign null to QColor"; - QString warning2 = component.url().toString() + ":7: Unable to assign null to QColor"; - QString warning3 = component.url().toString() + ":8: Unable to assign null to QColor"; - QString warning4 = component.url().toString() + ":9: Unable to assign null to QColor"; - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4)); - - QObject *object = component.create(); - QVERIFY(object != 0); - - - QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0, 0, 0.8)); - QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromRgbF(1, 0.5, 0.3, 1)); - QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor()); - - delete object; -} - -void tst_qmlqt::hsla() -{ - QmlComponent component(&engine, TEST_FILE("hsla.qml")); - - QString warning1 = component.url().toString() + ":6: Unable to assign null to QColor"; - QString warning2 = component.url().toString() + ":7: Unable to assign null to QColor"; - QString warning3 = component.url().toString() + ":8: Unable to assign null to QColor"; - QString warning4 = component.url().toString() + ":9: Unable to assign null to QColor"; - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4)); - - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromHslF(1, 0, 0, 0.8)); - QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromHslF(1, 0.5, 0.3, 1)); - QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor()); - - delete object; -} - -void tst_qmlqt::rect() -{ - QmlComponent component(&engine, TEST_FILE("rect.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<QRectF>(object->property("test1")), QRectF(10, 13, 100, 109)); - QCOMPARE(qvariant_cast<QRectF>(object->property("test2")), QRectF(-10, 13, 100, 109.6)); - QCOMPARE(qvariant_cast<QRectF>(object->property("test3")), QRectF()); - QCOMPARE(qvariant_cast<QRectF>(object->property("test4")), QRectF()); - QCOMPARE(qvariant_cast<QRectF>(object->property("test5")), QRectF()); - - delete object; -} - -void tst_qmlqt::point() -{ - QmlComponent component(&engine, TEST_FILE("point.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<QPointF>(object->property("test1")), QPointF(19, 34)); - QCOMPARE(qvariant_cast<QPointF>(object->property("test2")), QPointF(-3, 109.2)); - QCOMPARE(qvariant_cast<QPointF>(object->property("test3")), QPointF()); - QCOMPARE(qvariant_cast<QPointF>(object->property("test4")), QPointF()); - - delete object; -} - -void tst_qmlqt::size() -{ - QmlComponent component(&engine, TEST_FILE("size.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<QSizeF>(object->property("test1")), QSizeF(19, 34)); - QCOMPARE(qvariant_cast<QSizeF>(object->property("test2")), QSizeF(3, 109.2)); - QCOMPARE(qvariant_cast<QSizeF>(object->property("test3")), QSizeF(-3, 10)); - QCOMPARE(qvariant_cast<QSizeF>(object->property("test4")), QSizeF()); - QCOMPARE(qvariant_cast<QSizeF>(object->property("test5")), QSizeF()); - - delete object; -} - -void tst_qmlqt::vector() -{ - QmlComponent component(&engine, TEST_FILE("vector.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<QVector3D>(object->property("test1")), QVector3D(1, 0, 0.9)); - QCOMPARE(qvariant_cast<QVector3D>(object->property("test2")), QVector3D(102, -10, -982.1)); - QCOMPARE(qvariant_cast<QVector3D>(object->property("test3")), QVector3D()); - QCOMPARE(qvariant_cast<QVector3D>(object->property("test4")), QVector3D()); - - delete object; -} - -void tst_qmlqt::lighter() -{ - QmlComponent component(&engine, TEST_FILE("lighter.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0.8, 0.3).lighter()); - QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor("red").lighter()); - QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor()); - - delete object; -} - -void tst_qmlqt::darker() -{ - QmlComponent component(&engine, TEST_FILE("darker.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0.8, 0.3).darker()); - QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor("red").darker()); - QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor()); - - delete object; -} - -void tst_qmlqt::tint() -{ - QmlComponent component(&engine, TEST_FILE("tint.qml")); - - QString warning1 = component.url().toString() + ":7: Unable to assign null to QColor"; - QString warning2 = component.url().toString() + ":8: Unable to assign null to QColor"; - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); - - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(0, 0, 1)); - QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromRgbF(1, 0, 0)); - QEXPECT_FAIL("", "QT-2424",Continue); - QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor::fromRgbF(1, 0, 0)); - QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor()); - - delete object; -} - -void tst_qmlqt::closestAngle() -{ - QmlComponent component(&engine, TEST_FILE("closestangle.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<qreal>(object->property("testSame")), 1.0); - QCOMPARE(qvariant_cast<qreal>(object->property("testLess")), 1.0); - QCOMPARE(qvariant_cast<qreal>(object->property("testMore")), 1.0); - QCOMPARE(qvariant_cast<qreal>(object->property("testFail")), 0.0); - QCOMPARE(qvariant_cast<qreal>(object->property("test5")), 1.0); - QCOMPARE(qvariant_cast<qreal>(object->property("test6")), 1.11); - QCOMPARE(qvariant_cast<qreal>(object->property("test7")), 1.11); - - delete object; -} - -void tst_qmlqt::playSound() -{ - QEXPECT_FAIL("", "How do we test this?", Abort); - QVERIFY(false); -} - -void tst_qmlqt::openUrlExternally() -{ - QEXPECT_FAIL("", "How do we test this?", Abort); - QVERIFY(false); -} - -void tst_qmlqt::md5() -{ - QmlComponent component(&engine, TEST_FILE("md5.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test1").toString(), QLatin1String(QCryptographicHash::hash(QByteArray(), QCryptographicHash::Md5).toHex())); - QCOMPARE(object->property("test2").toString(), QLatin1String(QCryptographicHash::hash("Hello World", QCryptographicHash::Md5).toHex())); - - delete object; -} - -void tst_qmlqt::createComponent() -{ - QmlComponent component(&engine, TEST_FILE("createComponent.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("incorrectArgCount1").toBool(), true); - QCOMPARE(object->property("incorrectArgCount2").toBool(), true); - QCOMPARE(object->property("emptyArg").toBool(), true); - - QCOMPARE(object->property("absoluteUrl").toString(), QString("http://www.example.com/test.qml")); - QCOMPARE(object->property("relativeUrl").toString(), TEST_FILE("createComponentData.qml").toString()); - - delete object; -} - -void tst_qmlqt::createQmlObject() -{ - QmlComponent component(&engine, TEST_FILE("createQmlObject.qml")); - - QString warning1 = "QmlEngine::createQmlObject():"; - QString warning2 = " " + TEST_FILE("main.qml").toString() + ":4:1: Duplicate property name"; - QString warning3 = "QmlEngine::createQmlObject(): Component is not ready"; - QString warning4 = "QmlEngine::createQmlObject():"; - QString warning5 = " " + TEST_FILE("inline").toString() + ":3: Cannot assign object type QObject with no default method"; - - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning5)); - - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("incorrectArgCount1").toBool(), true); - QCOMPARE(object->property("incorrectArgCount2").toBool(), true); - QCOMPARE(object->property("emptyArg").toBool(), true); - QCOMPARE(object->property("errors").toBool(), true); - QCOMPARE(object->property("noParent").toBool(), true); - QCOMPARE(object->property("notReady").toBool(), true); - QCOMPARE(object->property("runtimeError").toBool(), true); - QCOMPARE(object->property("success").toBool(), true); - - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem *>(object); - QVERIFY(item != 0); - QVERIFY(item->childItems().count() == 1); - - delete object; -} - -void tst_qmlqt::consoleLog() -{ - QTest::ignoreMessage(QtDebugMsg, "completed ok"); - QTest::ignoreMessage(QtDebugMsg, "completed ok"); - QmlComponent component(&engine, TEST_FILE("consoleLog.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - delete object; -} - -QTEST_MAIN(tst_qmlqt) - -#include "tst_qmlqt.moc" |