summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-02-23 08:34:41 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-02-23 08:35:43 (GMT)
commit48161233af2a6071bc0ba99e546da98f705b8281 (patch)
treea3d72a9ef84e2394937263299c39483e6307669a /tests
parent9701facad44f8e435f0efe6417ffb7d17d5712e7 (diff)
downloadQt-48161233af2a6071bc0ba99e546da98f705b8281.zip
Qt-48161233af2a6071bc0ba99e546da98f705b8281.tar.gz
Qt-48161233af2a6071bc0ba99e546da98f705b8281.tar.bz2
String to enum conversion in value types
Assigning a string to a value type enum property from a binding was not working as QmlMetaProperty didn't realise the property was of enum type.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qmlvaluetypes/data/enums.1.qml6
-rw-r--r--tests/auto/declarative/qmlvaluetypes/data/enums.2.qml6
-rw-r--r--tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp21
3 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlvaluetypes/data/enums.1.qml b/tests/auto/declarative/qmlvaluetypes/data/enums.1.qml
new file mode 100644
index 0000000..0eadd50
--- /dev/null
+++ b/tests/auto/declarative/qmlvaluetypes/data/enums.1.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ font.capitalization: "MixedCase"
+}
+
diff --git a/tests/auto/declarative/qmlvaluetypes/data/enums.2.qml b/tests/auto/declarative/qmlvaluetypes/data/enums.2.qml
new file mode 100644
index 0000000..81f1c92
--- /dev/null
+++ b/tests/auto/declarative/qmlvaluetypes/data/enums.2.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ font.capitalization: if (1) "MixedCase"
+}
+
diff --git a/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp b/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp
index f99d3ce..4faa0bc 100644
--- a/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp
+++ b/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp
@@ -74,6 +74,7 @@ private slots:
void bindingVariantCopy();
void scriptVariantCopy();
void cppClasses();
+ void enums();
private:
QmlEngine engine;
@@ -583,6 +584,26 @@ void tst_qmlvaluetypes::cppClasses()
CPP_TEST(QmlFontValueType, QFont("Helvetica"));
}
+
+void tst_qmlvaluetypes::enums()
+{
+ {
+ QmlComponent component(&engine, TEST_FILE("enums.1.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->font().capitalization() == QFont::MixedCase);
+ delete object;
+ }
+
+ {
+ QmlComponent component(&engine, TEST_FILE("enums.2.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->font().capitalization() == QFont::MixedCase);
+ delete object;
+ }
+}
+
QTEST_MAIN(tst_qmlvaluetypes)
#include "tst_qmlvaluetypes.moc"