summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qsharedpointer
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/tools/qsharedpointer')
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/CMakeLists.txt11
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/externaltests.cpp31
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/externaltests.h29
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/forwarddeclared.cpp31
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/forwarddeclared.h31
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/nontracked.cpp29
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/nontracked.h29
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp242
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/wrapper.cpp29
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/wrapper.h29
10 files changed, 238 insertions, 253 deletions
diff --git a/tests/auto/corelib/tools/qsharedpointer/CMakeLists.txt b/tests/auto/corelib/tools/qsharedpointer/CMakeLists.txt
index d29f203bf9..0db0cba4c0 100644
--- a/tests/auto/corelib/tools/qsharedpointer/CMakeLists.txt
+++ b/tests/auto/corelib/tools/qsharedpointer/CMakeLists.txt
@@ -1,13 +1,22 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
#####################################################################
## tst_qsharedpointer Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qsharedpointer LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_qsharedpointer
SOURCES
forwarddeclared.cpp
nontracked.cpp
wrapper.cpp
tst_qsharedpointer.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::CorePrivate
)
diff --git a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
index 08b0f21cc9..c676924668 100644
--- a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "externaltests.h"
@@ -80,7 +55,7 @@ namespace QTest {
{
if (process.state() == QProcess::Running) {
process.terminate();
- QThread::msleep(20);
+ QThread::sleep(std::chrono::milliseconds{20});
if (process.state() == QProcess::Running)
process.kill();
}
diff --git a/tests/auto/corelib/tools/qsharedpointer/externaltests.h b/tests/auto/corelib/tools/qsharedpointer/externaltests.h
index bae6adaefe..790ca61992 100644
--- a/tests/auto/corelib/tools/qsharedpointer/externaltests.h
+++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QTEST_EXTERNAL_TESTS_H
diff --git a/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.cpp b/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.cpp
index df343b5ebc..5a0af60c11 100644
--- a/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "forwarddeclared.h"
#include "qsharedpointer.h"
diff --git a/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.h b/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.h
index c72324841c..ba436d99cf 100644
--- a/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.h
+++ b/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.h
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef FORWARDDECLARED_H
#define FORWARDDECLARED_H
diff --git a/tests/auto/corelib/tools/qsharedpointer/nontracked.cpp b/tests/auto/corelib/tools/qsharedpointer/nontracked.cpp
index fa52c4f6c5..b572fa1b9f 100644
--- a/tests/auto/corelib/tools/qsharedpointer/nontracked.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/nontracked.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Intel Corporation.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
/*
* This file exists because tst_qsharedpointer.cpp is compiled with
diff --git a/tests/auto/corelib/tools/qsharedpointer/nontracked.h b/tests/auto/corelib/tools/qsharedpointer/nontracked.h
index 76af80d2d7..e10ea08a4d 100644
--- a/tests/auto/corelib/tools/qsharedpointer/nontracked.h
+++ b/tests/auto/corelib/tools/qsharedpointer/nontracked.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Intel Corporation.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef NONTRACKED_H
#define NONTRACKED_H
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
index d526314d41..f42637a3fe 100644
--- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
@@ -1,32 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Copyright (C) 2020 Intel Corporation.
-** Copyright (C) 2019 Klarälvdalens Datakonsult AB.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2022 Intel Corporation.
+// Copyright (C) 2021 Klarälvdalens Datakonsult AB.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#define QT_SHAREDPOINTER_TRACK_POINTERS
#include "qsharedpointer.h"
@@ -116,6 +91,7 @@ private slots:
void invalidConstructs_data();
void invalidConstructs();
#endif
+ void ownerComparisons();
// let invalidConstructs be the last test, because it's the slowest;
// add new tests above this block
@@ -795,9 +771,14 @@ public:
void tst_QSharedPointer::downCast()
{
{
+ // copy construction
QSharedPointer<DerivedData> ptr = QSharedPointer<DerivedData>(new DerivedData);
+ QSharedPointer<DerivedData> copy = ptr;
QSharedPointer<Data> baseptr = qSharedPointerCast<Data>(ptr);
QSharedPointer<Data> other;
+ QWeakPointer<DerivedData> weak = ptr;
+ QWeakPointer<Data> baseweak = qSharedPointerCast<Data>(ptr);
+ QWeakPointer<Data> baseweak2 = qSharedPointerCast<Data>(weak);
QVERIFY(ptr == baseptr);
QVERIFY(baseptr == ptr);
@@ -808,11 +789,55 @@ void tst_QSharedPointer::downCast()
QVERIFY(other != ptr);
QVERIFY(! (ptr == other));
QVERIFY(! (other == ptr));
+
+ // copy assignments
+ baseptr = qSharedPointerCast<Data>(ptr);
+ baseweak = qSharedPointerCast<Data>(ptr);
+ baseweak2 = baseweak;
+
+ // move assignments (these don't actually move)
+ baseptr = qSharedPointerCast<Data>(std::move(ptr));
+ ptr = copy;
+ baseweak = qSharedPointerCast<Data>(std::move(ptr));
+ ptr = copy;
+ baseweak2 = qSharedPointerCast<Data>(std::move(baseweak));
+
+ // move construction (these don't actually move)
+ ptr = copy;
+ QSharedPointer<Data> ptr3(qSharedPointerCast<Data>(std::move(ptr)));
+ ptr = copy;
+ QWeakPointer<Data> baseweak3(qSharedPointerCast<Data>(std::move(ptr)));
+ ptr = copy;
+ QWeakPointer<Data> baseweak4(qSharedPointerCast<Data>(std::move(weak)));
}
{
+ // copy construction
QSharedPointer<DerivedData> ptr = QSharedPointer<DerivedData>(new DerivedData);
+ QSharedPointer<DerivedData> copy = ptr;
QSharedPointer<Data> baseptr = ptr;
+ QWeakPointer<DerivedData> weak = ptr;
+ QWeakPointer<Data> baseweak = ptr;
+ QWeakPointer<Data> baseweak2 = weak;
+
+ // copy assignments
+ baseptr = ptr;
+ baseweak = ptr;
+ baseweak2 = weak;
+
+ // move assignments (only the QSharedPointer-QSharedPointer actually moves)
+ baseweak = std::move(ptr);
+ baseweak2 = std::move(weak);
+ ptr = copy;
+ baseptr = std::move(ptr);
+
+ // move construction (only the QSharedPointer-QSharedPointer actually moves)
+ ptr = copy;
+ QWeakPointer<Data> baseweak3(std::move(ptr));
+ ptr = copy;
+ QWeakPointer<Data> baseweak4(std::move(weak));
+ ptr = copy;
+ QSharedPointer<Data> baseptr2(std::move(ptr));
}
int destructorCount;
@@ -1251,6 +1276,22 @@ void tst_QSharedPointer::virtualBaseDifferentPointers()
QVERIFY(baseptr == aBase);
}
safetyCheck();
+ {
+ VirtualDerived *aData = new VirtualDerived;
+
+ QSharedPointer<VirtualDerived> ptr = QSharedPointer<VirtualDerived>(aData);
+ QWeakPointer<VirtualDerived> wptr = ptr;
+
+ ptr.reset();
+ QVERIFY(wptr.toStrongRef().isNull());
+
+ QWeakPointer<Data> wptr2 = wptr;
+ QVERIFY(wptr2.toStrongRef().isNull());
+
+ QWeakPointer<Data> wptr3 = std::move(wptr);
+ QVERIFY(wptr3.toStrongRef().isNull());
+ }
+ safetyCheck();
}
#ifndef QTEST_NO_RTTI
@@ -1958,7 +1999,7 @@ class StrongThread: public QThread
protected:
void run() override
{
- usleep(QRandomGenerator::global()->bounded(2000));
+ sleep(std::chrono::microseconds{QRandomGenerator::global()->bounded(2000)});
ptr->ref();
ptr.clear();
}
@@ -1971,7 +2012,7 @@ class WeakThread: public QThread
protected:
void run() override
{
- usleep(QRandomGenerator::global()->bounded(2000));
+ sleep(std::chrono::microseconds{QRandomGenerator::global()->bounded(2000)});
QSharedPointer<ThreadData> ptr = weak;
if (ptr)
ptr->ref();
@@ -2034,11 +2075,11 @@ void tst_QSharedPointer::threadStressTest()
base.clear();
// start threads
- for (int i = 0; i < allThreads.count(); ++i)
+ for (int i = 0; i < allThreads.size(); ++i)
if (allThreads[i]) allThreads[i]->start();
// wait for them to finish
- for (int i = 0; i < allThreads.count(); ++i)
+ for (int i = 0; i < allThreads.size(); ++i)
if (allThreads[i]) allThreads[i]->wait();
qDeleteAll(allThreads);
@@ -2801,5 +2842,140 @@ void tst_QSharedPointer::overloads()
weakOverloaded.test();
}
+void tst_QSharedPointer::ownerComparisons()
+{
+ using SP = QSharedPointer<int>;
+ using WP = QWeakPointer<int>;
+
+#define CHECK_EQ(a, b) \
+ do { \
+ QVERIFY(a.owner_equal(b)); \
+ QVERIFY(b.owner_equal(a)); \
+ QVERIFY(!a.owner_before(b)); \
+ QVERIFY(!b.owner_before(a)); \
+ QVERIFY(a.owner_hash() == b.owner_hash()); \
+ } while (false)
+
+#define CHECK_NOT_EQ(a, b) \
+ do { \
+ QVERIFY(!a.owner_equal(b)); \
+ QVERIFY(!b.owner_equal(a)); \
+ QVERIFY(a.owner_before(b) || b.owner_before(a)); \
+ } while (false)
+
+ // null
+ {
+ SP sp1;
+ SP sp2;
+ WP wp1 = sp1;
+ WP wp2;
+
+ CHECK_EQ(sp1, sp1);
+ CHECK_EQ(sp1, sp2);
+ CHECK_EQ(sp1, wp1);
+ CHECK_EQ(sp2, wp2);
+ CHECK_EQ(wp1, wp1);
+ CHECK_EQ(wp1, wp2);
+ CHECK_EQ(wp2, wp2);
+ }
+
+ // same owner
+ {
+ SP sp1 = SP::create(123);
+ SP sp2 = sp1;
+ WP wp1 = sp1;
+ SP wp2 = sp2;
+
+ CHECK_EQ(sp1, sp1);
+ CHECK_EQ(sp1, sp2);
+ CHECK_EQ(sp1, wp1);
+ CHECK_EQ(sp2, wp2);
+ CHECK_EQ(wp1, wp1);
+ CHECK_EQ(wp1, wp2);
+ }
+
+ // owning vs null
+ {
+ SP sp1 = SP::create(123);
+ SP sp2;
+ WP wp1 = sp1;
+ WP wp2 = sp2;
+
+ CHECK_EQ(sp1, sp1);
+ CHECK_NOT_EQ(sp1, sp2);
+ CHECK_EQ(sp1, wp1);
+ CHECK_EQ(sp2, wp2);
+ CHECK_EQ(wp1, wp1);
+ CHECK_NOT_EQ(wp1, wp2);
+ }
+
+ // different owners
+ {
+ SP sp1 = SP::create(123);
+ SP sp2 = SP::create(456);
+ WP wp1 = sp1;
+ WP wp2 = sp2;
+
+ CHECK_EQ(sp1, sp1);
+ CHECK_NOT_EQ(sp1, sp2);
+ CHECK_EQ(sp1, wp1);
+ CHECK_EQ(sp2, wp2);
+ CHECK_EQ(wp1, wp1);
+ CHECK_NOT_EQ(wp1, wp2);
+ }
+
+ // reset vs. null
+ {
+ SP sp1 = SP::create(123);
+ SP sp2;
+ WP wp1 = sp1;
+ WP wp2;
+
+ CHECK_EQ(sp1, sp1);
+ CHECK_NOT_EQ(sp1, sp2);
+ CHECK_EQ(sp1, wp1);
+ CHECK_NOT_EQ(sp1, wp2);
+ CHECK_EQ(wp1, wp1);
+ CHECK_NOT_EQ(wp1, wp2);
+
+ sp1.reset();
+
+ CHECK_EQ(sp1, sp1);
+ CHECK_EQ(sp1, sp2);
+ CHECK_NOT_EQ(sp1, wp1);
+ CHECK_EQ(sp2, wp2);
+ CHECK_EQ(wp1, wp1);
+ CHECK_NOT_EQ(wp1, wp2);
+ }
+
+ // expired weak pointers
+ {
+ WP wp1 = SP::create(123);
+ WP wp2;
+
+ CHECK_EQ(wp1, wp1);
+ CHECK_NOT_EQ(wp1, wp2);
+ }
+
+ {
+ WP wp1 = SP::create(123);
+ WP wp2 = wp1;
+
+ CHECK_EQ(wp1, wp1);
+ CHECK_EQ(wp1, wp2);
+ }
+
+ {
+ WP wp1 = SP::create(123);
+ WP wp2 = SP::create(456);
+
+ CHECK_EQ(wp1, wp1);
+ CHECK_EQ(wp2, wp2);
+ CHECK_NOT_EQ(wp1, wp2);
+ }
+#undef CHECK_EQ
+#undef CHECK_NOT_EQ
+}
+
QTEST_MAIN(tst_QSharedPointer)
#include "tst_qsharedpointer.moc"
diff --git a/tests/auto/corelib/tools/qsharedpointer/wrapper.cpp b/tests/auto/corelib/tools/qsharedpointer/wrapper.cpp
index 24a0cdc9c1..b39eee7d98 100644
--- a/tests/auto/corelib/tools/qsharedpointer/wrapper.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/wrapper.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
# undef QT_SHAREDPOINTER_TRACK_POINTERS
diff --git a/tests/auto/corelib/tools/qsharedpointer/wrapper.h b/tests/auto/corelib/tools/qsharedpointer/wrapper.h
index 18cea6e199..3b0bc09fed 100644
--- a/tests/auto/corelib/tools/qsharedpointer/wrapper.h
+++ b/tests/auto/corelib/tools/qsharedpointer/wrapper.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef WRAPPER_H
#define WRAPPER_H