diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2019-12-05 16:14:14 +0100 |
---|---|---|
committer | Olivier Goffart <ogoffart@woboq.com> | 2020-02-25 15:43:15 +0100 |
commit | 46f407126ef3e94d59254012cdc34d6a4ad2faf2 (patch) | |
tree | 56444e40c2342e69d4aac99d0c44b207d8516c93 /tests/auto/corelib/kernel/qobject | |
parent | a68e4f3b96a82a93898f381e8ddc7f50f9c89d40 (diff) |
MetaObject: store the QMetaType of the properties
Change-Id: I563e7232b70e94de4184f2c23a581319313dcf5c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/kernel/qobject')
-rw-r--r-- | tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 5ce70f7a0e..b1d3ea19d6 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -1914,7 +1914,7 @@ void tst_QObject::property() property = mo->property(mo->indexOfProperty("alpha")); QVERIFY(property.isEnumType()); QCOMPARE(property.typeName(), "Alpha"); - QCOMPARE(property.type(), QVariant::Int); + QCOMPARE(property.userType(), QMetaType::fromType<PropertyObject::Alpha>().id()); QVariant var = object.property("alpha"); QVERIFY(!var.isNull()); @@ -1925,7 +1925,8 @@ void tst_QObject::property() QCOMPARE(object.property("alpha").toInt(), int(PropertyObject::Alpha2)); QVERIFY(object.setProperty("alpha", "Alpha1")); QCOMPARE(object.property("alpha").toInt(), int(PropertyObject::Alpha1)); - QVERIFY(!object.setProperty("alpha", QVariant())); + QVERIFY(object.setProperty("alpha", QVariant())); + QCOMPARE(object.property("alpha").toInt(), 0); QVERIFY(mo->indexOfProperty("number") != -1); QCOMPARE(object.property("number").toInt(), 0); @@ -1995,7 +1996,7 @@ void tst_QObject::property() property = mo->property(mo->indexOfProperty("priority")); QVERIFY(property.isEnumType()); QCOMPARE(property.typeName(), "Priority"); - QCOMPARE(property.type(), QVariant::Int); + QCOMPARE(property.userType(), QMetaType::fromType<PropertyObject::Priority>().id()); var = object.property("priority"); QVERIFY(!var.isNull()); @@ -2006,7 +2007,8 @@ void tst_QObject::property() QCOMPARE(object.property("priority").toInt(), int(PropertyObject::VeryHigh)); QVERIFY(object.setProperty("priority", "High")); QCOMPARE(object.property("priority").toInt(), int(PropertyObject::High)); - QVERIFY(!object.setProperty("priority", QVariant())); + QVERIFY(object.setProperty("priority", QVariant())); + QCOMPARE(object.property("priority").toInt(), 0); // now it's registered, so it works as expected int priorityMetaTypeId = qRegisterMetaType<PropertyObject::Priority>("PropertyObject::Priority"); @@ -2028,7 +2030,8 @@ void tst_QObject::property() QCOMPARE(qvariant_cast<PropertyObject::Priority>(object.property("priority")), PropertyObject::VeryHigh); QVERIFY(object.setProperty("priority", "High")); QCOMPARE(qvariant_cast<PropertyObject::Priority>(object.property("priority")), PropertyObject::High); - QVERIFY(!object.setProperty("priority", QVariant())); + QVERIFY(object.setProperty("priority", QVariant())); + QCOMPARE(object.property("priority").toInt(), 0); var = object.property("priority"); QCOMPARE(qvariant_cast<PropertyObject::Priority>(var), PropertyObject::High); |