diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-04-06 09:32:13 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-04-06 09:32:13 +0200 |
commit | 1a464f35d19fbf6a5cbe93b2a2d52f2f44465913 (patch) | |
tree | 7306fbbb50429d66cf4d3d08e60e7310431b9f85 /tests/auto | |
parent | 061fbceb777c41b23bc2b8180b2af85d9b35b246 (diff) | |
parent | b6f7230cda02d9b11b309816ca1e41dbd2716fe0 (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: Ic811cd444e523b904211797112bba6aaec85dddd
Diffstat (limited to 'tests/auto')
4 files changed, 33 insertions, 10 deletions
diff --git a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp index 571288675e..11a9b3f189 100644 --- a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp +++ b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp @@ -203,6 +203,7 @@ private: private slots: void initTestCase() { + qputenv("XDG_CONFIG_DIRS", "/does/not/exist"); qputenv("QT_MESSAGE_PATTERN", QByteArray("%{category}: %{type},%{message}")); oldMessageHandler = qInstallMessageHandler(myCustomMessageHandler); // Create configuration diff --git a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp index a74ea3a89e..5b61a6007d 100644 --- a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp +++ b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp @@ -50,6 +50,7 @@ private slots: { // ensure a clean environment QStandardPaths::setTestModeEnabled(true); + qputenv("XDG_CONFIG_DIRS", "/does/not/exist"); qunsetenv("QT_LOGGING_CONF"); qunsetenv("QT_LOGGING_RULES"); } diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index d5e2935d28..c6c16a5982 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -79,9 +79,7 @@ private slots: void ctor(); void emptyCtor(); - void legacyNames(); void consistentC(); - void unixLocaleName(); void matchingLocales(); void stringToDouble_data(); void stringToDouble(); @@ -108,8 +106,6 @@ private slots: void toDateTime(); void negativeNumbers(); void numberOptions(); - void testNames_data(); - void testNames(); void dayName_data(); void dayName(); void standaloneDayName_data(); @@ -143,6 +139,15 @@ private slots: void systemLocale(); + // *** ORDER-DEPENDENCY *** (This Is Bad.) + // Test order is determined by order of declaration here: *all* tests that + // QLocale::setDefault() *must* appear *after* all other tests ! + void defaulted_ctor(); // This one must be the first of these. + void legacyNames(); + void unixLocaleName(); + void testNames_data(); + void testNames(); + // DO NOT add tests here unless they QLocale::setDefault(); see above. private: QString m_decimal, m_thousand, m_sdate, m_ldate, m_time; QString m_sysapp; @@ -232,6 +237,23 @@ void tst_QLocale::ctor() TEST_CTOR(Chinese, LatinScript, UnitedStates, QLocale::Chinese, QLocale::SimplifiedHanScript, QLocale::China); #undef TEST_CTOR +} + +void tst_QLocale::defaulted_ctor() +{ + QLocale default_locale = QLocale::system(); + QLocale::Language default_lang = default_locale.language(); + QLocale::Country default_country = default_locale.country(); + + qDebug("Default: %s/%s", QLocale::languageToString(default_lang).toLatin1().constData(), + QLocale::countryToString(default_country).toLatin1().constData()); + + { + QLocale l(QLocale::C, QLocale::AnyCountry); + QCOMPARE(l.language(), QLocale::C); + QCOMPARE(l.country(), QLocale::AnyCountry); + } + #define TEST_CTOR(req_lang, req_country, exp_lang, exp_country) \ { \ QLocale l(QLocale::req_lang, QLocale::req_country); \ @@ -239,11 +261,6 @@ void tst_QLocale::ctor() QCOMPARE((int)l.country(), (int)exp_country); \ } - { - QLocale l(QLocale::C, QLocale::AnyCountry); - QCOMPARE(l.language(), QLocale::C); - QCOMPARE(l.country(), QLocale::AnyCountry); - } TEST_CTOR(AnyLanguage, AnyCountry, default_lang, default_country) TEST_CTOR(C, AnyCountry, QLocale::C, QLocale::AnyCountry) TEST_CTOR(Aymara, AnyCountry, default_lang, default_country) @@ -1961,10 +1978,11 @@ void tst_QLocale::testNames_data() QTest::addColumn<int>("language"); QTest::addColumn<int>("country"); + QLocale::setDefault(QLocale(QLocale::C)); // Ensures predictable fall-backs + for (int i = 0; i < locale_data_count; ++i) { const QLocaleData &item = locale_data[i]; - const QString testName = QLatin1String("data_") + QString::number(i) + QLatin1String(" (") + QLocale::languageToString((QLocale::Language)item.m_language_id) + QLatin1Char('/') + QLocale::countryToString((QLocale::Country)item.m_country_id) diff --git a/tests/auto/gui/kernel/qcursor/tst_qcursor.cpp b/tests/auto/gui/kernel/qcursor/tst_qcursor.cpp index d505f5a655..eb33cce95b 100644 --- a/tests/auto/gui/kernel/qcursor/tst_qcursor.cpp +++ b/tests/auto/gui/kernel/qcursor/tst_qcursor.cpp @@ -93,6 +93,9 @@ void tst_QCursor::equality() VERIFY_DIFFERENT(bitmapCursor, pixmapCursor); // Empty pixmap + for (int i = 0; i < 18; ++i) + QTest::ignoreMessage(QtWarningMsg, "QCursor: Cannot create bitmap cursor; invalid bitmap(s)"); + QPixmap emptyPixmap; QCursor emptyPixmapCursor(emptyPixmap); QCOMPARE(emptyPixmapCursor.shape(), Qt::ArrowCursor); |