From d93a4158e0758541717bb90fce30c2f78b66de34 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 3 Dec 2015 11:46:33 +0100 Subject: tst_QLocalSocket::threadedConnection(): Add failure message. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce QVERIFY2() to get some information when exactly it fails. Change-Id: Icaddf2ecae434d0bafc90c18458c5ee067dfd506 Reviewed-by: Edward Welbourne Reviewed-by: Jędrzej Nowacki --- tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index 56728432f8..d7480a4109 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -732,7 +732,10 @@ public: int done = clients; while (done > 0) { bool timedOut = true; - QVERIFY(server.waitForNewConnection(7000, &timedOut)); + QVERIFY2(server.waitForNewConnection(7000, &timedOut), + (QByteArrayLiteral("done=") + QByteArray::number(done) + + QByteArrayLiteral(", timedOut=") + + (timedOut ? "true" : "false")).constData()); QVERIFY(!timedOut); QLocalSocket *serverSocket = server.nextPendingConnection(); QVERIFY(serverSocket); -- cgit v1.2.3 From c04e7dead8bee51e11698fe1c625c76915a60753 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 3 Dec 2015 15:15:19 +0100 Subject: QImage pixelColor and setPixelColor must use unpremultiplied QColor QColor always uses unpremultiplied alpha, but the new QImage methods were based on the QRgb versions which might be either. This patches fixes the two new methods so they treat QColor alpha correctly. Change-Id: I78a5b875ad4e78ad7fde3b811c6187482b4f6d15 Reviewed-by: Gunnar Sletta --- tests/auto/gui/image/qimage/tst_qimage.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 5574a92ad9..23ddfbdd58 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -196,6 +196,8 @@ private slots: void metadataPassthrough(); + void pixelColor(); + private: const QString m_prefix; }; @@ -3020,5 +3022,21 @@ void tst_QImage::metadataPassthrough() QCOMPARE(swapped.devicePixelRatio(), a.devicePixelRatio()); } +void tst_QImage::pixelColor() +{ + QImage argb32(1, 1, QImage::Format_ARGB32); + QImage argb32pm(1, 1, QImage::Format_ARGB32_Premultiplied); + + QColor c(Qt::red); + c.setAlpha(128); + argb32.setPixelColor(QPoint(0, 0), c); + argb32pm.setPixelColor(QPoint(0, 0), c); + QCOMPARE(argb32.pixelColor(QPoint(0, 0)), c); + QCOMPARE(argb32pm.pixelColor(QPoint(0, 0)), c); + + QImage t = argb32.convertToFormat(QImage::Format_ARGB32_Premultiplied); + QCOMPARE(t.pixel(0,0), argb32pm.pixel(0,0)); +} + QTEST_GUILESS_MAIN(tst_QImage) #include "tst_qimage.moc" -- cgit v1.2.3 From 118d5dc4960e24d222f06ba7e1c6eab643a30f3e Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Mon, 23 Nov 2015 12:22:50 +0100 Subject: Skip testing empty window sizes on Windows Change-Id: Ib4f3bc63196527583a274180c40d0f7847e13f55 Reviewed-by: Friedemann Kleint --- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 97c23ddf26..ddbb4e6d75 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -4562,8 +4562,18 @@ void tst_QWidget::setWindowGeometry_data() QList windowFlags; windowFlags << 0 << Qt::FramelessWindowHint; + const bool skipEmptyRects = (m_platform == QStringLiteral("windows")); foreach (QList l, rects) { QRect rect = l.first(); + if (skipEmptyRects) { + QList::iterator it = l.begin(); + while (it != l.end()) { + if (it->isEmpty()) + it = l.erase(it); + else + ++it; + } + } foreach (int windowFlag, windowFlags) { QTest::newRow(QString("%1,%2 %3x%4, flags %5") .arg(rect.x()) @@ -4612,8 +4622,13 @@ void tst_QWidget::setWindowGeometry() widget.setGeometry(rect); widget.showNormal(); - if (rect.isValid()) + if (rect.isValid()) { QVERIFY(QTest::qWaitForWindowExposed(&widget)); + } else { + // in case of an invalid rect, wait for the geometry to become + // adjusted to the actual (valid) value. + QApplication::processEvents(); + } QTRY_COMPARE(widget.geometry(), rect); // setGeometry() while shown -- cgit v1.2.3