summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/painting/qpainter/tst_qpainter.cpp')
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp50
1 files changed, 49 insertions, 1 deletions
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index e4340451ce..5af5b1a269 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -282,6 +282,8 @@ private slots:
void QTBUG17053_zeroDashPattern();
+ void QTBUG38781_NoBrushAndQBitmap();
+
void drawTextOutsideGuiThread();
void drawTextWithComplexBrush();
@@ -1134,6 +1136,8 @@ void tst_QPainter::fillRect2_data()
QTest::newRow("argb32pm") << QImage::Format_ARGB32_Premultiplied;
QTest::newRow("rgba8888") << QImage::Format_RGBA8888;
QTest::newRow("rgba8888pm") << QImage::Format_RGBA8888_Premultiplied;
+ QTest::newRow("a2rgb30pm") << QImage::Format_A2RGB30_Premultiplied;
+ QTest::newRow("a2bgr30pm") << QImage::Format_A2BGR30_Premultiplied;
}
void tst_QPainter::fillRect2()
@@ -1526,6 +1530,8 @@ void tst_QPainter::qimageFormats_data()
QTest::newRow("Qimage::Format_RGB555") << QImage::Format_RGB555;
QTest::newRow("Qimage::Format_ARGB8555_Premultiplied") << QImage::Format_ARGB8555_Premultiplied;
QTest::newRow("Qimage::Format_RGB888") << QImage::Format_RGB888;
+ QTest::newRow("Qimage::Format_A2RGB30_Premultiplied") << QImage::Format_A2RGB30_Premultiplied;
+ QTest::newRow("Qimage::Format_RGB30") << QImage::Format_RGB30;
}
/*
@@ -2342,6 +2348,26 @@ void tst_QPainter::setOpacity_data()
QTest::newRow("RGB32 on RGBx8888") << QImage::Format_RGB32
<< QImage::Format_RGBX8888;
+
+ QTest::newRow("A2RGB30P on A2RGB30P") << QImage::Format_A2RGB30_Premultiplied
+ << QImage::Format_A2RGB30_Premultiplied;
+
+ QTest::newRow("ARGB32P on A2RGB30P") << QImage::Format_ARGB32_Premultiplied
+ << QImage::Format_A2RGB30_Premultiplied;
+
+
+ QTest::newRow("RGB32 on A2BGR30P") << QImage::Format_ARGB32_Premultiplied
+ << QImage::Format_A2BGR30_Premultiplied;
+
+ QTest::newRow("A2RGB30P on A2BGR30P") << QImage::Format_A2RGB30_Premultiplied
+ << QImage::Format_A2BGR30_Premultiplied;
+
+ QTest::newRow("ARGB32P on BGR30") << QImage::Format_ARGB32_Premultiplied
+ << QImage::Format_BGR30;
+
+ QTest::newRow("ARGB32P on RGB30") << QImage::Format_A2RGB30_Premultiplied
+ << QImage::Format_RGB30;
+
}
void tst_QPainter::setOpacity()
@@ -2430,7 +2456,9 @@ void tst_QPainter::drawhelper_blend_untransformed()
dest.bytesPerLine(), dest.format());
if (dest.format() == QImage::Format_ARGB8565_Premultiplied ||
- dest.format() == QImage::Format_ARGB8555_Premultiplied) {
+ dest.format() == QImage::Format_ARGB8555_Premultiplied ||
+ dest.format() == QImage::Format_A2BGR30_Premultiplied ||
+ dest.format() == QImage::Format_A2RGB30_Premultiplied ) {
// Test skipped due to rounding errors...
continue;
}
@@ -4473,6 +4501,26 @@ void tst_QPainter::QTBUG17053_zeroDashPattern()
QCOMPARE(image, original);
}
+void tst_QPainter::QTBUG38781_NoBrushAndQBitmap()
+{
+ QBitmap bitmap(10, 10);
+ bitmap.fill(Qt::color0);
+ QPainter p(&bitmap);
+ p.setPen(Qt::color1);
+ p.drawLine(0, 1, 9, 1); // at horizontal line at y=1
+ p.setBrush(Qt::NoBrush);
+ p.drawRect(0, 0, 9, 9); // a rect all around
+
+ QRgb white = qRgb(0xff, 0xff, 0xff);
+ QRgb black = qRgb(0, 0, 0);
+ QImage image = bitmap.toImage();
+ QCOMPARE(image.pixel(0, 0), black);
+ QCOMPARE(image.pixel(5, 5), white);
+
+ // Check that the rect didn't overwrite the line
+ QCOMPARE(image.pixel(5, 1), black);
+}
+
class TextDrawerThread : public QThread
{
public: