aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/auto/quick/qquickstates/data/duplicateStateName.qml13
-rw-r--r--tests/auto/quick/qquickstates/tst_qquickstates.cpp12
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickstates/data/duplicateStateName.qml b/tests/auto/quick/qquickstates/data/duplicateStateName.qml
new file mode 100644
index 0000000000..7bfafbef1b
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/duplicateStateName.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Rectangle {
+ property bool condition1: false
+ property bool condition2: false
+ property bool condition3: false
+
+ states: [
+ State { name: "state1"; when: condition1 },
+ State { name: "state2"; when: condition2 },
+ State { name: "state1"; when: condition3 }
+ ]
+}
diff --git a/tests/auto/quick/qquickstates/tst_qquickstates.cpp b/tests/auto/quick/qquickstates/tst_qquickstates.cpp
index 073fe33e20..50554f6333 100644
--- a/tests/auto/quick/qquickstates/tst_qquickstates.cpp
+++ b/tests/auto/quick/qquickstates/tst_qquickstates.cpp
@@ -137,6 +137,7 @@ private slots:
void revertListBug();
void QTBUG_38492();
void revertListMemoryLeak();
+ void duplicateStateName();
};
void tst_qquickstates::initTestCase()
@@ -1654,6 +1655,17 @@ void tst_qquickstates::revertListMemoryLeak()
QVERIFY(bindingPtr->ref == 1);
}
+void tst_qquickstates::duplicateStateName()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("duplicateStateName.qml"));
+ QTest::ignoreMessage(QtWarningMsg, fullDataPath("duplicateStateName.qml") + ":3:1: QML Rectangle: Found duplicate state name: state1");
+ QScopedPointer<QQuickItem> item(qobject_cast<QQuickItem *>(c.create()));
+ QVERIFY(!item.isNull());
+}
+
+
QTEST_MAIN(tst_qquickstates)
#include "tst_qquickstates.moc"