Merge remote-tracking branch 'origin/5.11' into dev

Change-Id: I967eca8f34584fca3a1e5696978e70f620582a2a
This commit is contained in:
Qt Forward Merge Bot 2018-03-02 14:40:07 +01:00
commit 8c04a5e964
14 changed files with 131 additions and 142 deletions

View File

@ -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) { }
}
}

View File

@ -40,6 +40,8 @@
#include <qjsonobject.h>
#include <qjsonvalue.h>
#include <qjsonarray.h>
#include <qurl.h>
#include <quuid.h>
#include <qvariant.h>
#include <qstringlist.h>
#include <qdebug.h>
@ -407,6 +409,20 @@ 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
\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
@ -439,6 +455,10 @@ 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 QVariant::Uuid:
return variant.toUuid().toString(QUuid::WithoutBraces);
case QMetaType::QJsonValue:
return variant.toJsonValue();
case QMetaType::QJsonObject:

View File

@ -852,6 +852,8 @@ QLocale::QLocale(const QString &name)
QLocale::QLocale()
: d(*defaultLocalePrivate)
{
// Make sure system data is up to date
systemData();
}
/*!

View File

@ -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

View File

@ -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 \

View File

@ -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()

View File

@ -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,26 @@ void tst_QtJson::fromVariant()
QCOMPARE(variant.toJsonValue(), jsonvalue);
}
void tst_QtJson::fromVariantSpecial_data()
{
QTest::addColumn<QVariant>("variant");
QTest::addColumn<QJsonValue>("jsonvalue");
// 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()
{
QFETCH( QVariant, variant );
QFETCH( QJsonValue, jsonvalue );
QCOMPARE(QJsonValue::fromVariant(variant), jsonvalue);
}
void tst_QtJson::toVariant_data()
{
fromVariant_data();

View File

@ -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"

View File

@ -33,6 +33,7 @@
#include <QString>
#include <QStringView>
#include <QChar>
#include <QScopedArrayPointer>
#include <QStringRef>
#include <QLatin1String>
#include <QVector>
@ -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<char> 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<uint>();

View File

@ -21,3 +21,5 @@ osx-10.12 ci
[testInputEvents]
rhel-7.4
# QTBUG-66798
windows

View File

@ -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; i<m_images.size(); ++i) {
p.drawImage(m_positions.at(i), m_images.at(i));
m_positions[i] += QPoint(1, 1);
}
update();
}
public slots:
void receiveImage(const QImage &image) {
m_images << image;
m_positions << QPoint(-QRandomGenerator::global()->bounded(width() / 2), -QRandomGenerator::global()->bounded(height() / 2));
m_semaphore->release(1);
if (m_images.size() > 100) {
m_images.takeFirst();
m_positions.takeFirst();
}
}
private:
QList <QImage> m_images;
QList <QPoint> 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

View File

@ -39,7 +39,6 @@ public:
private slots:
void swapInThread();
void textureUploadInThread();
void renderInThread_data();
void renderInThread();

View File

@ -400,6 +400,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)

View File

@ -0,0 +1,3 @@
[touchEventPropagation]
# QTBUG-66745
opensuse