summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2023-01-05 09:50:28 -0300
committerThiago Macieira <thiago.macieira@intel.com>2023-01-20 03:19:19 +0000
commit3d584b1093cdb6245b02eda996db2927ffaf09ea (patch)
tree8fd024ae4cc1cdfd8b0a1e13708cd39c169b1986 /tests
parentd298ec3a6f4634254c6685398d49b1ba4dfa8e6b (diff)
QUrlQuery: fix operator== for emptied object case
If an object had elements and then was emptied, it will have a non-null d pointer, which wasn't taken into account in the comparison. Fixes: QTBUG-109840 Pick-to: 6.5 6.4 6.2 Change-Id: I69ecc04064514f939896fffd17376aa18184653c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp
index 1774938096..41482f4256 100644
--- a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp
+++ b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp
@@ -210,12 +210,14 @@ void tst_QUrlQuery::constructing()
void tst_QUrlQuery::addRemove()
{
QUrlQuery query;
+ QCOMPARE(query, query);
{
// one item
query.addQueryItem("a", "b");
QVERIFY(!query.isEmpty());
QVERIFY(query.hasQueryItem("a"));
+ QCOMPARE_NE(query, QUrlQuery());
QCOMPARE(query.queryItemValue("a"), QString("b"));
QCOMPARE(query.allQueryItemValues("a"), QStringList() << "b");
@@ -226,6 +228,7 @@ void tst_QUrlQuery::addRemove()
}
QUrlQuery original = query;
+ QCOMPARE(query, original);
{
// two items
@@ -298,6 +301,9 @@ void tst_QUrlQuery::addRemove()
query.removeQueryItem("a");
query.removeQueryItem("e");
QVERIFY(query.isEmpty());
+ QVERIFY(query.isDetached());
+ QCOMPARE_NE(query, original);
+ QCOMPARE(query, QUrlQuery());
}
}