From 21c839636c0ca19d366c0b3a0adaefe1eb48a690 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 28 Oct 2024 19:14:54 +0100 Subject: [PATCH] tst_QList: compile in both strict and normal iterator modes If a class has an opt-in, the test should test both. Pick-to: 6.5 6.2 Change-Id: I3b200a2f8e96c62b0c38ae735cb9f7e6786375b3 Reviewed-by: Thiago Macieira (cherry picked from commit c198a67bfb3fea21ec06f72ea08107c4da6e88f7) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/corelib/tools/qlist/CMakeLists.txt | 12 ++++++++++++ tests/auto/corelib/tools/qlist/tst_qlist.cpp | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/tests/auto/corelib/tools/qlist/CMakeLists.txt b/tests/auto/corelib/tools/qlist/CMakeLists.txt index fdcfcd7424b..2a7fd3bc7dc 100644 --- a/tests/auto/corelib/tools/qlist/CMakeLists.txt +++ b/tests/auto/corelib/tools/qlist/CMakeLists.txt @@ -14,6 +14,18 @@ endif() qt_internal_add_test(tst_qlist SOURCES tst_qlist.cpp + DEFINES + QT_NO_STRICT_QLIST_ITERATORS # doesn't exist, except for this test + LIBRARIES + Qt::CorePrivate +) + +qt_internal_add_test(tst_qlist_strict_iterators + SOURCES + tst_qlist.cpp + DEFINES + QT_STRICT_QLIST_ITERATORS + tst_QList=tst_QList_strict_iterators LIBRARIES Qt::CorePrivate ) diff --git a/tests/auto/corelib/tools/qlist/tst_qlist.cpp b/tests/auto/corelib/tools/qlist/tst_qlist.cpp index 0a04e816751..d879467da37 100644 --- a/tests/auto/corelib/tools/qlist/tst_qlist.cpp +++ b/tests/auto/corelib/tools/qlist/tst_qlist.cpp @@ -1,6 +1,12 @@ // Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#ifdef QT_NO_STRICT_QLIST_ITERATORS +# ifdef QT_STRICT_QLIST_ITERATORS +# undef QT_STRICT_QLIST_ITERATORS +# endif +#endif + #include #include #include