diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-06-25 06:38:23 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-06-25 06:38:23 (GMT) |
commit | 1d986e7f4c34fdcda2c1486a271a387ec08d3c46 (patch) | |
tree | e47bfd90213ecaaeb88e02650676c5186d61450d /tests | |
parent | 03df7f73de6a1fd482876caaf377a61593df8a38 (diff) | |
parent | 46233eaa956e57a4c948cec759a3be606a8bdcb8 (diff) | |
download | Qt-1d986e7f4c34fdcda2c1486a271a387ec08d3c46.zip Qt-1d986e7f4c34fdcda2c1486a271a387ec08d3c46.tar.gz Qt-1d986e7f4c34fdcda2c1486a271a387ec08d3c46.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests')
13 files changed, 72 insertions, 7 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.js b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.js new file mode 100644 index 0000000..092bc2b --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.js @@ -0,0 +1 @@ +; diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.qml new file mode 100644 index 0000000..56e7885 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.qml @@ -0,0 +1,8 @@ +import Qt 4.7 +import "qtbug_11600.js" as Test + +QtObject { + id: goo + + property bool test: undefined == goo.Test.foo +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11606.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11606.qml new file mode 100644 index 0000000..6efb9c1 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11606.qml @@ -0,0 +1,12 @@ +import Qt 4.7 + +QtObject { + property bool test: false + Component.onCompleted: { + try { + console.log(sorryNoSuchProperty); + } catch (e) { + test = true; + } + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml index 4395ba3..2548005 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml @@ -1,10 +1,10 @@ import Qt 4.7 +import Qt.test 1.0 -Item { +MyQmlObject { id: root property int foo: 12 - property int console: 11 property bool test1: foo == 12 property bool test2: console != 11 diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index 7bb8a8e..849879e 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -86,6 +86,7 @@ class MyQmlObject : public QObject Q_PROPERTY(bool trueProperty READ trueProperty CONSTANT) Q_PROPERTY(bool falseProperty READ falseProperty CONSTANT) Q_PROPERTY(int value READ value WRITE setValue) + Q_PROPERTY(int console READ console CONSTANT) Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty NOTIFY stringChanged) Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty NOTIFY objectChanged) Q_PROPERTY(QDeclarativeListProperty<QObject> objectListProperty READ objectListProperty CONSTANT) @@ -142,6 +143,7 @@ public: QRegExp regExp() { return m_regExp; } void setRegExp(const QRegExp ®Exp) { m_regExp = regExp; } + int console() const { return 11; } signals: void basicSignal(); void argumentSignal(int a, QString b, qreal c); @@ -555,7 +557,9 @@ Q_DECLARE_METATYPE(QScriptValue); class MyInvokableObject : public QObject { Q_OBJECT + Q_ENUMS(TestEnum) public: + enum TestEnum { EnumValue1, EnumValue2 }; MyInvokableObject() { reset(); } int invoked() const { return m_invoked; } @@ -587,6 +591,8 @@ public: Q_INVOKABLE void method_overload(int a) { invoke(16); m_actuals << a; } Q_INVOKABLE void method_overload(int a, int b) { invoke(17); m_actuals << a << b; } + Q_INVOKABLE void method_with_enum(TestEnum e) { invoke(18); m_actuals << (int)e; } + private: void invoke(int idx) { if (m_invoked != -1) m_invokedError = true; m_invoked = idx;} int m_invoked; diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 50da55d..43900ae 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -155,6 +155,8 @@ private slots: void eval(); void function(); void qtbug_10696(); + void qtbug_11606(); + void qtbug_11600(); void include(); @@ -1719,6 +1721,13 @@ void tst_qdeclarativeecmascript::callQtInvokables() QCOMPARE(o.actuals().count(), 2); QCOMPARE(o.actuals().at(0), QVariant(10)); QCOMPARE(o.actuals().at(1), QVariant(11)); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_with_enum(9)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 18); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(9)); } // QTBUG-5675 @@ -2503,6 +2512,25 @@ void tst_qdeclarativeecmascript::qtbug_10696() delete o; } +void tst_qdeclarativeecmascript::qtbug_11606() +{ + QDeclarativeComponent component(&engine, TEST_FILE("qtbug_11606.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + QCOMPARE(o->property("test").toBool(), true); + delete o; +} + +void tst_qdeclarativeecmascript::qtbug_11600() +{ + QDeclarativeComponent component(&engine, TEST_FILE("qtbug_11600.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + QCOMPARE(o->property("test").toBool(), true); + delete o; +} + + QTEST_MAIN(tst_qdeclarativeecmascript) #include "tst_qdeclarativeecmascript.moc" diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidProperty.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidProperty.errors.txt new file mode 100644 index 0000000..c83e5ae --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidProperty.errors.txt @@ -0,0 +1 @@ +4:5:Illegal property name diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidProperty.qml new file mode 100644 index 0000000..6077de4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidProperty.qml @@ -0,0 +1,5 @@ +import Qt 4.7 + +QtObject { + property int parseInt +} diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 413843a..3ce356e 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -370,6 +370,7 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("destroyedSignal") << "destroyedSignal.qml" << "destroyedSignal.errors.txt" << false; QTest::newRow("assignToNamespace") << "assignToNamespace.qml" << "assignToNamespace.errors.txt" << false; QTest::newRow("invalidOn") << "invalidOn.qml" << "invalidOn.errors.txt" << false; + QTest::newRow("invalidProperty") << "invalidProperty.qml" << "invalidProperty.errors.txt" << false; } diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js index c165e29..30499e9 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js +++ b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js @@ -5,3 +5,7 @@ function loadComponent() { return component.status; } +function createComponent() { + var component = Qt.createComponent("createComponentData.qml"); + return component.createObject(null); +} diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml index aae7a91..33203c7 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml @@ -3,8 +3,10 @@ import "createComponent_lib.js" as Test Item { property int status: Component.Null + property int readValue: 0 Component.onCompleted: { status = Test.loadComponent() + readValue = Test.createComponent().test; } } diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp index fb100a5..895ee6c 100644 --- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp +++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp @@ -365,14 +365,12 @@ void tst_qdeclarativeqt::createComponent() void tst_qdeclarativeqt::createComponent_pragmaLibrary() { // Currently, just loading createComponent_lib.qml causes crash on some platforms - /* QDeclarativeComponent component(&engine, TEST_FILE("createComponent_lib.qml")); QObject *object = component.create(); QVERIFY(object != 0); - - QEXPECT_FAIL("", "QTBUG-11507", Continue); QCOMPARE(object->property("status").toInt(), int(QDeclarativeComponent::Ready)); - */ + QCOMPARE(object->property("readValue").toInt(), int(1913)); + delete object; } void tst_qdeclarativeqt::createQmlObject() diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index 2913ddd..639b2f3 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -263,7 +263,6 @@ void tst_qdeclarativestates::attachedPropertyChanges() MyAttached *att = qobject_cast<MyAttached*>(attObj); QVERIFY(att); - QEXPECT_FAIL("", "QTBUG-11283", Abort); QCOMPARE(att->foo(), 1); } |