diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-01-15 12:25:41 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-01-15 12:25:41 (GMT) |
commit | 4e568e32ccfc758caa302ca1e785f2208073c991 (patch) | |
tree | 15f462dc92863bc901df82282d480961fbbd0293 /tests/auto/qstatictext | |
parent | 629b565a697911904558ad0127a240a535489787 (diff) | |
download | Qt-4e568e32ccfc758caa302ca1e785f2208073c991.zip Qt-4e568e32ccfc758caa302ca1e785f2208073c991.tar.gz Qt-4e568e32ccfc758caa302ca1e785f2208073c991.tar.bz2 |
Test current graphics system + initialize memory
Using QImage would only let us test the raster engine. Substitute
QPixmap, so we can test different graphics systems. Also initialize the
memory in the pixmaps (this was missed because memory is initialized by
default in debug builds.)
Diffstat (limited to 'tests/auto/qstatictext')
-rw-r--r-- | tests/auto/qstatictext/tst_qstatictext.cpp | 67 |
1 files changed, 44 insertions, 23 deletions
diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp index c41b34b1..adc9593 100644 --- a/tests/auto/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/qstatictext/tst_qstatictext.cpp @@ -86,13 +86,15 @@ void tst_QStaticText::constructionAndDestruction() void tst_QStaticText::drawToPoint() { - QImage imageDrawText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawText(1000, 1000); + imageDrawText.fill(Qt::white); { QPainter p(&imageDrawText); p.drawText(11, 12, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); } - QImage imageDrawStaticText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawStaticText(1000, 1000); + imageDrawStaticText.fill(Qt::white); { QPainter p(&imageDrawStaticText); QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); @@ -104,13 +106,15 @@ void tst_QStaticText::drawToPoint() void tst_QStaticText::drawToRect() { - QImage imageDrawText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawText(1000, 1000); + imageDrawText.fill(Qt::white); { QPainter p(&imageDrawText); p.drawText(QRectF(11, 12, 10, 500), "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); } - QImage imageDrawStaticText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawStaticText(1000, 1000); + imageDrawStaticText.fill(Qt::white); { QPainter p(&imageDrawStaticText); QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.", QSizeF(10, 500)); @@ -126,14 +130,16 @@ void tst_QStaticText::prepareToCorrectData() transform.scale(2.0, 2.0); transform.rotate(90, Qt::ZAxis); - QImage imageDrawText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawText(1000, 1000); + imageDrawText.fill(Qt::white); { QPainter p(&imageDrawText); p.setTransform(transform); p.drawText(11, 12, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); } - QImage imageDrawStaticText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawStaticText(1000, 1000); + imageDrawStaticText.fill(Qt::white); { QPainter p(&imageDrawStaticText); p.setTransform(transform); @@ -151,13 +157,15 @@ void tst_QStaticText::prepareToWrongData() transform.scale(2.0, 2.0); transform.rotate(90, Qt::ZAxis); - QImage imageDrawText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawText(1000, 1000); + imageDrawText.fill(Qt::white); { QPainter p(&imageDrawText); p.drawText(11, 12, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); } - QImage imageDrawStaticText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawStaticText(1000, 1000); + imageDrawStaticText.fill(Qt::white); { QPainter p(&imageDrawStaticText); QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); @@ -175,7 +183,8 @@ void tst_QStaticText::setFont() font.setBold(true); font.setPointSize(28); - QImage imageDrawText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawText(1000, 1000); + imageDrawText.fill(Qt::white); { QPainter p(&imageDrawText); p.drawText(0, 0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); @@ -184,7 +193,8 @@ void tst_QStaticText::setFont() p.drawText(11, 120, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); } - QImage imageDrawStaticText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawStaticText(1000, 1000); + imageDrawStaticText.fill(Qt::white); { QPainter p(&imageDrawStaticText); @@ -201,13 +211,15 @@ void tst_QStaticText::setFont() void tst_QStaticText::setMaximumSize() { - QImage imageDrawText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawText(1000, 1000); + imageDrawText.fill(Qt::white); { QPainter p(&imageDrawText); p.drawText(QRectF(11, 12, 10, 500), "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); } - QImage imageDrawStaticText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawStaticText(1000, 1000); + imageDrawStaticText.fill(Qt::white); { QPainter p(&imageDrawStaticText); QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); @@ -220,7 +232,8 @@ void tst_QStaticText::setMaximumSize() void tst_QStaticText::translatedPainter() { - QImage imageDrawText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawText(1000, 1000); + imageDrawText.fill(Qt::white); { QPainter p(&imageDrawText); p.translate(100, 200); @@ -228,7 +241,8 @@ void tst_QStaticText::translatedPainter() p.drawText(11, 12, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); } - QImage imageDrawStaticText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawStaticText(1000, 1000); + imageDrawStaticText.fill(Qt::white); { QPainter p(&imageDrawStaticText); p.translate(100, 200); @@ -242,14 +256,16 @@ void tst_QStaticText::translatedPainter() void tst_QStaticText::rotatedPainter() { - QImage imageDrawText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawText(1000, 1000); + imageDrawText.fill(Qt::white); { QPainter p(&imageDrawText); p.rotate(30.0); p.drawText(0, 0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); } - QImage imageDrawStaticText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawStaticText(1000, 1000); + imageDrawStaticText.fill(Qt::white); { QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); @@ -268,7 +284,8 @@ void tst_QStaticText::rotatedPainter() void tst_QStaticText::scaledPainter() { - QImage imageDrawText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawText(1000, 1000); + imageDrawText.fill(Qt::white); { QPainter p(&imageDrawText); p.scale(2.0, 0.2); @@ -276,7 +293,8 @@ void tst_QStaticText::scaledPainter() p.drawText(11, 12, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); } - QImage imageDrawStaticText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawStaticText(1000, 1000); + imageDrawStaticText.fill(Qt::white); { QPainter p(&imageDrawStaticText); p.scale(2.0, 0.2); @@ -290,7 +308,8 @@ void tst_QStaticText::scaledPainter() void tst_QStaticText::rotatedScaledAndTranslatedPainter() { - QImage imageDrawText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawText(1000, 1000); + imageDrawText.fill(Qt::white); { QPainter p(&imageDrawText); p.rotate(45.0); @@ -300,7 +319,8 @@ void tst_QStaticText::rotatedScaledAndTranslatedPainter() p.drawText(11, 12, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); } - QImage imageDrawStaticText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawStaticText(1000, 1000); + imageDrawStaticText.fill(Qt::white); { QPainter p(&imageDrawStaticText); p.rotate(45.0); @@ -316,8 +336,8 @@ void tst_QStaticText::rotatedScaledAndTranslatedPainter() void tst_QStaticText::transformationChanged() { - QImage imageDrawText(1000, 1000, QImage::Format_ARGB32_Premultiplied); - + QPixmap imageDrawText(1000, 1000); + imageDrawText.fill(Qt::white); { QPainter p(&imageDrawText); p.rotate(33.0); @@ -329,7 +349,8 @@ void tst_QStaticText::transformationChanged() p.drawText(0, 0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); } - QImage imageDrawStaticText(1000, 1000, QImage::Format_ARGB32_Premultiplied); + QPixmap imageDrawStaticText(1000, 1000); + imageDrawStaticText.fill(Qt::white); { QPainter p(&imageDrawStaticText); p.rotate(33.0); |