summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-05-25 06:45:19 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-05-25 06:45:19 (GMT)
commitfbfdb18e246f5e22f1252471be67182ff1acfe36 (patch)
tree857a01da09d69df0ed87f730534cac92a8e5a0e8 /tests/auto
parent10b28224afeabb388d21c32aac5f51f5ecea58ed (diff)
parentb02bf4ef805e33a763d86ec8ff496a27fddc8ad8 (diff)
downloadQt-fbfdb18e246f5e22f1252471be67182ff1acfe36.zip
Qt-fbfdb18e246f5e22f1252471be67182ff1acfe36.tar.gz
Qt-fbfdb18e246f5e22f1252471be67182ff1acfe36.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/groupedPropertyCrash.qml10
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp10
-rw-r--r--tests/auto/declarative/qdeclarativecomponent/data/createObject.qml16
-rw-r--r--tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp28
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp10
-rw-r--r--tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp8
-rw-r--r--tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp6
8 files changed, 77 insertions, 13 deletions
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/groupedPropertyCrash.qml b/tests/auto/declarative/qdeclarativebehaviors/data/groupedPropertyCrash.qml
new file mode 100644
index 0000000..c052366
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/groupedPropertyCrash.qml
@@ -0,0 +1,10 @@
+import Qt 4.7
+
+Rectangle {
+ width: 200
+ height: 200
+ Text {
+ Behavior on anchors.verticalCenterOffset { NumberAnimation { duration: 300; } }
+ text: "Hello World"
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
index 1dc4b53..45e5304 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
+++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
@@ -72,6 +72,7 @@ private slots:
void disabled();
void dontStart();
void startup();
+ void groupedPropertyCrash();
};
void tst_qdeclarativebehaviors::simpleBehavior()
@@ -351,6 +352,15 @@ void tst_qdeclarativebehaviors::startup()
}
}
+//QTBUG-10799
+void tst_qdeclarativebehaviors::groupedPropertyCrash()
+{
+ QDeclarativeEngine engine;
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/groupedPropertyCrash.qml"));
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
+ QVERIFY(rect); //don't crash
+}
+
QTEST_MAIN(tst_qdeclarativebehaviors)
#include "tst_qdeclarativebehaviors.moc"
diff --git a/tests/auto/declarative/qdeclarativecomponent/data/createObject.qml b/tests/auto/declarative/qdeclarativecomponent/data/createObject.qml
new file mode 100644
index 0000000..4ee1e75
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativecomponent/data/createObject.qml
@@ -0,0 +1,16 @@
+import Qt 4.7
+
+Item{
+ id: root
+ property QtObject qobject : null
+ property QtObject declarativeitem : null
+ property QtObject graphicswidget: null
+ Component{id: a; QtObject{} }
+ Component{id: b; Item{} }
+ Component{id: c; QGraphicsWidget{} }
+ Component.onCompleted: {
+ root.qobject = a.createObject(root);
+ root.declarativeitem = b.createObject(root);
+ root.graphicswidget = c.createObject(root);
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
index c9e304c..faa1c21 100644
--- a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
+++ b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
@@ -39,7 +39,9 @@
**
****************************************************************************/
#include <qtest.h>
+#include <QDebug>
+#include <QtGui/qgraphicsitem.h>
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtDeclarative/qdeclarativecomponent.h>
@@ -51,6 +53,7 @@ public:
private slots:
void loadEmptyUrl();
+ void qmlCreateObject();
private:
QDeclarativeEngine engine;
@@ -70,6 +73,31 @@ void tst_qdeclarativecomponent::loadEmptyUrl()
QCOMPARE(error.description(), QLatin1String("Invalid empty URL"));
}
+void tst_qdeclarativecomponent::qmlCreateObject()
+{
+ QDeclarativeEngine engine;
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/createObject.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QObject *testObject1 = object->property("qobject").value<QObject*>();
+ QVERIFY(testObject1);
+ QVERIFY(testObject1->parent() == object);
+
+ QObject *testObject2 = object->property("declarativeitem").value<QObject*>();
+ QVERIFY(testObject2);
+ QVERIFY(testObject2->parent() == object);
+ QCOMPARE(testObject2->metaObject()->className(), "QDeclarativeItem");
+
+ //Note that QGraphicsObjects are not exposed to QML for instantiation, and so can't be used in a component directly
+ //Also this is actually the extended type QDeclarativeGraphicsWidget, but it still doesn't inherit QDeclarativeItem
+ QGraphicsObject *testObject3 = qobject_cast<QGraphicsObject*>(object->property("graphicswidget").value<QObject*>());
+ QVERIFY(testObject3);
+ QVERIFY(testObject3->parent() == object);
+ QVERIFY(testObject3->parentItem() == qobject_cast<QGraphicsObject*>(object));
+ QCOMPARE(testObject3->metaObject()->className(), "QDeclarativeGraphicsWidget");
+}
+
QTEST_MAIN(tst_qdeclarativecomponent)
#include "tst_qdeclarativecomponent.moc"
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 9a8ad64..e75abac 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -564,7 +564,7 @@ void tst_qdeclarativeecmascript::deferredPropertiesErrors()
QVERIFY(object->objectProperty() == 0);
QVERIFY(object->objectProperty2() == 0);
- QString warning = component.url().toString() + ":6: Unable to assign [undefined] to QObject*";
+ QString warning = component.url().toString() + ":6: Unable to assign [undefined] to QObject* objectProperty";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
qmlExecuteDeferred(object);
@@ -642,8 +642,8 @@ void tst_qdeclarativeecmascript::enums()
{
QDeclarativeComponent component(&engine, TEST_FILE("enums.2.qml"));
- QString warning1 = component.url().toString() + ":5: Unable to assign [undefined] to int";
- QString warning2 = component.url().toString() + ":6: Unable to assign [undefined] to int";
+ QString warning1 = component.url().toString() + ":5: Unable to assign [undefined] to int a";
+ QString warning2 = component.url().toString() + ":6: Unable to assign [undefined] to int b";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
@@ -754,7 +754,7 @@ void tst_qdeclarativeecmascript::nonExistantAttachedObject()
{
QDeclarativeComponent component(&engine, TEST_FILE("nonExistantAttachedObject.qml"));
- QString warning = component.url().toString() + ":4: Unable to assign [undefined] to QString";
+ QString warning = component.url().toString() + ":4: Unable to assign [undefined] to QString stringProperty";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
QObject *object = component.create();
@@ -1001,7 +1001,7 @@ void tst_qdeclarativeecmascript::scriptErrors()
QString warning3 = url.left(url.length() - 3) + "js:4: Error: Invalid write to global property \"a\"";
QString warning4 = url + ":10: TypeError: Result of expression 'a' [undefined] is not an object.";
QString warning5 = url + ":8: TypeError: Result of expression 'a' [undefined] is not an object.";
- QString warning6 = url + ":7: Unable to assign [undefined] to int";
+ QString warning6 = url + ":7: Unable to assign [undefined] to int x";
QString warning7 = url + ":12: Error: Cannot assign to read-only property \"trueProperty\"";
QString warning8 = url + ":13: Error: Cannot assign to non-existent property \"fakeProperty\"";
diff --git a/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp
index b0db771..0aebea1 100644
--- a/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp
+++ b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp
@@ -266,7 +266,7 @@ void tst_qdeclarativeengine::outputWarningsToStandardError()
delete o;
QCOMPARE(warnings.count(), 1);
- QCOMPARE(warnings.at(0), QLatin1String("<Unknown File>:1: Unable to assign [undefined] to int"));
+ QCOMPARE(warnings.at(0), QLatin1String("<Unknown File>:1: Unable to assign [undefined] to int a"));
warnings.clear();
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index 4befc4c..b07849d 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -676,12 +676,12 @@ void tst_qdeclarativetextedit::cursorDelegate()
//Test Delegate gets moved
for(int i=0; i<= textEditObject->text().length(); i++){
textEditObject->setCursorPosition(i);
- QCOMPARE(textEditObject->cursorRect().x(), qRound(delegateObject->x()));
- QCOMPARE(textEditObject->cursorRect().y(), qRound(delegateObject->y()));
+ QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x()));
+ QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y()));
}
textEditObject->setCursorPosition(0);
- QCOMPARE(textEditObject->cursorRect().x(), qRound(delegateObject->x()));
- QCOMPARE(textEditObject->cursorRect().y(), qRound(delegateObject->y()));
+ QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x()));
+ QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y()));
//Test Delegate gets deleted
textEditObject->setCursorDelegate(0);
QVERIFY(!textEditObject->findChild<QDeclarativeItem*>("cursorInstance"));
diff --git a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
index f105692..71dc451 100644
--- a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
+++ b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
@@ -81,11 +81,11 @@ QString tst_qmlvisual::viewer()
QString qmlruntime;
#if defined(Q_WS_MAC)
- qmlruntime = QDir(binaries).absoluteFilePath("qml.app/Contents/MacOS/qml");
+ qmlruntime = QDir(binaries).absoluteFilePath("QMLViewer.app/Contents/MacOS/QMLViewer");
#elif defined(Q_WS_WIN) || defined(Q_WS_S60)
- qmlruntime = QDir(binaries).absoluteFilePath("qml.exe");
+ qmlruntime = QDir(binaries).absoluteFilePath("qmlviewer.exe");
#else
- qmlruntime = QDir(binaries).absoluteFilePath("qml");
+ qmlruntime = QDir(binaries).absoluteFilePath("qmlviewer");
#endif
return qmlruntime;