summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/json/tst_qtjson.cpp17
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp12
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp
index d5575b0e28..97504d178a 100644
--- a/tests/auto/corelib/json/tst_qtjson.cpp
+++ b/tests/auto/corelib/json/tst_qtjson.cpp
@@ -61,6 +61,7 @@ private Q_SLOTS:
void testNumbers();
void testObjectSimple();
+ void testObjectSmallKeys();
void testArraySimple();
void testValueObject();
void testValueArray();
@@ -277,6 +278,22 @@ void TestQtJson::testObjectSimple()
QVERIFY2(object.value("string").toString() != before, "value should have been updated");
}
+void TestQtJson::testObjectSmallKeys()
+{
+ QJsonObject data1;
+ data1.insert(QStringLiteral("1"), 123);
+ QVERIFY(data1.contains(QStringLiteral("1")));
+ QCOMPARE(data1.value(QStringLiteral("1")).toDouble(), (double)123);
+ data1.insert(QStringLiteral("12"), 133);
+ QCOMPARE(data1.value(QStringLiteral("12")).toDouble(), (double)133);
+ QVERIFY(data1.contains(QStringLiteral("12")));
+ data1.insert(QStringLiteral("123"), 323);
+ QCOMPARE(data1.value(QStringLiteral("12")).toDouble(), (double)133);
+ QVERIFY(data1.contains(QStringLiteral("123")));
+ QCOMPARE(data1.value(QStringLiteral("123")).type(), QJsonValue::Double);
+ QCOMPARE(data1.value(QStringLiteral("123")).toDouble(), (double)323);
+}
+
void TestQtJson::testArraySimple()
{
QJsonArray array;
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<int> 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"