QJsonObject: Fix operator<=()
We had a copy-paste error there. Pick-to: 6.0 6.1 Change-Id: Ib1448197ac4f4641c6559f133f41dcf326f210f1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
09fc4f9525
commit
a2e23bca0f
@ -153,7 +153,7 @@ public:
|
|||||||
bool operator<(const iterator& other) const
|
bool operator<(const iterator& other) const
|
||||||
{ Q_ASSERT(item.o == other.item.o); return item.index < other.item.index; }
|
{ Q_ASSERT(item.o == other.item.o); return item.index < other.item.index; }
|
||||||
bool operator<=(const iterator& other) const
|
bool operator<=(const iterator& other) const
|
||||||
{ Q_ASSERT(item.o == other.item.o); return item.index < other.item.index; }
|
{ Q_ASSERT(item.o == other.item.o); return item.index <= other.item.index; }
|
||||||
bool operator>(const iterator& other) const { return !(*this <= other); }
|
bool operator>(const iterator& other) const { return !(*this <= other); }
|
||||||
bool operator>=(const iterator& other) const { return !(*this < other); }
|
bool operator>=(const iterator& other) const { return !(*this < other); }
|
||||||
|
|
||||||
|
@ -170,6 +170,8 @@ private Q_SLOTS:
|
|||||||
void fromToVariantConversions_data();
|
void fromToVariantConversions_data();
|
||||||
void fromToVariantConversions();
|
void fromToVariantConversions();
|
||||||
|
|
||||||
|
void testIteratorComparison();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString testDataDir;
|
QString testDataDir;
|
||||||
};
|
};
|
||||||
@ -3520,5 +3522,34 @@ void tst_QtJson::fromToVariantConversions()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_QtJson::testIteratorComparison()
|
||||||
|
{
|
||||||
|
QJsonObject t = QJsonObject::fromVariantHash({
|
||||||
|
{ QStringLiteral("a"), QVariant(12) },
|
||||||
|
{ QStringLiteral("b"), QVariant(13) }
|
||||||
|
});
|
||||||
|
|
||||||
|
QVERIFY(t.begin() == t.begin());
|
||||||
|
QVERIFY(t.begin() <= t.begin());
|
||||||
|
QVERIFY(t.begin() >= t.begin());
|
||||||
|
QVERIFY(!(t.begin() != t.begin()));
|
||||||
|
QVERIFY(!(t.begin() < t.begin()));
|
||||||
|
QVERIFY(!(t.begin() > t.begin()));
|
||||||
|
|
||||||
|
QVERIFY(!(t.begin() == t.end()));
|
||||||
|
QVERIFY(t.begin() <= t.end());
|
||||||
|
QVERIFY(!(t.begin() >= t.end()));
|
||||||
|
QVERIFY(t.begin() != t.end());
|
||||||
|
QVERIFY(t.begin() < t.end());
|
||||||
|
QVERIFY(!(t.begin() > t.end()));
|
||||||
|
|
||||||
|
QVERIFY(!(t.end() == t.begin()));
|
||||||
|
QVERIFY(!(t.end() <= t.begin()));
|
||||||
|
QVERIFY(t.end() >= t.begin());
|
||||||
|
QVERIFY(t.end() != t.begin());
|
||||||
|
QVERIFY(!(t.end() < t.begin()));
|
||||||
|
QVERIFY(t.end() > t.begin());
|
||||||
|
}
|
||||||
|
|
||||||
QTEST_MAIN(tst_QtJson)
|
QTEST_MAIN(tst_QtJson)
|
||||||
#include "tst_qtjson.moc"
|
#include "tst_qtjson.moc"
|
||||||
|
Loading…
Reference in New Issue
Block a user