summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-28 01:00:17 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2019-10-28 10:50:03 +0100
commit08f90adffdde1d7a4efa0de66f69091bd52d1d4b (patch)
treeb606ee7896d4550cd3e8150a5cc6db6a03f6bd39 /tests
parentdcbe25bbbb603bc335d7cf0982a80293289b0d8f (diff)
parenta21d4395f4f9afea52b6c2da359ce6ad21ebc763 (diff)
Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts: src/corelib/serialization/qjson_p.h Change-Id: I83cea141a4de8b3998478bfded84ca9029f7a2a9
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/serialization/qdatastream_core_pixmap/tst_qdatastream_core_pixmap.cpp21
-rw-r--r--tests/auto/corelib/serialization/serialization.pro3
-rw-r--r--tests/auto/other/other.pro5
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp8
4 files changed, 21 insertions, 16 deletions
diff --git a/tests/auto/corelib/serialization/qdatastream_core_pixmap/tst_qdatastream_core_pixmap.cpp b/tests/auto/corelib/serialization/qdatastream_core_pixmap/tst_qdatastream_core_pixmap.cpp
index c931016a61..cf5ead1220 100644
--- a/tests/auto/corelib/serialization/qdatastream_core_pixmap/tst_qdatastream_core_pixmap.cpp
+++ b/tests/auto/corelib/serialization/qdatastream_core_pixmap/tst_qdatastream_core_pixmap.cpp
@@ -27,13 +27,8 @@
****************************************************************************/
#include <QtTest/QtTest>
-#include <QtGui/QBitmap>
-#include <QtGui/QPalette>
#include <QtGui/QPixmap>
-#include <QtGui/QPicture>
-#include <QtGui/QTextLength>
-#include <QtGui/QPainter>
-#include <QtGui/QPen>
+#include <QtGui/QImage>
class tst_QDataStream : public QObject
{
@@ -41,16 +36,20 @@ Q_OBJECT
private slots:
void stream_with_pixmap();
-
};
void tst_QDataStream::stream_with_pixmap()
{
// This is a QVariantMap with a 3x3 red QPixmap and two strings inside
- const QByteArray ba = QByteArray::fromBase64("AAAAAwAAAAIAegAAAAoAAAAACgB0AGgAZQByAGUAAAACAHAAAABBAAAAAAGJUE5HDQoaCgAAAA1JSERSAAAAAwAAAAMIAgAAANlKIugAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAQSURBVAiZY/zPAAVMDJgsAB1bAQXZn5ieAAAAAElFTkSuQmCCAAAAAgBhAAAACgAAAAAKAGgAZQBsAGwAbw==");
+ const QByteArray ba = QByteArray::fromBase64(
+ "AAAAAwAAAAIAegAAAAoAAAAACgB0AGgAZQByAGUAAAACAHAAAABBAAAAAAGJUE5H"
+ "DQoaCgAAAA1JSERSAAAAAwAAAAMIAgAAANlKIugAAAAJcEhZcwAADsQAAA7EAZUr"
+ "DhsAAAAQSURBVAiZY/zPAAVMDJgsAB1bAQXZn5ieAAAAAElFTkSuQmCCAAAAAgBh"
+ "AAAACgAAAAAKAGgAZQBsAGwAbw==");
QImage dummy; // Needed to make sure qtGui is loaded
- QTest::ignoreMessage(QtWarningMsg, "QPixmap::fromImageInPlace: QPixmap cannot be created without a QGuiApplication");
+ QTest::ignoreMessage(QtWarningMsg, "QPixmap::fromImageInPlace: "
+ "QPixmap cannot be created without a QGuiApplication");
QVariantMap map;
QDataStream d(ba);
@@ -58,11 +57,11 @@ void tst_QDataStream::stream_with_pixmap()
d >> map;
QCOMPARE(map["a"].toString(), QString("hello"));
- QCOMPARE(map["p"].value<QPixmap>(), QPixmap()); // the pixmap is null because this is not a QGuiApplication
+ // The pixmap is null because this is not a QGuiApplication:
+ QCOMPARE(map["p"].value<QPixmap>(), QPixmap());
QCOMPARE(map["z"].toString(), QString("there"));
}
QTEST_GUILESS_MAIN(tst_QDataStream)
#include "tst_qdatastream_core_pixmap.moc"
-
diff --git a/tests/auto/corelib/serialization/serialization.pro b/tests/auto/corelib/serialization/serialization.pro
index 9638178cdc..f4a5a3c5b1 100644
--- a/tests/auto/corelib/serialization/serialization.pro
+++ b/tests/auto/corelib/serialization/serialization.pro
@@ -11,7 +11,8 @@ SUBDIRS = \
qxmlstream
!qtHaveModule(gui): SUBDIRS -= \
- qdatastream
+ qdatastream \
+ qdatastream_core_pixmap
!qtHaveModule(network): SUBDIRS -= \
qtextstream
diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro
index c5426202e8..cc6b1887a3 100644
--- a/tests/auto/other/other.pro
+++ b/tests/auto/other/other.pro
@@ -68,7 +68,4 @@ winrt|!qtHaveModule(gui)|!qtConfig(accessibility): SUBDIRS -= qaccessibility
android: SUBDIRS += \
android
-qtConfig(xkbcommon): {
- SUBDIRS += \
- xkbkeyboard
-}
+qtHaveModule(gui):qtConfig(xkbcommon): SUBDIRS += xkbkeyboard
diff --git a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp
index 78fe448bdb..843a30df16 100644
--- a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp
@@ -156,6 +156,14 @@ void tst_QGraphicsPixmapItem::contains()
QFETCH(QPointF, point);
QFETCH(bool, contains);
+ // At the time of writing, by default pixmaps will have:
+ // - The same pixel format of the primary screen (which is platform dependent and may contain alpha)
+ // - Uninitialized pixels, potentially including an alpha channel
+ // - A ShapeMode of Mask (which mean it will use the alpha channel as a mask for contains())
+ // This means that in order to prevent undefined behavior in this test, we either need to set
+ // the shapeMode to something else, or set the pixels of the pixmap.
+ pixmap.fill(); // Filling the pixmap to be on the safe side.
+
SubQGraphicsPixmapItem item(pixmap);
QCOMPARE(item.contains(point), contains);
}