summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-10-06 11:44:06 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-10-10 20:28:09 +0200
commit2303ee38ead0a4eafa9f8af629fd8495c45d1442 (patch)
tree7452bd4541af302a6749881b7fdef0f1c7283990 /tests
parent7f0d702f4e568790dfdfd916fa3c2da5ec78c6df (diff)
downloadqtwayland-2303ee38ead0a4eafa9f8af629fd8495c45d1442.tar.gz
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: Ia64c6615ee81f7ad5d0658449b0ee347c3db8c29 Reviewed-by: David Edmundson <davidedmundson@kde.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/client/primaryselectionv1/tst_primaryselectionv1.cpp2
-rw-r--r--tests/auto/client/shared/corecompositor.cpp4
-rw-r--r--tests/auto/client/shared/corecompositor.h6
-rw-r--r--tests/auto/client/shared/coreprotocol.cpp6
-rw-r--r--tests/auto/client/shared/coreprotocol.h2
-rw-r--r--tests/auto/client/shared/datadevice.cpp2
-rw-r--r--tests/auto/client/shared/xdgshell.cpp4
-rw-r--r--tests/manual/texture-sharing/cpp-client/main.cpp2
8 files changed, 14 insertions, 14 deletions
diff --git a/tests/auto/client/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/client/primaryselectionv1/tst_primaryselectionv1.cpp
index 5ec046d1..558e4676 100644
--- a/tests/auto/client/primaryselectionv1/tst_primaryselectionv1.cpp
+++ b/tests/auto/client/primaryselectionv1/tst_primaryselectionv1.cpp
@@ -147,7 +147,7 @@ public:
{}
bool isClean() override
{
- for (auto *device : qAsConst(m_devices)) {
+ for (auto *device : std::as_const(m_devices)) {
// The client should not leak selection offers, i.e. if this fails, there is a missing
// zwp_primary_selection_offer_v1.destroy request
if (!device->m_sentSelectionOffers.empty())
diff --git a/tests/auto/client/shared/corecompositor.cpp b/tests/auto/client/shared/corecompositor.cpp
index 38930c54..dd7311e4 100644
--- a/tests/auto/client/shared/corecompositor.cpp
+++ b/tests/auto/client/shared/corecompositor.cpp
@@ -35,7 +35,7 @@ CoreCompositor::~CoreCompositor()
bool CoreCompositor::isClean()
{
Lock lock(this);
- for (auto *global : qAsConst(m_globals)) {
+ for (auto *global : std::as_const(m_globals)) {
if (!global->isClean())
return false;
}
@@ -46,7 +46,7 @@ QString CoreCompositor::dirtyMessage()
{
Lock lock(this);
QStringList messages;
- for (auto *global : qAsConst(m_globals)) {
+ for (auto *global : std::as_const(m_globals)) {
if (!global->isClean())
messages << (global->metaObject()->className() % QLatin1String(": ") % global->dirtyMessage());
}
diff --git a/tests/auto/client/shared/corecompositor.h b/tests/auto/client/shared/corecompositor.h
index 2edb7f3f..b7d1de78 100644
--- a/tests/auto/client/shared/corecompositor.h
+++ b/tests/auto/client/shared/corecompositor.h
@@ -98,7 +98,7 @@ public:
global_type *get()
{
warnIfNotLockedByThread(Q_FUNC_INFO);
- for (auto *global : qAsConst(m_globals)) {
+ for (auto *global : std::as_const(m_globals)) {
if (auto *casted = qobject_cast<global_type *>(global))
return casted;
}
@@ -112,7 +112,7 @@ public:
global_type *get(int index)
{
warnIfNotLockedByThread(Q_FUNC_INFO);
- for (auto *global : qAsConst(m_globals)) {
+ for (auto *global : std::as_const(m_globals)) {
if (auto *casted = qobject_cast<global_type *>(global)) {
if (index--)
continue;
@@ -130,7 +130,7 @@ public:
{
warnIfNotLockedByThread(Q_FUNC_INFO);
QList<global_type *> matching;
- for (auto *global : qAsConst(m_globals)) {
+ for (auto *global : std::as_const(m_globals)) {
if (auto *casted = qobject_cast<global_type *>(global))
matching.append(casted);
}
diff --git a/tests/auto/client/shared/coreprotocol.cpp b/tests/auto/client/shared/coreprotocol.cpp
index 559ddbd7..005151f7 100644
--- a/tests/auto/client/shared/coreprotocol.cpp
+++ b/tests/auto/client/shared/coreprotocol.cpp
@@ -144,7 +144,7 @@ void Surface::surface_frame(Resource *resource, uint32_t callback)
}
bool WlCompositor::isClean() {
- for (auto *surface : qAsConst(m_surfaces)) {
+ for (auto *surface : std::as_const(m_surfaces)) {
if (!CursorRole::fromSurface(surface)) {
if (m_compositor->m_type != CoreCompositor::CompositorType::Legacy)
return false;
@@ -160,7 +160,7 @@ QString WlCompositor::dirtyMessage()
if (isClean())
return "clean";
QStringList messages;
- for (auto *s : qAsConst(m_surfaces)) {
+ for (auto *s : std::as_const(m_surfaces)) {
QString role = s->m_role ? s->m_role->staticMetaObject.className(): "none/unknown";
messages << "Surface with role: " + role;
}
@@ -547,7 +547,7 @@ Shm::Shm(CoreCompositor *compositor, QList<format> formats, int version)
bool Shm::isClean()
{
-// for (ShmPool *pool : qAsConst(m_pools)) {
+// for (ShmPool *pool : std::as_const(m_pools)) {
// //TODO: return false if not cursor buffer
// if (pool->m_buffers.isEmpty()) {
// return false;
diff --git a/tests/auto/client/shared/coreprotocol.h b/tests/auto/client/shared/coreprotocol.h
index 77ef3cd4..370b8cd8 100644
--- a/tests/auto/client/shared/coreprotocol.h
+++ b/tests/auto/client/shared/coreprotocol.h
@@ -411,7 +411,7 @@ protected:
void shm_create_pool(Resource *resource, uint32_t id, int32_t fd, int32_t size) override;
void shm_bind_resource(Resource *resource) override
{
- for (auto format : qAsConst(m_formats))
+ for (auto format : std::as_const(m_formats))
send_format(resource->handle, format);
}
};
diff --git a/tests/auto/client/shared/datadevice.cpp b/tests/auto/client/shared/datadevice.cpp
index 100f937d..26ebec6b 100644
--- a/tests/auto/client/shared/datadevice.cpp
+++ b/tests/auto/client/shared/datadevice.cpp
@@ -7,7 +7,7 @@ namespace MockCompositor {
bool DataDeviceManager::isClean()
{
- for (auto *device : qAsConst(m_dataDevices)) {
+ for (auto *device : std::as_const(m_dataDevices)) {
// The client should not leak selection offers, i.e. if this fails, there is a missing
// data_offer.destroy request
if (!device->m_sentSelectionOffers.empty())
diff --git a/tests/auto/client/shared/xdgshell.cpp b/tests/auto/client/shared/xdgshell.cpp
index b50f36e7..eb9a1e87 100644
--- a/tests/auto/client/shared/xdgshell.cpp
+++ b/tests/auto/client/shared/xdgshell.cpp
@@ -14,7 +14,7 @@ XdgWmBase::XdgWmBase(CoreCompositor *compositor, int version)
XdgToplevel *XdgWmBase::toplevel(int i)
{
int j = 0;
- for (auto *xdgSurface : qAsConst(m_xdgSurfaces)) {
+ for (auto *xdgSurface : std::as_const(m_xdgSurfaces)) {
if (auto *toplevel = xdgSurface->m_toplevel) {
if (j == i)
return toplevel;
@@ -27,7 +27,7 @@ XdgToplevel *XdgWmBase::toplevel(int i)
XdgPopup *XdgWmBase::popup(int i)
{
int j = 0;
- for (auto *xdgSurface : qAsConst(m_xdgSurfaces)) {
+ for (auto *xdgSurface : std::as_const(m_xdgSurfaces)) {
if (auto *popup = xdgSurface->m_popup) {
if (j == i)
return popup;
diff --git a/tests/manual/texture-sharing/cpp-client/main.cpp b/tests/manual/texture-sharing/cpp-client/main.cpp
index 3c0a826f..e8ff92c0 100644
--- a/tests/manual/texture-sharing/cpp-client/main.cpp
+++ b/tests/manual/texture-sharing/cpp-client/main.cpp
@@ -87,7 +87,7 @@ protected:
int x = 0;
qDebug() << "*** paintGL ***";
showBuffers();
- for (auto buffer: qAsConst(m_buffers)) {
+ for (auto buffer: std::as_const(m_buffers)) {
m_blitter->bind();
QSize s(buffer->size());
qDebug() << "painting" << buffer << s;