diff options
Diffstat (limited to 'tests/auto/qml/qqmlitemmodels')
6 files changed, 18 insertions, 5 deletions
diff --git a/tests/auto/qml/qqmlitemmodels/CMakeLists.txt b/tests/auto/qml/qqmlitemmodels/CMakeLists.txt index 632e98206b..80f210f668 100644 --- a/tests/auto/qml/qqmlitemmodels/CMakeLists.txt +++ b/tests/auto/qml/qqmlitemmodels/CMakeLists.txt @@ -7,6 +7,12 @@ ## tst_qqmlitemmodels Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qqmlitemmodels LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + # Collect test data file(GLOB_RECURSE test_data_glob RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/tests/auto/qml/qqmlitemmodels/data/modelindex.qml b/tests/auto/qml/qqmlitemmodels/data/modelindex.qml index 2756f04120..7bf8bfb5a2 100644 --- a/tests/auto/qml/qqmlitemmodels/data/modelindex.qml +++ b/tests/auto/qml/qqmlitemmodels/data/modelindex.qml @@ -8,6 +8,7 @@ ItemModelsTest { property var parent: modelIndex.parent property var model: modelIndex.model property var internalId: modelIndex.internalId + property var displayData: modelIndex.data(Qt.DisplayRole) onSignalWithModelIndex: { isValid = index.valid @@ -16,5 +17,6 @@ ItemModelsTest { parent = index.parent model = index.model internalId = index.internalId + displayData = index.data(Qt.DisplayRole) } } diff --git a/tests/auto/qml/qqmlitemmodels/data/persistentmodelindex.qml b/tests/auto/qml/qqmlitemmodels/data/persistentmodelindex.qml index 85987bdcac..aa43252100 100644 --- a/tests/auto/qml/qqmlitemmodels/data/persistentmodelindex.qml +++ b/tests/auto/qml/qqmlitemmodels/data/persistentmodelindex.qml @@ -8,6 +8,7 @@ ItemModelsTest { property var parent: persistentModelIndex.parent property var model: persistentModelIndex.model property var internalId: persistentModelIndex.internalId + property var displayData: persistentModelIndex.data(Qt.DisplayRole) property var pmi @@ -18,6 +19,7 @@ ItemModelsTest { parent = index.parent model = index.model internalId = index.internalId + displayData = index.data(Qt.DisplayRole) pmi = createPersistentModelIndex(model.index(0, 0)) } diff --git a/tests/auto/qml/qqmlitemmodels/qtestmodel.h b/tests/auto/qml/qqmlitemmodels/qtestmodel.h index 6cbec533b1..6c442b06b7 100644 --- a/tests/auto/qml/qqmlitemmodels/qtestmodel.h +++ b/tests/auto/qml/qqmlitemmodels/qtestmodel.h @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef Q_TEST_MODEL_H #define Q_TEST_MODEL_H @@ -251,6 +251,8 @@ public: mutable bool wrongIndex; struct Node { + Q_DISABLE_COPY_MOVE(Node) + Node *parent; QVector<Node *> children; @@ -261,8 +263,7 @@ public: ~Node() { - foreach (Node *n, children) - delete n; + qDeleteAll(children); } void addRows(int row, int count) diff --git a/tests/auto/qml/qqmlitemmodels/testtypes.h b/tests/auto/qml/qqmlitemmodels/testtypes.h index 57ac9c12d1..3bbd566cd1 100644 --- a/tests/auto/qml/qqmlitemmodels/testtypes.h +++ b/tests/auto/qml/qqmlitemmodels/testtypes.h @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef TESTTYPES_H #define TESTTYPES_H diff --git a/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp b/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp index 339a61f996..1182759519 100644 --- a/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp +++ b/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <qtest.h> #include <QQmlEngine> @@ -55,6 +55,7 @@ void tst_qqmlitemmodels::modelIndex() QCOMPARE(object->property("parent").toModelIndex(), index.parent()); QCOMPARE(object->property("model").value<QAbstractItemModel *>(), index.model()); QCOMPARE(object->property("internalId").toULongLong(), index.internalId()); + QCOMPARE(object->property("displayData"), index.data(Qt::DisplayRole)); if (i < 3) { index = model.index(2 + i, 4 - i, index); @@ -79,6 +80,7 @@ void tst_qqmlitemmodels::persistentModelIndex() QCOMPARE(object->property("parent").toModelIndex(), index.parent()); QCOMPARE(object->property("model").value<QAbstractItemModel *>(), index.model()); QCOMPARE(object->property("internalId").toULongLong(), index.internalId()); + QCOMPARE(object->property("displayData"), index.data(Qt::DisplayRole)); if (i < 2) { index = model.index(2 + i, 4 - i, index); |