summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel/qobject
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/kernel/qobject')
-rw-r--r--tests/auto/corelib/kernel/qobject/CMakeLists.txt29
-rw-r--r--tests/auto/corelib/kernel/qobject/signalbug/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp66
3 files changed, 49 insertions, 56 deletions
diff --git a/tests/auto/corelib/kernel/qobject/CMakeLists.txt b/tests/auto/corelib/kernel/qobject/CMakeLists.txt
new file mode 100644
index 0000000000..3be3287532
--- /dev/null
+++ b/tests/auto/corelib/kernel/qobject/CMakeLists.txt
@@ -0,0 +1,29 @@
+# Generated from qobject.pro.
+
+#####################################################################
+## tst_qobject Test:
+#####################################################################
+
+add_qt_test(tst_qobject
+ SOURCES
+ tst_qobject.cpp
+ DEFINES
+ QT_DISABLE_DEPRECATED_BEFORE=0
+ LIBRARIES
+ Qt::CorePrivate
+ PUBLIC_LIBRARIES
+ Qt::Network
+)
+
+#### Keys ignored in scope 3:.:.:test.pro:<TRUE>:
+# CONFIG = "testcase" "console"
+
+## Scopes:
+#####################################################################
+
+#### Keys ignored in scope 4:.:.:test.pro:QT_CONFIG___contains___c++1z:
+# CONFIG = "c++1z"
+
+if(NOT WINRT)
+ add_subdirectory(signalbug)
+endif()
diff --git a/tests/auto/corelib/kernel/qobject/signalbug/CMakeLists.txt b/tests/auto/corelib/kernel/qobject/signalbug/CMakeLists.txt
new file mode 100644
index 0000000000..e798028b1b
--- /dev/null
+++ b/tests/auto/corelib/kernel/qobject/signalbug/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from signalbug.pro.
+
+#####################################################################
+## signalbug_helper Binary:
+#####################################################################
+
+add_qt_test_helper(signalbug_helper
+ SOURCES
+ signalbug.cpp signalbug.h
+)
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 21615d6ec4..b1d3ea19d6 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -81,9 +81,6 @@ private slots:
void senderTest();
void declareInterface();
void qpointerResetBeforeDestroyedSignal();
-#ifndef QT_NO_USERDATA
- void testUserData();
-#endif
void childDeletesItsSibling();
void dynamicProperties();
void floatProperty();
@@ -463,7 +460,7 @@ void tst_QObject::connectSlotsByName()
sender.setObjectName("Sender");
QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: No matching signal for on_child_signal()");
- QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: Connecting slot on_Sender_signalManyParams() with the first of the following compatible signals: (\"signalManyParams(int,int,int,QString,bool)\", \"signalManyParams(int,int,int,QString,bool,bool)\")");
+ QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: Connecting slot on_Sender_signalManyParams() with the first of the following compatible signals: QVector(\"signalManyParams(int,int,int,QString,bool)\", \"signalManyParams(int,int,int,QString,bool,bool)\")");
QMetaObject::connectSlotsByName(&receiver);
receiver.called_slots.clear();
@@ -1917,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());
@@ -1928,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);
@@ -1998,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());
@@ -2009,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");
@@ -2031,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);
@@ -2341,51 +2341,6 @@ void tst_QObject::declareInterface()
}
-#ifndef QT_NO_USERDATA
-class CustomData : public QObjectUserData
-{
-public:
- int id;
-};
-
-void tst_QObject::testUserData()
-{
- const int USER_DATA_COUNT = 100;
- int user_data_ids[USER_DATA_COUNT];
-
- // Register a few
- for (int i=0; i<USER_DATA_COUNT; ++i) {
- user_data_ids[i] = QObject::registerUserData();
- }
-
- // Randomize the table a bit
- for (int i=0; i<100; ++i) {
- int p1 = QRandomGenerator::global()->bounded(USER_DATA_COUNT);
- int p2 = QRandomGenerator::global()->bounded(USER_DATA_COUNT);
-
- int tmp = user_data_ids[p1];
- user_data_ids[p1] = user_data_ids[p2];
- user_data_ids[p2] = tmp;
- }
-
- // insert the user data into an object
- QObject my_test_object;
- for (int i=0; i<USER_DATA_COUNT; ++i) {
- CustomData *data = new CustomData;
- data->id = user_data_ids[i];
- my_test_object.setUserData(data->id, data);
- }
-
- // verify that all ids and positions are matching
- for (int i=0; i<USER_DATA_COUNT; ++i) {
- int id = user_data_ids[i];
- CustomData *data = static_cast<CustomData *>(my_test_object.userData(id));
- QVERIFY(data != nullptr);
- QCOMPARE(data->id, id);
- }
-}
-#endif // QT_NO_USERDATA
-
class DestroyedListener : public QObject
{
Q_OBJECT
@@ -6974,8 +6929,7 @@ void tst_QObject::noDeclarativeParentChangedOnDestruction()
QObject *parent = new QObject;
QObject *child = new QObject;
- QAbstractDeclarativeDataImpl dummy;
- dummy.ownedByQml1 = false;
+ QAbstractDeclarativeData dummy;
QObjectPrivate::get(child)->declarativeData = &dummy;
parentChangeCalled = false;