summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-11-06 01:00:56 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-11-06 01:00:56 +0100
commit290aac23a756522385b3200c84fd6118dc94d132 (patch)
tree081958c1b8792d90db6ecc105b57dbd0d1e70ab5 /tests/auto/corelib
parent81d8319276f26d399bdff47b49bd69b19bd86c5a (diff)
parent73e7eb785fbf984e2b964be8c3acad788479dfa6 (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp8
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp14
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index 0780fb9172..4da34c407e 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -525,6 +525,12 @@ void tst_QVariant::canConvert_data()
var = QVariant::fromValue<signed char>(-1);
QTest::newRow("SChar")
<< var << N << N << Y << N << Y << N << N << N << N << Y << N << N << Y << N << N << N << Y << N << N << N << N << N << N << N << N << N << Y << N << N << Y << Y;
+ var = QVariant((short)-3);
+ QTest::newRow("Short")
+ << var << N << N << Y << N << Y << N << N << N << N << Y << N << N << Y << N << Y << N << Y << N << N << N << N << N << N << N << N << N << Y << N << N << Y << Y;
+ var = QVariant((ushort)7);
+ QTest::newRow("UShort")
+ << var << N << N << Y << N << Y << N << N << N << N << Y << N << N << Y << N << Y << N << Y << N << N << N << N << N << N << N << N << N << Y << N << N << Y << Y;
var = QVariant::fromValue<QJsonValue>(QJsonValue(QStringLiteral("hello")));
QTest::newRow("JsonValue")
<< var << N << N << Y << N << N << N << N << N << N << Y << N << N << Y << N << N << Y << Y << Y << N << N << N << N << N << N << N << N << Y << N << N << Y << Y;
@@ -563,6 +569,8 @@ void tst_QVariant::toInt_data()
QTest::newRow( "char" ) << QVariant::fromValue('a') << int('a') << true;
signed char signedChar = -13;
QTest::newRow( "signed char" ) << QVariant::fromValue(signedChar) << -13 << true;
+ QTest::newRow( "short" ) << QVariant::fromValue(short(-7)) << int(-7) << true;
+ QTest::newRow( "ushort" ) << QVariant::fromValue(ushort(30000)) << 30000 << true;
QTest::newRow( "double" ) << QVariant( 3.1415927 ) << 3 << true;
QTest::newRow( "float" ) << QVariant( 3.1415927f ) << 3 << true;
QTest::newRow( "uint" ) << QVariant( 123u ) << 123 << true;
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
index 597d51e7e0..9df52887f7 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
@@ -992,6 +992,20 @@ void tst_QMimeDatabase::installNewGlobalMimeType()
const QString fooTestFile2 = QLatin1String(RESOURCE_PREFIX "magic-and-hierarchy2.foo");
QCOMPARE(db.mimeTypeForFile(fooTestFile2).name(), QString::fromLatin1("application/vnd.qnx.bar-descriptor"));
+ // Test if we can use the default comment
+ {
+ struct RestoreLocale
+ {
+ ~RestoreLocale() { QLocale::setDefault(QLocale::c()); }
+ } restoreLocale;
+
+ QLocale::setDefault(QLocale("zh_CN"));
+ QMimeType suseymp = db.mimeTypeForName("text/x-suse-ymp");
+ QVERIFY(suseymp.isValid());
+ QCOMPARE(suseymp.comment(),
+ QString::fromLatin1("YaST Meta Package"));
+ }
+
// Now test removing the mimetype definitions again
for (int i = 0; i < m_additionalMimeFileNames.size(); ++i)
QFile::remove(destDir + m_additionalMimeFileNames.at(i));