summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-10-06 11:10:51 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-10-20 12:49:19 +0200
commit168de0273447ee303cedc2640af2f994cbf0dd8e (patch)
tree20ae734a008caf8caef9f5b5986a8c003fde99e9 /tests/auto
parent201ca07ae23ab142ac2efcf2413adf6c243be7f7 (diff)
Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I1b3c7c4058726c55199fd8ba74b6d6890ad8dd93 Reviewed-by: Mike Krus <mike.krus@kdab.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/core/qscene/tst_qscene.cpp14
-rw-r--r--tests/auto/render/raycasting/tst_raycasting.cpp2
-rw-r--r--tests/auto/render/raycastingjob/tst_raycastingjob.cpp4
-rw-r--r--tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp2
4 files changed, 11 insertions, 11 deletions
diff --git a/tests/auto/core/qscene/tst_qscene.cpp b/tests/auto/core/qscene/tst_qscene.cpp
index 1dc512205..ce20eb364 100644
--- a/tests/auto/core/qscene/tst_qscene.cpp
+++ b/tests/auto/core/qscene/tst_qscene.cpp
@@ -59,7 +59,7 @@ void tst_QScene::addNodeObservable()
scene->addObservable(nodes.at(i));
// THEN
- for (Qt3DCore::QNode *n : qAsConst(nodes)) {
+ for (Qt3DCore::QNode *n : std::as_const(nodes)) {
QVERIFY(n == scene->lookupNode(n->id()));
}
}
@@ -112,7 +112,7 @@ void tst_QScene::addChildNode()
QCoreApplication::processEvents();
// THEN
- for (Qt3DCore::QNode *n : qAsConst(nodes)) {
+ for (Qt3DCore::QNode *n : std::as_const(nodes)) {
QVERIFY(scene->lookupNode(n->id()) == n);
}
}
@@ -153,16 +153,16 @@ void tst_QScene::deleteChildNode()
QCoreApplication::processEvents();
// THEN
- for (Qt3DCore::QNode *n : qAsConst(nodes1)) {
+ for (Qt3DCore::QNode *n : std::as_const(nodes1)) {
QVERIFY(scene->lookupNode(n->id()) == n);
}
- for (Qt3DCore::QNode *n : qAsConst(nodes2)) {
+ for (Qt3DCore::QNode *n : std::as_const(nodes2)) {
QVERIFY(scene->lookupNode(n->id()) == n);
}
// gather node IDs
Qt3DCore::QNodeIdVector root1ChildIds;
- for (Qt3DCore::QNode *n : qAsConst(nodes1))
+ for (Qt3DCore::QNode *n : std::as_const(nodes1))
root1ChildIds << n->id();
// WHEN
@@ -170,7 +170,7 @@ void tst_QScene::deleteChildNode()
QCoreApplication::processEvents();
// THEN
- for (Qt3DCore::QNodeId id : qAsConst(root1ChildIds)) {
+ for (Qt3DCore::QNodeId id : std::as_const(root1ChildIds)) {
QVERIFY(scene->lookupNode(id) == nullptr);
}
@@ -179,7 +179,7 @@ void tst_QScene::deleteChildNode()
QCoreApplication::processEvents();
// THEN
- for (Qt3DCore::QNode *n : qAsConst(nodes2)) {
+ for (Qt3DCore::QNode *n : std::as_const(nodes2)) {
QVERIFY(scene->lookupNode(n->id()) == nullptr);
}
}
diff --git a/tests/auto/render/raycasting/tst_raycasting.cpp b/tests/auto/render/raycasting/tst_raycasting.cpp
index ad8c3af79..88a5ca030 100644
--- a/tests/auto/render/raycasting/tst_raycasting.cpp
+++ b/tests/auto/render/raycasting/tst_raycasting.cpp
@@ -161,7 +161,7 @@ void tst_RayCasting::shouldReturnAllResults()
// THEN
bool expectedHandlesFound = true;
- for (QQueryHandle expected : qAsConst(handles)) {
+ for (QQueryHandle expected : std::as_const(handles)) {
bool found = false;
for (QCollisionQueryResult result : results) {
if (result.handle() == expected)
diff --git a/tests/auto/render/raycastingjob/tst_raycastingjob.cpp b/tests/auto/render/raycastingjob/tst_raycastingjob.cpp
index 8bf581271..db41614a9 100644
--- a/tests/auto/render/raycastingjob/tst_raycastingjob.cpp
+++ b/tests/auto/render/raycastingjob/tst_raycastingjob.cpp
@@ -262,7 +262,7 @@ private Q_SLOTS:
Qt3DCore::QComponentVector rootComponents = root->components();
Qt3DRender::QRayCaster *rayCaster = nullptr;
- for (Qt3DCore::QComponent *c: qAsConst(rootComponents)) {
+ for (Qt3DCore::QComponent *c: std::as_const(rootComponents)) {
rayCaster = qobject_cast<Qt3DRender::QRayCaster *>(c);
if (rayCaster)
break;
@@ -325,7 +325,7 @@ private Q_SLOTS:
Qt3DCore::QComponentVector rootComponents = root->components();
Qt3DRender::QScreenRayCaster *rayCaster = nullptr;
- for (Qt3DCore::QComponent *c: qAsConst(rootComponents)) {
+ for (Qt3DCore::QComponent *c: std::as_const(rootComponents)) {
rayCaster = qobject_cast<Qt3DRender::QScreenRayCaster *>(c);
if (rayCaster)
break;
diff --git a/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp b/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp
index d0140e7bf..661bfb738 100644
--- a/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp
+++ b/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp
@@ -116,7 +116,7 @@ struct NodeCollection
// THEN
QCOMPARE(aspect->nodeManagers()->shaderDataManager()->activeHandles().size(), size_t(shaderData.size()));
- for (const Qt3DRender::QShaderData *s : qAsConst(shaderData)) {
+ for (const Qt3DRender::QShaderData *s : std::as_const(shaderData)) {
Qt3DRender::Render::ShaderData *backend = aspect->nodeManagers()->shaderDataManager()->lookupResource(s->id());
QVERIFY(backend != nullptr);
backendShaderData.push_back(backend);