summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeqt
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-04-09 07:59:07 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-04-09 07:59:07 (GMT)
commit3d90e35abae15f133ad2a71874f6926773c96449 (patch)
tree8faae80f578c8faea02bf5a1d4855ed0bb7e402c /tests/auto/declarative/qdeclarativeqt
parent06c286b74274166a47df20dc425f76051fb03d4d (diff)
downloadQt-3d90e35abae15f133ad2a71874f6926773c96449.zip
Qt-3d90e35abae15f133ad2a71874f6926773c96449.tar.gz
Qt-3d90e35abae15f133ad2a71874f6926773c96449.tar.bz2
Add a Qt.isQtObject() method
QTBUG-9705
Diffstat (limited to 'tests/auto/declarative/qdeclarativeqt')
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/isQtObject.qml14
-rw-r--r--tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp16
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeqt/data/isQtObject.qml b/tests/auto/declarative/qdeclarativeqt/data/isQtObject.qml
new file mode 100644
index 0000000..d986492
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/isQtObject.qml
@@ -0,0 +1,14 @@
+import Qt 4.6
+
+QtObject {
+ id: root
+
+ property QtObject nullObject
+
+ property bool test1: Qt.isQtObject(root)
+ property bool test2: Qt.isQtObject(nullObject)
+ property bool test3: Qt.isQtObject(10)
+ property bool test4: Qt.isQtObject(null)
+ property bool test5: Qt.isQtObject({ a: 10, b: 11 })
+}
+
diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
index 48d5235..98f1200 100644
--- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
+++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
@@ -73,6 +73,7 @@ private slots:
void createQmlObject();
void consoleLog();
void formatting();
+ void isQtObject();
private:
QDeclarativeEngine engine;
@@ -392,6 +393,21 @@ void tst_qdeclarativeqt::formatting()
delete object;
}
+void tst_qdeclarativeqt::isQtObject()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("isQtObject.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), false);
+ QCOMPARE(object->property("test3").toBool(), false);
+ QCOMPARE(object->property("test4").toBool(), false);
+ QCOMPARE(object->property("test5").toBool(), false);
+
+ delete object;
+}
+
QTEST_MAIN(tst_qdeclarativeqt)
#include "tst_qdeclarativeqt.moc"