summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui')
-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
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp6
-rw-r--r--tests/auto/gui/text/qcssparser/tst_qcssparser.cpp2
7 files changed, 45 insertions, 2 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"
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index 26301f712e..02f8584f72 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -175,9 +175,13 @@ void tst_QWindow::positioning()
// Some platforms enforce minimum widths for windows, which can cause extra resize
// events, so set the width to suitably large value to avoid those.
- QRect geometry(80, 80, 300, 40);
+ const QSize size = QSize(300, 40);
+ const QRect geometry(QPoint(80, 80), size);
Window window;
+ window.setGeometry(QRect(QPoint(20, 20), size));
+ window.setFramePosition(QPoint(40, 40)); // Move window around before show, size must not change.
+ QCOMPARE(window.geometry().size(), size);
window.setGeometry(geometry);
QCOMPARE(window.geometry(), geometry);
window.show();
diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
index 31113daf31..ca6c42c9bd 100644
--- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
+++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
@@ -1489,7 +1489,7 @@ void tst_QCssParser::gradient_data()
"spread: repeat, stop:0.2 rgb(1, 2, 3), stop:0.5 rgba(1, 2, 3, 4))" << "conical" << QPointF(4, 2) << QPointF()
<< 2 << qreal(0.2) << QColor(1, 2, 3) << qreal(0.5) << QColor(1, 2, 3, 4);
- /* wont pass: stop values are expected to be sorted
+ /* won't pass: stop values are expected to be sorted
QTest::newRow("unsorted-stop") <<
"selection-background: lineargradient(x1:0, y1:0, x2:0, y2:1, "
"stop:0.5 green, stop:0.2 red)" << QPointF(0, 0) << QPointF(0, 1)