summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-10-06 11:45:10 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-10-07 14:30:34 +0200
commit1052aaed63bab5f7c10346c097f95793343df5d5 (patch)
tree549dbd753b00564312411492d23b8f0b1f585d7c /tests/auto
parent5c1ce9075510d2a9f563c01225e7b960c70b07bb (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: I4b5f85df579532c2af938fe70db945ba273782fb Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp2
-rw-r--r--tests/auto/httpserver/httpserver.cpp2
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp4
3 files changed, 4 insertions, 4 deletions
diff --git a/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp b/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp
index e0fee6b08..4b2717d7e 100644
--- a/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp
+++ b/tests/auto/core/qwebenginecookiestore/tst_qwebenginecookiestore.cpp
@@ -306,7 +306,7 @@ void tst_QWebEngineCookieStore::basicFilterOverHTTP()
(void) httpServer.stop();
QCOMPARE(resourceFirstParty.size(), accessTested.loadAcquire());
- for (auto &&p : qAsConst(resourceFirstParty))
+ for (auto &&p : std::as_const(resourceFirstParty))
QVERIFY2(p.second == firstPartyUrl,
qPrintable(QString("Resource [%1] has wrong firstPartyUrl: %2").arg(p.first.toString(), p.second.toString())));
}
diff --git a/tests/auto/httpserver/httpserver.cpp b/tests/auto/httpserver/httpserver.cpp
index 6dd64ab88..c65d68ce7 100644
--- a/tests/auto/httpserver/httpserver.cpp
+++ b/tests/auto/httpserver/httpserver.cpp
@@ -79,7 +79,7 @@ void HttpServer::handleNewConnection()
// if request wasn't handled or purposely ignored for default behavior
// then try to serve htmls from resources dirs if set
if (rr->requestMethod() == "GET") {
- for (auto &&dir : qAsConst(m_dirs)) {
+ for (auto &&dir : std::as_const(m_dirs)) {
QFile f(dir + rr->requestPath());
if (f.exists()) {
if (f.open(QFile::ReadOnly)) {
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index bd8c331ac..7e4acc97c 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -894,12 +894,12 @@ void tst_publicapi::publicAPI()
// Uncomment to print the actual API.
// QStringList sortedAPI(actualAPI);
// std::sort(sortedAPI.begin(), sortedAPI.end());
- // for (const QString &actual : qAsConst(sortedAPI))
+ // for (const QString &actual : std::as_const(sortedAPI))
// printf(" << \"%s\"\n", qPrintable(actual));
bool apiMatch = true;
// Make sure that nothing slips in the public API unintentionally.
- for (const QString &actual : qAsConst(actualAPI)) {
+ for (const QString &actual : std::as_const(actualAPI)) {
if (!expectedAPI.contains(actual)) {
qWarning("Expected list is not up-to-date: %ls", qUtf16Printable(actual));
apiMatch = false;