diff options
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/corelib/tools/qstringref/tst_qstringref.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp index b3a1558931..b98c2fb4de 100644 --- a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp +++ b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp @@ -41,6 +41,7 @@ class tst_QStringRef : public QObject public slots: void cleanup(); private slots: + void at(); void endsWith(); void startsWith(); void contains(); @@ -172,6 +173,16 @@ void tst_QStringRef::cleanup() QLocale::setDefault(QString(QLatin1Char('C'))); } +void tst_QStringRef::at() +{ + const QString hw = QStringLiteral("Hello World"); + const QStringRef ref = hw.midRef(6); + QCOMPARE(ref.at(0), QChar('W')); + QCOMPARE(ref.at(4), QChar('d')); + QCOMPARE(ref[0], QChar('W')); + QCOMPARE(ref[4], QChar('d')); +} + void tst_QStringRef::length_data() { QTest::addColumn<QString>("s1"); |