From 1c2499cbf141d7b07feef0b6a7ecda2b69fcc219 Mon Sep 17 00:00:00 2001 From: Herman van Hazendonk Date: Tue, 27 Feb 2018 10:36:48 +0100 Subject: Add needsWorkaround for additional Adreno targets Seems this issue is still there with Adreno 5xx and 6xx is suspected to have it as well (no device to test though), so added both 5xx and 6xx to cover these. Updated 30x to 3xx in order to cover Adreno 320 and 330 as per https://en.wikipedia.org/wiki/Adreno. Amends 9ae028f507a22bd03c861e9d14c2efc4aa2efeda Task-number: QTBUG-66702 Change-Id: I6ce3f6499d3ff9da884be45039e5f5e0990f7e1f Reviewed-by: Laszlo Agocs --- src/gui/kernel/qopenglcontext.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 6f332c8ad6..4efa5a40f3 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -1005,10 +1005,14 @@ bool QOpenGLContext::makeCurrent(QSurface *surface) || qstrcmp(rendererString, "Mali-T880") == 0 || qstrncmp(rendererString, "Adreno (TM) 2xx", 13) == 0 // Adreno 200, 203, 205 || qstrncmp(rendererString, "Adreno 2xx", 8) == 0 // Same as above but without the '(TM)' - || qstrncmp(rendererString, "Adreno (TM) 30x", 14) == 0 // Adreno 302, 305 - || qstrncmp(rendererString, "Adreno 30x", 9) == 0 // Same as above but without the '(TM)' + || qstrncmp(rendererString, "Adreno (TM) 3xx", 13) == 0 // Adreno 302, 305, 320, 330 + || qstrncmp(rendererString, "Adreno 3xx", 8) == 0 // Same as above but without the '(TM)' || qstrncmp(rendererString, "Adreno (TM) 4xx", 13) == 0 // Adreno 405, 418, 420, 430 || qstrncmp(rendererString, "Adreno 4xx", 8) == 0 // Same as above but without the '(TM)' + || qstrncmp(rendererString, "Adreno (TM) 5xx", 13) == 0 // Adreno 505, 506, 510, 530, 540 + || qstrncmp(rendererString, "Adreno 5xx", 8) == 0 // Same as above but without the '(TM)' + || qstrncmp(rendererString, "Adreno (TM) 6xx", 13) == 0 // Adreno 610, 620, 630 + || qstrncmp(rendererString, "Adreno 6xx", 8) == 0 // Same as above but without the '(TM)' || qstrcmp(rendererString, "GC800 core") == 0 || qstrcmp(rendererString, "GC1000 core") == 0 || strstr(rendererString, "GC2000") != 0 -- cgit v1.2.3 From a2ffb35ac2354735a95b21557a762aa16d7140a3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 24 Jan 2018 11:41:37 -0800 Subject: QJsonValue: use the fully-encoded form of a URL in fromVariant() For compatibility with other parsers that may expect it to be so. Change-Id: I56b444f9d6274221a3b7fffd150cd66390f98fd5 Reviewed-by: Simon Hausmann --- src/corelib/serialization/qjsonvalue.cpp | 11 +++++++++++ tests/auto/corelib/serialization/json/tst_qtjson.cpp | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/corelib/serialization/qjsonvalue.cpp b/src/corelib/serialization/qjsonvalue.cpp index 33707b6ec3..989d6d51db 100644 --- a/src/corelib/serialization/qjsonvalue.cpp +++ b/src/corelib/serialization/qjsonvalue.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -407,6 +408,14 @@ QJsonValue &QJsonValue::operator =(const QJsonValue &other) \li QMetaType::QVariantHash \endlist \li QJsonValue::Object + + \row + \li + \list + \li QMetaType::QUrl + \endlist + \li QJsonValue::String. The conversion will use QUrl::toString() with flag + QUrl::FullyEncoded, so as to ensure maximum compatibility in parsing the URL \endtable For all other QVariant types a conversion to a QString will be attempted. If the returned string @@ -439,6 +448,8 @@ QJsonValue QJsonValue::fromVariant(const QVariant &variant) case QVariant::Hash: return QJsonValue(QJsonObject::fromVariantHash(variant.toHash())); #ifndef QT_BOOTSTRAPPED + case QVariant::Url: + return QJsonValue(variant.toUrl().toString(QUrl::FullyEncoded)); case QMetaType::QJsonValue: return variant.toJsonValue(); case QMetaType::QJsonObject: diff --git a/tests/auto/corelib/serialization/json/tst_qtjson.cpp b/tests/auto/corelib/serialization/json/tst_qtjson.cpp index 1e3604ac9e..19e53ad2b6 100644 --- a/tests/auto/corelib/serialization/json/tst_qtjson.cpp +++ b/tests/auto/corelib/serialization/json/tst_qtjson.cpp @@ -82,6 +82,8 @@ private Q_SLOTS: void fromVariant_data(); void fromVariant(); + void fromVariantSpecial_data(); + void fromVariantSpecial(); void toVariant_data(); void toVariant(); void fromVariantMap(); @@ -1174,6 +1176,24 @@ void tst_QtJson::fromVariant() QCOMPARE(variant.toJsonValue(), jsonvalue); } +void tst_QtJson::fromVariantSpecial_data() +{ + QTest::addColumn("variant"); + QTest::addColumn("jsonvalue"); + + // Qt types with special encoding + QTest::newRow("url") << QVariant(QUrl("https://example.com/\xc2\xa9 ")) + << QJsonValue("https://example.com/%C2%A9%20"); +} + +void tst_QtJson::fromVariantSpecial() +{ + QFETCH( QVariant, variant ); + QFETCH( QJsonValue, jsonvalue ); + + QCOMPARE(QJsonValue::fromVariant(variant), jsonvalue); +} + void tst_QtJson::toVariant_data() { fromVariant_data(); -- cgit v1.2.3 From 4e02c8d5b89966a97703b6fe548937b9e94f7441 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 24 Jan 2018 13:31:04 -0800 Subject: JSON: remove braces from UUID text representations [ChangeLog][QtCore][QJsonValue] fromVariant() conversion now converts from QUrl and QUuid using special encoding forms to ensure best JSON compatibility. Change-Id: I56b444f9d6274221a3b7fffd150cdc5ca1f87ff1 Reviewed-by: Simon Hausmann --- src/corelib/serialization/qjsonvalue.cpp | 9 +++++++++ tests/auto/corelib/serialization/json/tst_qtjson.cpp | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/corelib/serialization/qjsonvalue.cpp b/src/corelib/serialization/qjsonvalue.cpp index 989d6d51db..b8051d6228 100644 --- a/src/corelib/serialization/qjsonvalue.cpp +++ b/src/corelib/serialization/qjsonvalue.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -416,6 +417,12 @@ QJsonValue &QJsonValue::operator =(const QJsonValue &other) \endlist \li QJsonValue::String. The conversion will use QUrl::toString() with flag QUrl::FullyEncoded, so as to ensure maximum compatibility in parsing the URL + \row + \li + \list + \li QMetaType::QUuid + \endlist + \li QJsonValue::String. Since Qt 5.11, the resulting string will not include braces \endtable For all other QVariant types a conversion to a QString will be attempted. If the returned string @@ -450,6 +457,8 @@ QJsonValue QJsonValue::fromVariant(const QVariant &variant) #ifndef QT_BOOTSTRAPPED case QVariant::Url: return QJsonValue(variant.toUrl().toString(QUrl::FullyEncoded)); + case QVariant::Uuid: + return variant.toUuid().toString(QUuid::WithoutBraces); case QMetaType::QJsonValue: return variant.toJsonValue(); case QMetaType::QJsonObject: diff --git a/tests/auto/corelib/serialization/json/tst_qtjson.cpp b/tests/auto/corelib/serialization/json/tst_qtjson.cpp index 19e53ad2b6..99bdd8deb0 100644 --- a/tests/auto/corelib/serialization/json/tst_qtjson.cpp +++ b/tests/auto/corelib/serialization/json/tst_qtjson.cpp @@ -1184,6 +1184,8 @@ void tst_QtJson::fromVariantSpecial_data() // Qt types with special encoding QTest::newRow("url") << QVariant(QUrl("https://example.com/\xc2\xa9 ")) << QJsonValue("https://example.com/%C2%A9%20"); + QTest::newRow("uuid") << QVariant(QUuid(0x40c01df6, 0x1ad5, 0x4762, 0x9c, 0xfe, 0xfd, 0xba, 0xfa, 0xb5, 0xde, 0xf8)) + << QJsonValue("40c01df6-1ad5-4762-9cfe-fdbafab5def8"); } void tst_QtJson::fromVariantSpecial() -- cgit v1.2.3 From 810bc3fb1942fa241c7ca263aec6eb53085003bf Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Wed, 28 Feb 2018 09:26:54 +0200 Subject: tst_QLibrary: Ensure installation order of testdata libs This test executable was not flaky in the normal sense that when run, it sometimes passes and sometimes fails. Instead, in some builds it would fail consistently and in some builds it would pass consistently. The first test to fail was version(ok00, default to last version) which gives "mylib" as the library name and -1 as the library version. The description implies that QLibrary selects the biggest or last used version when given -1. However, versions less than 0 are not used at all. Instead the loading uses only the name to select the library. Change the description to match. So why did the test sometimes pass, sometimes fail? The test uses two library projects lib and lib2 which install two different major versions of libmylib. That includes the symbolic links: libmylib.so -> libmylib.so.1.0.0* libmylib.so.1 -> libmylib.so.1.0.0* libmylib.so.1.0 -> libmylib.so.1.0.0* libmylib.so.1.0.0* libmylib.so -> libmylib.so.2.0.0* libmylib.so.2 -> libmylib.so.2.0.0* libmylib.so.2.0 -> libmylib.so.2.0.0* libmylib.so.2.0.0* The key thing being that both set the libmylib.so symbolic link. In a multithreaded installation it's undefined which happens to set the link last. The test code expected libmylib.so to point to libmylib.so.2.0.0. Ensure that by building and installing lib2 after lib. Task-number: QTBUG-66722 Task-number: QTBUG-66216 Change-Id: Ic513c772902273049c28e43fc1d83d550aafcd23 Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira --- tests/auto/corelib/plugin/qlibrary/qlibrary.pro | 3 +++ tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/auto/corelib/plugin/qlibrary/qlibrary.pro b/tests/auto/corelib/plugin/qlibrary/qlibrary.pro index 44f791f582..ec230601c4 100644 --- a/tests/auto/corelib/plugin/qlibrary/qlibrary.pro +++ b/tests/auto/corelib/plugin/qlibrary/qlibrary.pro @@ -2,6 +2,9 @@ QT = core TEMPLATE = subdirs tst.depends = lib lib2 +# lib2 has to be installed after lib, so that plain libmylib.so symlink points +# to version 2 as expected by the test +lib2.depends = lib SUBDIRS = lib \ lib2 \ diff --git a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp index 16177bb0b7..72d60d71c7 100644 --- a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp +++ b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp @@ -149,7 +149,7 @@ void tst_QLibrary::version_data() QTest::newRow( "ok00, version 1" ) << "mylib" << 1 << 1; QTest::newRow( "ok00, version 2" ) << "mylib" << 2 << 2; - QTest::newRow( "ok00, default to last version" ) << "mylib" << -1 << 2; + QTest::newRow( "ok00, load without version" ) << "mylib" << -1 << 2; } void tst_QLibrary::version() -- cgit v1.2.3 From d42a9d19ff1ed83bdb31a62e28a5757384e05367 Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Wed, 14 Feb 2018 16:59:52 +0200 Subject: Remove tst_QGLThreads::textureUploadInThread The test has been crashing flakily recently. 1) It is creating a QGLWidget 2) It is stealing the QGLContext of that widget and moves it into a separate thread. 3) In that secondary thread it makes the context current. 4) Meanwhile the QGLWidget itself may receive for example a resizeEvent or other events and - since it assumes that it owns the context - attempts to make it current. 5) Attempting to call makeCurrent() on a QGLContext that is in a different thread than the current thread (via QObject thread affinity) will result in a call to qFatal() and consequently the test aborts. The conclusion from Simon Hausmann is that this test is testing a pattern from Qt4 times that may or may not have worked back then. Nowadays with the Qt5 QOpenGL* API we do support this properly and there appears little sense testing this. Therefore remove the test altogether. Task-number: QTBUG-66411 Task-number: QTBUG-66216 Change-Id: Ie2d66705bc7c3914ace6abcba9557c7c67ad4db3 Reviewed-by: Laszlo Agocs --- tests/auto/opengl/qglthreads/tst_qglthreads.cpp | 133 ------------------------ tests/auto/opengl/qglthreads/tst_qglthreads.h | 1 - 2 files changed, 134 deletions(-) diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp index 90fc4e0f2a..76186f5575 100644 --- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp +++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp @@ -185,139 +185,6 @@ void tst_QGLThreads::swapInThread() QVERIFY(true); } - - - - - - -/* - textureUploadInThread - - The purpose of this testcase is to verify that doing texture uploads in a background - thread is possible and that it works. - */ - -class CreateAndUploadThread : public QThread -{ - Q_OBJECT -public: - CreateAndUploadThread(QGLWidget *shareWidget, QSemaphore *semaphore) - : m_semaphore(semaphore) - { - m_gl = new QGLWidget(0, shareWidget); - moveToThread(this); - - } - - void moveContextToThread() - { - m_gl->context()->moveToThread(this); - } - - ~CreateAndUploadThread() - { - delete m_gl; - } - - void run() { - m_gl->makeCurrent(); - QTime time; - time.start(); - while (time.elapsed() < RUNNING_TIME) { - int width = 400; - int height = 300; - QImage image(width, height, QImage::Format_RGB32); - QPainter p(&image); - p.fillRect(image.rect(), QColor(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256))); - p.setPen(Qt::red); - p.setFont(QFont("SansSerif", 24)); - p.drawText(image.rect(), Qt::AlignCenter, "This is an autotest"); - p.end(); - m_gl->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); - - m_semaphore->acquire(1); - - createdAndUploaded(image); - } - } - -signals: - void createdAndUploaded(const QImage &image); - -private: - QGLWidget *m_gl; - QSemaphore *m_semaphore; -}; - -class TextureDisplay : public QGLWidget -{ - Q_OBJECT -public: - TextureDisplay(QSemaphore *semaphore) - : m_semaphore(semaphore) - { - } - - void paintEvent(QPaintEvent *) { - QPainter p(this); - for (int i=0; ibounded(width() / 2), -QRandomGenerator::global()->bounded(height() / 2)); - - m_semaphore->release(1); - - if (m_images.size() > 100) { - m_images.takeFirst(); - m_positions.takeFirst(); - } - } - -private: - QList m_images; - QList m_positions; - - QSemaphore *m_semaphore; -}; - -void tst_QGLThreads::textureUploadInThread() -{ - if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL)) - QSKIP("No platformsupport for ThreadedOpenGL"); - - // prevent producer thread from queuing up too many images - QSemaphore semaphore(100); - TextureDisplay display(&semaphore); - CreateAndUploadThread thread(&display, &semaphore); - - connect(&thread, SIGNAL(createdAndUploaded(QImage)), &display, SLOT(receiveImage(QImage))); - - display.show(); - QVERIFY(QTest::qWaitForWindowActive(&display)); - - thread.moveContextToThread(); - thread.start(); - - while (thread.isRunning()) { - qApp->processEvents(); - } - - QVERIFY(true); -} - - - - - - /* renderInThread diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.h b/tests/auto/opengl/qglthreads/tst_qglthreads.h index 037655c60f..e4b496c163 100644 --- a/tests/auto/opengl/qglthreads/tst_qglthreads.h +++ b/tests/auto/opengl/qglthreads/tst_qglthreads.h @@ -39,7 +39,6 @@ public: private slots: void swapInThread(); - void textureUploadInThread(); void renderInThread_data(); void renderInThread(); -- cgit v1.2.3 From b03ee1262fec71b7a49df6b9bbe9e5d8d817e8e0 Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Wed, 28 Feb 2018 16:20:31 +0200 Subject: Blacklist tst_QApplication::touchEventPropagation on openSUSE Has been flaky in CI. Task-number: QTBUG-66745 Task-number: QTBUG-66216 Change-Id: I985c67dc58704a43595a0657b06b6020fc08428a Reviewed-by: Friedemann Kleint Reviewed-by: Gatis Paeglis --- tests/auto/widgets/kernel/qapplication/BLACKLIST | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tests/auto/widgets/kernel/qapplication/BLACKLIST diff --git a/tests/auto/widgets/kernel/qapplication/BLACKLIST b/tests/auto/widgets/kernel/qapplication/BLACKLIST new file mode 100644 index 0000000000..ca0efdff8a --- /dev/null +++ b/tests/auto/widgets/kernel/qapplication/BLACKLIST @@ -0,0 +1,3 @@ +[touchEventPropagation] +# QTBUG-66745 +opensuse -- cgit v1.2.3 From d8b143d4b77c45cfe1a40d525be5d0a79a2b07a4 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 26 Feb 2018 17:46:00 +0100 Subject: qstringapisymmetry: Fix XML parsing failing on invalid encodings Evaluating testlib's XML output in COIN would fail with: "XML syntax error on line 7520: invalid UTF-8" for the toLatin1() tests due to some Latin1/UTF8 mixup. Add a helper function to convert the data to plain ASCII. Task-number: QTQAINFRA-1797 Change-Id: I1c64878d4c2a67b8c2689905b5ffe6707b5963c1 Reviewed-by: Thiago Macieira --- .../qstringapisymmetry/tst_qstringapisymmetry.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp index 61d1f86f00..cb1fd9eb7d 100644 --- a/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp +++ b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -70,6 +71,19 @@ MAKE_ALL(const char*, QChar) #undef MAKE_RELOP // END FIXME +// Return a plain ASCII row name consisting of maximum 16 chars and the +// size for data +static QByteArray rowName(const QByteArray &data) +{ + const int size = data.size(); + QScopedArrayPointer prettyC(QTest::toPrettyCString(data.constData(), qMin(16, size))); + QByteArray result = prettyC.data(); + result += " ("; + result += QByteArray::number(size); + result += ')'; + return result; +} + class tst_QStringApiSymmetry : public QObject { Q_OBJECT @@ -1072,7 +1086,7 @@ void tst_QStringApiSymmetry::toLocal8Bit_data() QString s; for (char c : ba) s += QLatin1Char(c); - QTest::addRow("\"%s\" (%d)", ba.left(16).constData(), ba.size()) << s << ba; + QTest::newRow(rowName(ba).constData()) << s << ba; }; QTest::addRow("null") << QString() << QByteArray(); @@ -1107,7 +1121,7 @@ void tst_QStringApiSymmetry::toLatin1_data() QString s; for (char c : ba) s += QLatin1Char(c); - QTest::addRow("\"%s\" (%d)", ba.left(16).constData(), ba.size()) << s << ba; + QTest::newRow(rowName(ba).constData()) << s << ba; }; QTest::addRow("null") << QString() << QByteArray(); @@ -1140,7 +1154,7 @@ void tst_QStringApiSymmetry::toUtf8_data() auto add = [](const char *u8) { QByteArray ba(u8); QString s = ba; - QTest::addRow("\"%s\" (%d)", ba.left(16).constData(), ba.size()) << s << ba; + QTest::newRow(rowName(ba).constData()) << s << ba; }; QTest::addRow("null") << QString() << QByteArray(); @@ -1178,7 +1192,7 @@ void tst_QStringApiSymmetry::toUcs4_data() s += QLatin1Char(c); ucs4.append(uint(uchar(c))); } - QTest::addRow("\"%s\" (%d)", ba.left(16).constData(), ba.size()) << s << ucs4; + QTest::newRow(rowName(ba).constData()) << s << ucs4; }; QTest::addRow("null") << QString() << QVector(); -- cgit v1.2.3 From ccdcf8c4f2f207e1f8468a6ae9ec505fb23e7296 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 28 Feb 2018 10:35:19 +0100 Subject: Android: Close the DataOutputStream when we are finished with it Task-number: QTBUG-66769 Change-Id: I93c49baa0ccab4f853402d9be675af1c50b2e0c1 Reviewed-by: Christian Stromme --- .../jar/src/org/qtproject/qt5/android/QtActivityDelegate.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index 6b8577116e..fa7508921d 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -677,12 +677,13 @@ public class QtActivityDelegate final int timeOut = 30000; // ms until we give up on ping and pong final int maxAttempts = timeOut / napTime; + DataOutputStream outToClient = null; try { LocalSocket connectionFromClient = socket.accept(); debugLog("Debug socket accepted"); BufferedReader inFromClient = new BufferedReader(new InputStreamReader(connectionFromClient.getInputStream())); - DataOutputStream outToClient = new DataOutputStream(connectionFromClient.getOutputStream()); + outToClient = new DataOutputStream(connectionFromClient.getOutputStream()); outToClient.writeBytes("" + android.os.Process.myPid()); for (int i = 0; i < maxAttempts; i++) { @@ -704,6 +705,11 @@ public class QtActivityDelegate } catch (InterruptedException interruptEx) { wasFailure = true; Log.e(QtNative.QtTAG,"Can't start debugger" + interruptEx.getMessage()); + } finally { + try { + if (outToClient != null) + outToClient.close(); + } catch (IOException ignored) { } } } -- cgit v1.2.3 From dcc16166ef22349d2e9b00c23868cab1b52951ed Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 1 Mar 2018 10:13:26 +0100 Subject: QTestlib/selftests: Fix failures due to logging system output Silence debug output by setting QT_LOGGING_RULES to turn off all debug output. Task-number: QTQAINFRA-1631 Change-Id: I5c2366b4fe4bac341dcfd92f68b6da8071c5b089 Reviewed-by: Mitch Curtis --- tests/auto/testlib/selftests/tst_selftests.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 2ef7258d81..93d5daa160 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -404,6 +404,7 @@ tst_Selftests::tst_Selftests() void tst_Selftests::initTestCase() { QVERIFY2(tempDir.isValid(), qPrintable(tempDir.errorString())); + qputenv("QT_LOGGING_RULES", QByteArrayLiteral("*.debug=false")); // Silence any debug output //Detect the location of the sub programs QString subProgram = QLatin1String("float/float"); #if defined(Q_OS_WIN) -- cgit v1.2.3 From fdddb3a4814f588e3ee87a6c1a0a6791f6ef0298 Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Fri, 2 Mar 2018 09:41:01 +0200 Subject: Blacklist tst_QWindow::testInputEvents on Windows Multiple recent failures on Windows 10. Task-number: QTBUG-66798 Task-number: QTBUG-66216 Change-Id: I9d23d0381dbe62eb5469863f14e1a05548ce7dfa Reviewed-by: Friedemann Kleint Reviewed-by: Frederik Gladhorn --- tests/auto/gui/kernel/qwindow/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST index 05cf1b5a30..5e44747190 100644 --- a/tests/auto/gui/kernel/qwindow/BLACKLIST +++ b/tests/auto/gui/kernel/qwindow/BLACKLIST @@ -21,3 +21,5 @@ osx-10.12 ci [testInputEvents] rhel-7.4 +# QTBUG-66798 +windows -- cgit v1.2.3 From 78e92997ed35ddc8bb6f7f6c0a4fffba026d5d8f Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Tue, 2 Jan 2018 10:48:34 +0100 Subject: QLocale: Update the system private on QLocale default constructor if needed When first starting an Android app we have invocation order issue, to load the platform plugin we create the default QLocale (needed by the resource locator code to see if :/qt/etc/qt.conf exists) so when the android platform plugin loads and creates its own QSystemLocale, the QLocale defaultLocalePrivate is already created and pointing to globalLocaleData which means that systemData won't be called and thus the code that triggers the call to QLocalePrivate::updateSystemPrivate won't be called when calling QLocale(). I thought of two ways of fixing this, one was calling QLocalePrivate::updateSystemPrivatea() from the QAndroidSystemLocale constructor, but giving the responsibility to not break things to the plugin seems a little fragile, so making the check on QLocale() seems better. Without this patch an Android app doing QApplication app(argc, argv); qDebug() << QLocale().name(); qDebug() << QLocale().name(); qDebug() << QLocale::system().name(); qDebug() << QLocale().name(); would print "" "" "ca_ES" "ca_ES" now it correctly prints "ca_ES" the four times. Task-number: QTBUG-41385 Change-Id: I2cf419f59aa008fa3aca11295fe7d42c40bcc32e Reviewed-by: Thiago Macieira Reviewed-by: Edward Welbourne --- src/corelib/tools/qlocale.cpp | 2 ++ tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 46 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index f7a6f35183..09b148ea9e 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -852,6 +852,8 @@ QLocale::QLocale(const QString &name) QLocale::QLocale() : d(*defaultLocalePrivate) { + // Make sure system data is up to date + systemData(); } /*! diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index fc1ac7cf0f..d5e2935d28 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -141,6 +141,8 @@ private slots: void formattedDataSize(); void bcp47Name(); + void systemLocale(); + private: QString m_decimal, m_thousand, m_sdate, m_ldate, m_time; QString m_sysapp; @@ -2641,5 +2643,49 @@ void tst_QLocale::bcp47Name() QCOMPARE(QLocale("sr_Latn_HR").bcp47Name(), QStringLiteral("sr-Latn")); } +class MySystemLocale : public QSystemLocale +{ +public: + MySystemLocale(const QLocale &locale) : m_locale(locale) + { + } + + QVariant query(QueryType /*type*/, QVariant /*in*/) const override + { + return QVariant(); + } + + QLocale fallbackUiLocale() const override + { + return m_locale; + } + +private: + const QLocale m_locale; +}; + +void tst_QLocale::systemLocale() +{ + QLocale originalLocale; + + MySystemLocale *sLocale = new MySystemLocale(QLocale("uk")); + QCOMPARE(QLocale().language(), QLocale::Ukrainian); + QCOMPARE(QLocale::system().language(), QLocale::Ukrainian); + delete sLocale; + + sLocale = new MySystemLocale(QLocale("ca")); + QCOMPARE(QLocale().language(), QLocale::Catalan); + QCOMPARE(QLocale::system().language(), QLocale::Catalan); + delete sLocale; + + sLocale = new MySystemLocale(QLocale("de")); + QCOMPARE(QLocale().language(), QLocale::German); + QCOMPARE(QLocale::system().language(), QLocale::German); + delete sLocale; + + QCOMPARE(QLocale(), originalLocale); + QCOMPARE(QLocale::system(), originalLocale); +} + QTEST_MAIN(tst_QLocale) #include "tst_qlocale.moc" -- cgit v1.2.3