From e62fe9ed4fd8d33f881dedeeafafc4a0c65e5278 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 26 Jan 2012 11:13:41 +0100 Subject: Fixed QString::operator<(QLatin1String) QLatin1String now has a constructor that takes explicit length, which makes it possible to create QLatin1String that do not have null-termination character. Fixed QString::operator> and < to be safe in that case. In the same patch fixed qtjson which had operator< implemented in the same way. QString::compare(QLatin1String) is still broken and will be fixed separately. Change-Id: I48ec1183a6f44034129cc17312af854795085408 Reviewed-by: Denis Dzyubenko Reviewed-by: Lars Knoll --- tests/auto/corelib/tools/qstring/tst_qstring.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/auto/corelib/tools') diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index b9951c1b5d..5e95f31c2a 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -220,6 +220,8 @@ private slots: void reserve(); void toHtmlEscaped_data(); void toHtmlEscaped(); + + void operatorGreaterWithQLatin1String(); }; typedef QList IntList; @@ -5175,6 +5177,16 @@ void tst_QString::toHtmlEscaped() QCOMPARE(original.toHtmlEscaped(), expected); } +void tst_QString::operatorGreaterWithQLatin1String() +{ + QLatin1String latin1foo("fooZZ", 3); + QString stringfoo = QString::fromLatin1("foo"); + QVERIFY(stringfoo >= latin1foo); + QVERIFY(!(stringfoo > latin1foo)); + QVERIFY(stringfoo <= latin1foo); + QVERIFY(!(stringfoo < latin1foo)); +} + QTEST_APPLESS_MAIN(tst_QString) #include "tst_qstring.moc" -- cgit v1.2.3