From 50d301cfdd30f13d96b95a038d618407d6c71b30 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 3 Apr 2018 11:52:41 +0200 Subject: Hide global qtlogging.ini from autotest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not let a global qtlogging.ini interfere with an autotest. This works around an issue on Ubuntu 17.10 Task-number: QTBUG-67385 Change-Id: I0d02835eb7a561b43fe0b98f4383c170c6d51303 Reviewed-by: Thiago Macieira Reviewed-by: Joni Jäntti --- tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp | 1 + tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'tests') 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"); } -- cgit v1.2.3 From f2fd5f390ce8f93778d755112d0f892758d243e2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 4 Apr 2018 10:44:20 +0200 Subject: tst_QCursor::equality(): Silence warnings Silence numerous warnings: QCursor: Cannot create bitmap cursor; invalid bitmap(s) Amends 6445aa4b064931cda36243aafc1600915fac093e. Change-Id: I7b467cdeeaa7a854c2878cf1ed2a6113d8c96059 Reviewed-by: Gabriel de Dietrich --- tests/auto/gui/kernel/qcursor/tst_qcursor.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests') 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); -- cgit v1.2.3 From 3c8181de7006cab3c2d736dfb4adabe9b2ffaf4e Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 23 Mar 2018 19:00:30 +0100 Subject: Kludge QLocale test order to fix fall-out from setDefault() This makes an irreversible global change: tests that do it will mess with other tests. So make sure they're all last. This required splitting up one test; and revealed another that secretly depended on being run with C as default locale. Task-number: QTBUG-67276 Change-Id: Ic24ef48b2c9bd5c37c1f11260b437628019624ca Reviewed-by: Kari Oikarinen --- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 38 +++++++++++++++++------- 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'tests') 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("language"); QTest::addColumn("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) -- cgit v1.2.3