summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/objectName.qml8
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp19
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/objectName.qml b/tests/auto/declarative/qdeclarativeecmascript/data/objectName.qml
new file mode 100644
index 0000000..ca8c90d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/objectName.qml
@@ -0,0 +1,8 @@
+import QtQuick 1.0
+
+QtObject {
+ objectName: "hello"
+
+ property string test1: objectName
+ property string test2: objectName.substr(1, 3)
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 4feb630..02832f3 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -162,6 +162,7 @@ private slots:
void deleteLater();
void in();
void sharedAttachedObject();
+ void objectName();
void include();
@@ -2594,6 +2595,24 @@ void tst_qdeclarativeecmascript::sharedAttachedObject()
delete o;
}
+// QTBUG-13999
+void tst_qdeclarativeecmascript::objectName()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("objectName.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toString(), QString("hello"));
+ QCOMPARE(o->property("test2").toString(), QString("ell"));
+
+ o->setObjectName("world");
+
+ QCOMPARE(o->property("test1").toString(), QString("world"));
+ QCOMPARE(o->property("test2").toString(), QString("orl"));
+
+ delete o;
+}
+
QTEST_MAIN(tst_qdeclarativeecmascript)
#include "tst_qdeclarativeecmascript.moc"