From 1a65a4faf52f83ba3fbbba88cea1c4bb800e8de7 Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Mon, 14 Dec 2020 12:27:53 +0100 Subject: QObject: port to new property system Extended QObjectPrivate::ExtraData to store a pointer to its parent, and reimplemented qGetBindingStorage() function for QObjectPrivate::ExtraData. This allows to use Q_OBJECT_COMPAT_PROPERTY macro for a property, stored in QObjectPrivate::ExtraData and solves all the problems with calling a custom setter. Task-number: QTBUG-85520 Change-Id: I40e01c29430846359ef9160fa1ae97c702be9a18 Reviewed-by: Edward Welbourne Reviewed-by: Sona Kurazyan --- tests/auto/corelib/kernel/qobject/CMakeLists.txt | 3 ++- tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 11 ++++++++++- tests/auto/other/toolsupport/tst_toolsupport.cpp | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/kernel/qobject/CMakeLists.txt b/tests/auto/corelib/kernel/qobject/CMakeLists.txt index 7ff42f7212..a231ef985f 100644 --- a/tests/auto/corelib/kernel/qobject/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qobject/CMakeLists.txt @@ -9,9 +9,10 @@ qt_internal_add_test(tst_qobject tst_qobject.cpp DEFINES QT_DISABLE_DEPRECATED_BEFORE=0 - PUBLIC_LIBRARIES + LIBRARIES Qt::CorePrivate Qt::Network + Qt::TestPrivate ) ## Scopes: diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index f36a40e5df..f5c16faa56 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Copyright (C) 2015 Olivier Goffart ** Contact: https://www.qt.io/licensing/ ** @@ -28,6 +28,7 @@ ****************************************************************************/ #include +#include #include #include #include @@ -161,6 +162,7 @@ private slots: void functorReferencesConnection(); void disconnectDisconnects(); void singleShotConnection(); + void objectNameBinding(); }; struct QObjectCreatedOnShutdown @@ -8115,6 +8117,13 @@ void tst_QObject::singleShotConnection() } } +void tst_QObject::objectNameBinding() +{ + QObject obj; + QTestPrivate::testReadWritePropertyBasics(obj, "test1", "test2", + "objectName"); +} + // Test for QtPrivate::HasQ_OBJECT_Macro static_assert(QtPrivate::HasQ_OBJECT_Macro::Value); static_assert(!QtPrivate::HasQ_OBJECT_Macro::Value); diff --git a/tests/auto/other/toolsupport/tst_toolsupport.cpp b/tests/auto/other/toolsupport/tst_toolsupport.cpp index 2e46f022e7..7ba4286a4d 100644 --- a/tests/auto/other/toolsupport/tst_toolsupport.cpp +++ b/tests/auto/other/toolsupport/tst_toolsupport.cpp @@ -109,7 +109,7 @@ void tst_toolsupport::offsets_data() QTestData &data = QTest::newRow("sizeof(QObjectPrivate::ExtraData)") << sizeof(QObjectPrivate::ExtraData); // Please heed the comment at the top of this file when changing this line: - data << 60 << 120; // 4 * QList + 1 * QString + data << 64 << 128; // 4 * QList + 1 * QString + ptr } #if RUN_MEMBER_OFFSET_TEST -- cgit v1.2.3