summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/serialization/qcborstreamwriter
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/serialization/qcborstreamwriter')
-rw-r--r--tests/auto/corelib/serialization/qcborstreamwriter/CMakeLists.txt11
-rw-r--r--tests/auto/corelib/serialization/qcborstreamwriter/tst_qcborstreamwriter.cpp12
2 files changed, 15 insertions, 8 deletions
diff --git a/tests/auto/corelib/serialization/qcborstreamwriter/CMakeLists.txt b/tests/auto/corelib/serialization/qcborstreamwriter/CMakeLists.txt
index 2796dc214c..c1a9a87677 100644
--- a/tests/auto/corelib/serialization/qcborstreamwriter/CMakeLists.txt
+++ b/tests/auto/corelib/serialization/qcborstreamwriter/CMakeLists.txt
@@ -1,12 +1,19 @@
-# Generated from qcborstreamwriter.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_qcborstreamwriter Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qcborstreamwriter LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_qcborstreamwriter
SOURCES
tst_qcborstreamwriter.cpp
INCLUDE_DIRECTORIES
- ../../../../../src/3rdparty/tinycbor/tests/encoder
+ ../../../../../src/3rdparty/tinycbor/tests
)
diff --git a/tests/auto/corelib/serialization/qcborstreamwriter/tst_qcborstreamwriter.cpp b/tests/auto/corelib/serialization/qcborstreamwriter/tst_qcborstreamwriter.cpp
index 5651cc3987..45e241ef5c 100644
--- a/tests/auto/corelib/serialization/qcborstreamwriter/tst_qcborstreamwriter.cpp
+++ b/tests/auto/corelib/serialization/qcborstreamwriter/tst_qcborstreamwriter.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2018 Intel Corporation.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
#include <QCborStreamWriter>
@@ -29,7 +29,7 @@ private Q_SLOTS:
// Get the data from TinyCBOR (see src/3rdparty/tinycbor/tests/encoder/data.cpp)
typedef quint64 CborTag;
-#include "data.cpp"
+#include "encoder/data.cpp"
void encodeVariant(QCborStreamWriter &writer, const QVariant &v)
{
@@ -81,9 +81,9 @@ void encodeVariant(QCborStreamWriter &writer, const QVariant &v)
list = v.value<IndeterminateLengthArray>();
writer.startArray();
} else {
- writer.startArray(list.length());
+ writer.startArray(list.size());
}
- for (const QVariant &v2 : qAsConst(list))
+ for (const QVariant &v2 : std::as_const(list))
encodeVariant(writer, v2);
QVERIFY(writer.endArray());
return;
@@ -94,9 +94,9 @@ void encodeVariant(QCborStreamWriter &writer, const QVariant &v)
map = v.value<IndeterminateLengthMap>();
writer.startMap();
} else {
- writer.startMap(map.length());
+ writer.startMap(map.size());
}
- for (auto pair : qAsConst(map)) {
+ for (auto pair : std::as_const(map)) {
encodeVariant(writer, pair.first);
encodeVariant(writer, pair.second);
}