summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2024-04-11 11:51:44 -0700
committerIvan Solovev <ivan.solovev@qt.io>2024-04-26 18:19:36 +0200
commit0756cc1eae5fd8981983319fef1d084762a67b8d (patch)
tree708064f6dfaa9c3881f94f1f20c3155906eef03a /tests/auto
parentc14f399d2ab42fa612121e805d8ec1e63747ccd6 (diff)
QTest: rip out qxp::function_ref from compare_helper()
[ChangeLog][QtTest] The QCOMPARE_xx macros can now only find QTest::toString() expansions that are either found via Argument Dependent Lookup on the type in question or are an instatiation of the QTest::toString<T>() template. This matches the behavior of the QCOMPARE() macro. This changes the way how the toString() overloads are selected, so we need to explicilty constraint the main QTest::toString() template in order to pick the free functions when they exist. Change-Id: Ie28eadac333c4bcd8c08fffd17c54e768c5cffd0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp
index 8a799fbf94..8360bdbe28 100644
--- a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp
+++ b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp
@@ -73,9 +73,12 @@ static QByteArray prettyList(const QueryItems &items)
static bool compare(const QueryItems &actual, const QueryItems &expected,
const char *actualStr, const char *expectedStr, const char *file, int line)
{
+ auto formatter = [](const void *val) -> const char * {
+ const QueryItems items = *static_cast<const QueryItems *>(val);
+ return qstrdup(prettyList(items).constData());
+ };
return QTest::compare_helper(actual == expected, "Compared values are not the same",
- [&actual] { return qstrdup(prettyList(actual).constData()); },
- [&expected] { return qstrdup(prettyList(expected).constData()); },
+ &actual, &expected, formatter, formatter,
actualStr, expectedStr, file, line);
}