aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-05-01 12:44:51 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-05-01 12:44:51 +0200
commitb78372c4ba31da2d941d70ba23a927deae7d830c (patch)
tree25d9eeefbbb4c6ace084c56e58ac7bd1927217b5 /tests
parent9990c0f577f6a6a67ccebffb56ad1afc7a98ed1d (diff)
parent7ea1f75fd877f312d70a90ab0405f3ca03914171 (diff)
Merge remote-tracking branch 'origin/release' into stable
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp16
-rw-r--r--tests/auto/qml/qqmllanguage/data/nonexistantProperty.7.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/nonexistantProperty.7.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp1
-rw-r--r--tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp50
-rw-r--r--tests/auto/qmldevtools/compile/tst_compile.cpp4
-rw-r--r--tests/auto/quick/qquickitem/tst_qquickitem.cpp2
-rw-r--r--tests/auto/quick/qquickstates/data/QTBUG-38492.qml16
-rw-r--r--tests/auto/quick/qquickstates/tst_qquickstates.cpp16
9 files changed, 109 insertions, 1 deletions
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index 64c6754aa7..b2723b02fd 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -153,6 +153,7 @@ private slots:
void indexedAccesses();
void prototypeChainGc();
+ void prototypeChainGc_QTBUG38299();
void dynamicProperties();
@@ -2963,6 +2964,21 @@ void tst_QJSEngine::prototypeChainGc()
QVERIFY(proto.isObject());
}
+void tst_QJSEngine::prototypeChainGc_QTBUG38299()
+{
+ QJSEngine engine;
+ engine.evaluate("var mapping = {"
+ "'prop1': \"val1\",\n"
+ "'prop2': \"val2\"\n"
+ "}\n"
+ "\n"
+ "delete mapping.prop2\n"
+ "delete mapping.prop1\n"
+ "\n");
+ // Don't hang!
+ engine.collectGarbage();
+}
+
void tst_QJSEngine::dynamicProperties()
{
{
diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.7.errors.txt b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.7.errors.txt
new file mode 100644
index 0000000000..d62dbd703d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.7.errors.txt
@@ -0,0 +1 @@
+3:5:Cannot assign to non-existent property "nonExistantGrouped"
diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.7.qml b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.7.qml
new file mode 100644
index 0000000000..3b66a5f6c7
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.7.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ nonExistantGrouped.blah: MyQmlObject {}
+}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 87f811cbbc..3561635351 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -345,6 +345,7 @@ void tst_qqmllanguage::errors_data()
QTest::newRow("nonexistantProperty.4") << "nonexistantProperty.4.qml" << "nonexistantProperty.4.errors.txt" << false;
QTest::newRow("nonexistantProperty.5") << "nonexistantProperty.5.qml" << "nonexistantProperty.5.errors.txt" << false;
QTest::newRow("nonexistantProperty.6") << "nonexistantProperty.6.qml" << "nonexistantProperty.6.errors.txt" << false;
+ QTest::newRow("nonexistantProperty.7") << "nonexistantProperty.7.qml" << "nonexistantProperty.7.errors.txt" << false;
QTest::newRow("wrongType (string for int)") << "wrongType.1.qml" << "wrongType.1.errors.txt" << false;
QTest::newRow("wrongType (int for bool)") << "wrongType.2.qml" << "wrongType.2.errors.txt" << false;
diff --git a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp
index 678849c371..9b57eeffa9 100644
--- a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp
+++ b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp
@@ -101,6 +101,8 @@ private slots:
void static_types_data();
void static_i18n();
void static_i18n_data();
+ void dynamic_i18n();
+ void dynamic_i18n_data();
void static_nestedElements();
void static_nestedElements_data();
void dynamic_data();
@@ -341,6 +343,54 @@ void tst_qqmllistmodel::static_i18n()
delete obj;
}
+void tst_qqmllistmodel::dynamic_i18n_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QVariant>("value");
+ QTest::addColumn<QString>("error");
+
+ QTest::newRow("qsTr")
+ << QString::fromUtf8("ListElement { foo: qsTr(\"test\") }")
+ << QVariant(QString::fromUtf8("test"))
+ << QString("ListElement: cannot use script for property value");
+
+ QTest::newRow("qsTrId")
+ << "ListElement { foo: qsTrId(\"qtn_test\") }"
+ << QVariant(QString("qtn_test"))
+ << QString("ListElement: cannot use script for property value");
+}
+
+void tst_qqmllistmodel::dynamic_i18n()
+{
+ QFETCH(QString, qml);
+ QFETCH(QVariant, value);
+ QFETCH(QString, error);
+
+ qml = "import QtQuick 2.0\nItem { property variant test: model.get(0).foo; ListModel { id: model; " + qml + " } }";
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(qml.toUtf8(),
+ QUrl::fromLocalFile(QString("dummy.qml")));
+
+ if (!error.isEmpty()) {
+ QVERIFY(component.isError());
+ QCOMPARE(component.errors().at(0).description(), error);
+ return;
+ }
+
+ QVERIFY(!component.isError());
+
+ QObject *obj = component.create();
+ QVERIFY(obj != 0);
+
+ QVariant actual = obj->property("test");
+
+ QCOMPARE(actual, value);
+ QCOMPARE(actual.toString(), value.toString());
+
+ delete obj;
+}
void tst_qqmllistmodel::static_nestedElements()
{
QFETCH(int, elementCount);
diff --git a/tests/auto/qmldevtools/compile/tst_compile.cpp b/tests/auto/qmldevtools/compile/tst_compile.cpp
index 6b13d1b4bb..31b5c02250 100644
--- a/tests/auto/qmldevtools/compile/tst_compile.cpp
+++ b/tests/auto/qmldevtools/compile/tst_compile.cpp
@@ -44,6 +44,10 @@
#include <private/qqmljsparser_p.h>
#include <private/qqmljsastvisitor_p.h>
#include <private/qqmljsast_p.h>
+#include <private/qqmlirbuilder_p.h>
+#include <private/qv4value_inl_p.h>
+#include <private/qv4codegen_p.h>
+#include <private/qqmldirparser_p.h>
int main()
{
diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
index 6f11986e20..2db510a69e 100644
--- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
@@ -1190,7 +1190,7 @@ static inline QByteArray msgItem(const QQuickItem *item)
void tst_qquickitem::mouseGrab()
{
#ifdef Q_OS_WIN
- if (QOpenGLContext::openGLModuleType() == QOpenGLContext::GLES2)
+ if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES)
QSKIP("Fails in the CI for ANGLE builds on Windows, QTBUG-32664");
#endif
QQuickWindow window;
diff --git a/tests/auto/quick/qquickstates/data/QTBUG-38492.qml b/tests/auto/quick/qquickstates/data/QTBUG-38492.qml
new file mode 100644
index 0000000000..d6d6d81fd3
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/QTBUG-38492.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property string text;
+
+ states: [
+ State {
+ name: 'apply'
+ PropertyChanges {
+ target: root
+ text: qsTr("Test")
+ }
+ }
+ ]
+}
diff --git a/tests/auto/quick/qquickstates/tst_qquickstates.cpp b/tests/auto/quick/qquickstates/tst_qquickstates.cpp
index 0c9b75636f..6b46ab1fae 100644
--- a/tests/auto/quick/qquickstates/tst_qquickstates.cpp
+++ b/tests/auto/quick/qquickstates/tst_qquickstates.cpp
@@ -148,6 +148,7 @@ private slots:
void QTBUG_14830();
void avoidFastForward();
void revertListBug();
+ void QTBUG_38492();
};
void tst_qquickstates::initTestCase()
@@ -1626,6 +1627,21 @@ void tst_qquickstates::revertListBug()
QCOMPARE(rect2->parentItem(), origParent2); //QTBUG-22583 causes rect2's parent item to be origParent1
}
+void tst_qquickstates::QTBUG_38492()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("QTBUG-38492.qml"));
+ QQuickItem *item = qobject_cast<QQuickItem*>(rectComponent.create());
+ QVERIFY(item != 0);
+
+ QQuickItemPrivate::get(item)->setState("apply");
+
+ QCOMPARE(item->property("text").toString(), QString("Test"));
+
+ delete item;
+}
+
QTEST_MAIN(tst_qquickstates)
#include "tst_qquickstates.moc"