summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-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
-rw-r--r--tests/auto/headers/tst_headers.cpp14
-rw-r--r--tests/benchmarks/declarative/binding/testtypes.h10
-rw-r--r--tests/benchmarks/declarative/creation/tst_creation.cpp4
-rw-r--r--tests/benchmarks/declarative/qdeclarativecomponent/testtypes.h10
-rw-r--r--tests/benchmarks/declarative/qmltime/qmltime.cpp2
13 files changed, 101 insertions, 29 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;
diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp
index 12c5843..0538607 100644
--- a/tests/auto/headers/tst_headers.cpp
+++ b/tests/auto/headers/tst_headers.cpp
@@ -64,7 +64,8 @@ private:
const QStringList dirFilters,
const QRegExp &exclude);
static QStringList getHeaders(const QString &path);
- static QStringList getSourceFiles(const QString &path);
+ static QStringList getQmlFiles(const QString &path);
+ static QStringList getCppFiles(const QString &path);
static QStringList getQDocFiles(const QString &path);
void allSourceFilesData();
@@ -107,11 +108,16 @@ QStringList tst_Headers::getHeaders(const QString &path)
return getFiles(path, QStringList("*.h"), QRegExp("^(?!ui_)"));
}
-QStringList tst_Headers::getSourceFiles(const QString &path)
+QStringList tst_Headers::getCppFiles(const QString &path)
{
return getFiles(path, QStringList("*.cpp"), QRegExp("^(?!(moc_|qrc_))"));
}
+QStringList tst_Headers::getQmlFiles(const QString &path)
+{
+ return getFiles(path, QStringList("*.qml"), QRegExp("."));
+}
+
QStringList tst_Headers::getQDocFiles(const QString &path)
{
return getFiles(path, QStringList("*.qdoc"), QRegExp("."));
@@ -153,7 +159,9 @@ void tst_Headers::allSourceFilesData()
};
for (int i = 0; i < sizeof(subdirs) / sizeof(subdirs[0]); ++i) {
- sourceFiles << getSourceFiles(qtSrcDir + subdirs[i]);
+ sourceFiles << getCppFiles(qtSrcDir + subdirs[i]);
+ if (subdirs[i] != QLatin1String("/tests"))
+ sourceFiles << getQmlFiles(qtSrcDir + subdirs[i]);
sourceFiles << getHeaders(qtSrcDir + subdirs[i]);
sourceFiles << getQDocFiles(qtSrcDir + subdirs[i]);
}
diff --git a/tests/benchmarks/declarative/binding/testtypes.h b/tests/benchmarks/declarative/binding/testtypes.h
index 523f94d..0cbaa42 100644
--- a/tests/benchmarks/declarative/binding/testtypes.h
+++ b/tests/benchmarks/declarative/binding/testtypes.h
@@ -47,11 +47,11 @@
class MyQmlObject : public QObject
{
Q_OBJECT
- Q_PROPERTY(int result READ result WRITE setResult);
- Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged);
- Q_PROPERTY(MyQmlObject *object READ object WRITE setObject NOTIFY objectChanged);
- Q_PROPERTY(QDeclarativeListProperty<QObject> data READ data);
- Q_CLASSINFO("DefaultProperty", "data");
+ Q_PROPERTY(int result READ result WRITE setResult)
+ Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged)
+ Q_PROPERTY(MyQmlObject *object READ object WRITE setObject NOTIFY objectChanged)
+ Q_PROPERTY(QDeclarativeListProperty<QObject> data READ data)
+ Q_CLASSINFO("DefaultProperty", "data")
public:
MyQmlObject() : m_result(0), m_value(0), m_object(0) {}
diff --git a/tests/benchmarks/declarative/creation/tst_creation.cpp b/tests/benchmarks/declarative/creation/tst_creation.cpp
index 83f66de..94a67fd 100644
--- a/tests/benchmarks/declarative/creation/tst_creation.cpp
+++ b/tests/benchmarks/declarative/creation/tst_creation.cpp
@@ -91,8 +91,8 @@ private:
class TestType : public QObject
{
Q_OBJECT
-Q_PROPERTY(QDeclarativeListProperty<QObject> resources READ resources);
-Q_CLASSINFO("DefaultProperty", "resources");
+Q_PROPERTY(QDeclarativeListProperty<QObject> resources READ resources)
+Q_CLASSINFO("DefaultProperty", "resources")
public:
TestType(QObject *parent = 0)
: QObject(parent) {}
diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.h b/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.h
index 523f94d..0cbaa42 100644
--- a/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.h
+++ b/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.h
@@ -47,11 +47,11 @@
class MyQmlObject : public QObject
{
Q_OBJECT
- Q_PROPERTY(int result READ result WRITE setResult);
- Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged);
- Q_PROPERTY(MyQmlObject *object READ object WRITE setObject NOTIFY objectChanged);
- Q_PROPERTY(QDeclarativeListProperty<QObject> data READ data);
- Q_CLASSINFO("DefaultProperty", "data");
+ Q_PROPERTY(int result READ result WRITE setResult)
+ Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged)
+ Q_PROPERTY(MyQmlObject *object READ object WRITE setObject NOTIFY objectChanged)
+ Q_PROPERTY(QDeclarativeListProperty<QObject> data READ data)
+ Q_CLASSINFO("DefaultProperty", "data")
public:
MyQmlObject() : m_result(0), m_value(0), m_object(0) {}
diff --git a/tests/benchmarks/declarative/qmltime/qmltime.cpp b/tests/benchmarks/declarative/qmltime/qmltime.cpp
index 3932e01..e1b73ca 100644
--- a/tests/benchmarks/declarative/qmltime/qmltime.cpp
+++ b/tests/benchmarks/declarative/qmltime/qmltime.cpp
@@ -50,7 +50,7 @@
class Timer : public QObject
{
Q_OBJECT
- Q_PROPERTY(QDeclarativeComponent *component READ component WRITE setComponent);
+ Q_PROPERTY(QDeclarativeComponent *component READ component WRITE setComponent)
public:
Timer();