summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/tools')
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 781377f574..dae1dc45ba 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -224,6 +224,7 @@ private slots:
void operatorGreaterWithQLatin1String();
void compareQLatin1Strings();
void fromQLatin1StringWithLength();
+ void assignQLatin1String();
};
typedef QList<int> IntList;
@@ -5286,6 +5287,28 @@ void tst_QString::fromQLatin1StringWithLength()
QCOMPARE(foo, QString::fromLatin1("foo"));
}
+void tst_QString::assignQLatin1String()
+{
+ QString empty = QLatin1String("");
+ QVERIFY(empty.isEmpty());
+ QVERIFY(!empty.isNull());
+
+ QString null = QLatin1String(0);
+ QVERIFY(null.isEmpty());
+ QVERIFY(null.isNull());
+
+ QLatin1String latin1foo("foo");
+ QString foo = latin1foo;
+ QCOMPARE(foo.size(), latin1foo.size());
+ QCOMPARE(foo, QString::fromLatin1("foo"));
+
+ QLatin1String latin1subfoo("foobar", 3);
+ foo = latin1subfoo;
+ QCOMPARE(foo.size(), latin1subfoo.size());
+ QCOMPARE(foo, QString::fromLatin1("foo"));
+
+}
+
QTEST_APPLESS_MAIN(tst_QString)
#include "tst_qstring.moc"