summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2009-11-06 11:59:24 (GMT)
committerGunnar Sletta <gunnar@trolltech.com>2009-11-06 11:59:24 (GMT)
commite9296e1ffa476e18e12dd526e2e80e9850db0e71 (patch)
tree91491e89e34ccb7ac8c319df9b5c12b99b2ee77b /tests
parent00d078d947fd045d2aaf4f22afd4df180696cfac (diff)
parent9b500e9a09907f05002bd0e57869c5312ae101db (diff)
downloadQt-e9296e1ffa476e18e12dd526e2e80e9850db0e71.zip
Qt-e9296e1ffa476e18e12dd526e2e80e9850db0e71.tar.gz
Qt-e9296e1ffa476e18e12dd526e2e80e9850db0e71.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt-graphics-team into 4.6
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index bcdbe56..4d2c626 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -239,9 +239,12 @@ private slots:
void taskQT4444_dontOverflowDashOffset();
void painterBegin();
+ void setPenColorOnImage();
+ void setPenColorOnPixmap();
private:
void fillData();
+ void setPenColor(QPainter& p);
QColor baseColor( int k, int intensity=255 );
QImage getResImage( const QString &dir, const QString &addition, const QString &extension );
QBitmap getBitmap( const QString &dir, const QString &filename, bool mask );
@@ -4352,5 +4355,41 @@ void tst_QPainter::painterBegin()
QVERIFY(!p.end());
}
+void tst_QPainter::setPenColor(QPainter& p)
+{
+ p.setPen(Qt::NoPen);
+
+ // Setting color, then style
+ // Should work even though the pen is "NoPen with color", temporarily.
+ QPen newPen(p.pen());
+ newPen.setColor(Qt::red);
+ QCOMPARE(p.pen().style(), newPen.style());
+ QCOMPARE(p.pen().style(), Qt::NoPen);
+ p.setPen(newPen);
+
+ QCOMPARE(p.pen().color().name(), QString("#ff0000"));
+
+ QPen newPen2(p.pen());
+ newPen2.setStyle(Qt::SolidLine);
+ p.setPen(newPen2);
+
+ QCOMPARE(p.pen().color().name(), QString("#ff0000"));
+}
+
+void tst_QPainter::setPenColorOnImage()
+{
+ QImage img(QSize(10, 10), QImage::Format_ARGB32_Premultiplied);
+ QPainter p(&img);
+ setPenColor(p);
+}
+
+void tst_QPainter::setPenColorOnPixmap()
+{
+ QPixmap pix(10, 10);
+ QPainter p(&pix);
+ setPenColor(p);
+}
+
QTEST_MAIN(tst_QPainter)
+
#include "tst_qpainter.moc"