summaryrefslogtreecommitdiffstats
path: root/tests/auto/qstring
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-06-08 18:47:57 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-06-08 18:47:57 (GMT)
commitd7d55ab51381f5805d52523d98623e63a99db2cf (patch)
tree5b760b92f84bdb2137fe7d53e16d78c0693fd2f4 /tests/auto/qstring
parentc5de4176dac960d8f7c6d2d77b0d8bf3c7311da9 (diff)
parent2ae808a23ce05bf9768ad9df107c16bb0c555ee7 (diff)
downloadQt-d7d55ab51381f5805d52523d98623e63a99db2cf.zip
Qt-d7d55ab51381f5805d52523d98623e63a99db2cf.tar.gz
Qt-d7d55ab51381f5805d52523d98623e63a99db2cf.tar.bz2
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts: tools/qdoc3/test/qt-html-templates.qdocconf
Diffstat (limited to 'tests/auto/qstring')
-rw-r--r--tests/auto/qstring/tst_qstring.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp
index eb2d5f1..9d8c0b2 100644
--- a/tests/auto/qstring/tst_qstring.cpp
+++ b/tests/auto/qstring/tst_qstring.cpp
@@ -212,6 +212,7 @@ private slots:
void repeated() const;
void repeated_data() const;
void task262677remove();
+ void QTBUG10404_compareRef();
};
typedef QList<int> IntList;
@@ -4900,6 +4901,38 @@ void tst_QString::task262677remove()
QVERIFY(driveName == QLatin1String("V:"));
}
+void tst_QString::QTBUG10404_compareRef()
+{
+ QString a = "ABCDEFGH";
+
+ QCOMPARE(QStringRef(&a, 1, 2).compare(QLatin1String("BC")), 0);
+ QVERIFY(QStringRef(&a, 1, 2).compare(QLatin1String("BCD")) < 0);
+ QCOMPARE(QStringRef(&a, 1, 2).compare(QLatin1String("Bc"), Qt::CaseInsensitive), 0);
+ QVERIFY(QStringRef(&a, 1, 2).compare(QLatin1String("bCD"), Qt::CaseInsensitive) < 0);
+
+ QCOMPARE(QStringRef(&a, 1, 2).compare(QString::fromLatin1("BC")), 0);
+ QVERIFY(QStringRef(&a, 1, 2).compare(QString::fromLatin1("BCD")) < 0);
+ QCOMPARE(QStringRef(&a, 1, 2).compare(QString::fromLatin1("Bc"), Qt::CaseInsensitive), 0);
+ QVERIFY(QStringRef(&a, 1, 2).compare(QString::fromLatin1("bCD"), Qt::CaseInsensitive) < 0);
+
+ QCOMPARE(QString::fromLatin1("BC").compare(QStringRef(&a, 1, 2)), 0);
+ QVERIFY(QString::fromLatin1("BCD").compare(QStringRef(&a, 1, 2)) > 0);
+ QCOMPARE(QString::fromLatin1("Bc").compare(QStringRef(&a, 1, 2), Qt::CaseInsensitive), 0);
+ QVERIFY(QString::fromLatin1("bCD").compare(QStringRef(&a, 1, 2), Qt::CaseInsensitive) > 0);
+
+ QCOMPARE(QStringRef(&a, 1, 2).compare(QStringRef(&a, 1, 2)), 0);
+ QVERIFY(QStringRef(&a, 1, 2).compare(QStringRef(&a, 1, 3)) < 0);
+ QCOMPARE(QStringRef(&a, 1, 2).compare(QStringRef(&a, 1, 2), Qt::CaseInsensitive), 0);
+ QVERIFY(QStringRef(&a, 1, 2).compare(QStringRef(&a, 1, 3), Qt::CaseInsensitive) < 0);
+
+ QString a2 = "ABCDEFGh";
+ QCOMPARE(QStringRef(&a2, 1, 2).compare(QStringRef(&a, 1, 2)), 0);
+ QVERIFY(QStringRef(&a2, 1, 2).compare(QStringRef(&a, 1, 3)) < 0);
+ QCOMPARE(QStringRef(&a2, 1, 2).compare(QStringRef(&a, 1, 2), Qt::CaseInsensitive), 0);
+ QVERIFY(QStringRef(&a2, 1, 2).compare(QStringRef(&a, 1, 3), Qt::CaseInsensitive) < 0);
+}
+
+
QTEST_APPLESS_MAIN(tst_QString)