summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/image
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/image')
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp22
-rw-r--r--tests/auto/gui/image/qimagereader/images/rgb32bf.bmpbin0 -> 32578 bytes
-rw-r--r--tests/auto/gui/image/qimagereader/qimagereader.qrc1
-rw-r--r--tests/auto/gui/image/qimagereader/tst_qimagereader.cpp1
-rw-r--r--tests/auto/gui/image/qpixmap/tst_qpixmap.cpp15
5 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 6f372b0160..b668f57909 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -86,6 +86,7 @@ private slots:
#endif
void dotsPerMeterZero();
+ void dotsPerMeterAndDpi();
void convertToFormatPreserveDotsPrMeter();
void convertToFormatPreserveText();
@@ -899,6 +900,27 @@ void tst_QImage::dotsPerMeterZero()
QCOMPARE(img.dotsPerMeterX(), defaultDpmX);
QCOMPARE(img.dotsPerMeterY(), defaultDpmY);
+
+}
+
+// verify that setting dotsPerMeter has an effect on the dpi.
+void tst_QImage::dotsPerMeterAndDpi()
+{
+ QImage img(100, 100, QImage::Format_RGB32);
+ QVERIFY(!img.isNull());
+
+ QPoint defaultLogicalDpi(img.logicalDpiX(), img.logicalDpiY());
+ QPoint defaultPhysicalDpi(img.physicalDpiX(), img.physicalDpiY());
+
+ img.setDotsPerMeterX(100); // set x
+ QCOMPARE(img.logicalDpiY(), defaultLogicalDpi.y()); // no effect on y
+ QCOMPARE(img.physicalDpiY(), defaultPhysicalDpi.y());
+ QVERIFY(img.logicalDpiX() != defaultLogicalDpi.x()); // x changed
+ QVERIFY(img.physicalDpiX() != defaultPhysicalDpi.x());
+
+ img.setDotsPerMeterY(200); // set y
+ QVERIFY(img.logicalDpiY() != defaultLogicalDpi.y()); // y changed
+ QVERIFY(img.physicalDpiY() != defaultPhysicalDpi.y());
}
void tst_QImage::rotate_data()
diff --git a/tests/auto/gui/image/qimagereader/images/rgb32bf.bmp b/tests/auto/gui/image/qimagereader/images/rgb32bf.bmp
new file mode 100644
index 0000000000..20fa9a1326
--- /dev/null
+++ b/tests/auto/gui/image/qimagereader/images/rgb32bf.bmp
Binary files differ
diff --git a/tests/auto/gui/image/qimagereader/qimagereader.qrc b/tests/auto/gui/image/qimagereader/qimagereader.qrc
index 7eb70c866c..2522154b1f 100644
--- a/tests/auto/gui/image/qimagereader/qimagereader.qrc
+++ b/tests/auto/gui/image/qimagereader/qimagereader.qrc
@@ -34,6 +34,7 @@
<file>images/noclearcode.bmp</file>
<file>images/noclearcode.gif</file>
<file>images/nontransparent.xpm</file>
+ <file>images/rgb32bf.bmp</file>
<file>images/runners.ppm</file>
<file>images/teapot.ppm</file>
<file>images/test.ppm</file>
diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
index bd11089a82..b684231e10 100644
--- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
@@ -223,6 +223,7 @@ void tst_QImageReader::readImage_data()
QTest::newRow("BMP: 4bpp uncompressed") << QString("tst7.bmp") << true << QByteArray("bmp");
QTest::newRow("BMP: 16bpp") << QString("16bpp.bmp") << true << QByteArray("bmp");
QTest::newRow("BMP: negative height") << QString("negativeheight.bmp") << true << QByteArray("bmp");
+ QTest::newRow("BMP: high mask bit set") << QString("rgb32bf.bmp") << true << QByteArray("bmp");
QTest::newRow("XPM: marble") << QString("marble.xpm") << true << QByteArray("xpm");
QTest::newRow("PNG: kollada") << QString("kollada.png") << true << QByteArray("png");
QTest::newRow("PPM: teapot") << QString("teapot.ppm") << true << QByteArray("ppm");
diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
index dce6c3dbae..b9b61425da 100644
--- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
@@ -167,6 +167,7 @@ private slots:
void loadAsBitmapOrPixmap();
void scaled_QTBUG19157();
+ void detachOnLoad_QTBUG29639();
};
static bool lenientCompare(const QPixmap &actual, const QPixmap &expected)
@@ -1511,5 +1512,19 @@ void tst_QPixmap::scaled_QTBUG19157()
QVERIFY(!foo.isNull());
}
+void tst_QPixmap::detachOnLoad_QTBUG29639()
+{
+ const QString prefix = QFINDTESTDATA("convertFromImage");
+
+ QPixmap a;
+ a.load(prefix + "/task31722_0/img1.png");
+ a.load(prefix + "/task31722_0/img2.png");
+
+ QPixmap b;
+ b.load(prefix + "/task31722_0/img1.png");
+
+ QVERIFY(a.toImage() != b.toImage());
+}
+
QTEST_MAIN(tst_QPixmap)
#include "tst_qpixmap.moc"