summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-03 13:12:07 +0200
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-03 13:12:07 +0200
commit49c4c8372cd6bf194c1a36029844eefe94393da0 (patch)
tree77975968f0b89983ec1fd60910df5147fc27b485 /tests
parenta8829a52d65a9759d5dffe98fb07b384c54db1c8 (diff)
parent1d87017c4681c9d5da14d613b5b84d25620642fe (diff)
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Fix compilation: disable -no-feature-* for bootstrapped QString: Fix severals bugs when comparing with QStringRef QProgressBar: make accessors const. Changes: add patch for artificial emboldening Added static version of QGLFramebufferObject::release(). Fix compilation on WinXP MinGW32; Add a new qconfig feature GESTURES
Diffstat (limited to 'tests')
-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 1bea4b77e8..c887936b4b 100644
--- a/tests/auto/qstring/tst_qstring.cpp
+++ b/tests/auto/qstring/tst_qstring.cpp
@@ -207,6 +207,7 @@ private slots:
void repeated() const;
void repeated_data() const;
void task262677remove();
+ void QTBUG10404_compareRef();
};
typedef QList<int> IntList;
@@ -4828,6 +4829,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)