summaryrefslogtreecommitdiffstats
path: root/tests/auto/qstatictext
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-02-01 15:07:59 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-02-01 15:07:59 (GMT)
commit4012ff8d08e5d6be738db88eda30dbe20d45c58a (patch)
tree727af8980543567cdbe17fd46dd9a99f4816a3f6 /tests/auto/qstatictext
parentc04b9d51011d11ff19719a4b96ad885ef89ea78d (diff)
downloadQt-4012ff8d08e5d6be738db88eda30dbe20d45c58a.zip
Qt-4012ff8d08e5d6be738db88eda30dbe20d45c58a.tar.gz
Qt-4012ff8d08e5d6be738db88eda30dbe20d45c58a.tar.bz2
Fix one test and add tests for backend optimizations
The rotatedTranslatedScaled-test would transform the text out of the destination rect, so we'd just confirm two blank images. Also added input to the two basic tests for backend optimizations.
Diffstat (limited to 'tests/auto/qstatictext')
-rw-r--r--tests/auto/qstatictext/tst_qstatictext.cpp35
1 files changed, 32 insertions, 3 deletions
diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp
index 9ad389d..08e7079 100644
--- a/tests/auto/qstatictext/tst_qstatictext.cpp
+++ b/tests/auto/qstatictext/tst_qstatictext.cpp
@@ -57,7 +57,9 @@ private slots:
void cleanup();
void constructionAndDestruction();
+ void drawToPoint_data();
void drawToPoint();
+ void drawToRect_data();
void drawToRect();
void setFont();
void setMaximumSize();
@@ -69,7 +71,7 @@ private slots:
void scaledPainter();
void projectedPainter();
void rotatedScaledAndTranslatedPainter();
- void transformationChanged();
+ void transformationChanged();
};
void tst_QStaticText::init()
@@ -85,8 +87,18 @@ void tst_QStaticText::constructionAndDestruction()
QStaticText text("My text");
}
+void tst_QStaticText::drawToPoint_data()
+{
+ QTest::addColumn<bool>("useBackendOptimizations");
+
+ QTest::newRow("Without backend optimizations") << false;
+ QTest::newRow("With backend optimizations") << true;
+}
+
void tst_QStaticText::drawToPoint()
{
+ QFETCH(bool, useBackendOptimizations);
+
QPixmap imageDrawText(1000, 1000);
imageDrawText.fill(Qt::white);
{
@@ -99,14 +111,25 @@ void tst_QStaticText::drawToPoint()
{
QPainter p(&imageDrawStaticText);
QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
+ text.setUseBackendOptimizations(useBackendOptimizations);
p.drawStaticText(11, 12, text);
}
QCOMPARE(imageDrawStaticText, imageDrawText);
}
+void tst_QStaticText::drawToRect_data()
+{
+ QTest::addColumn<bool>("useBackendOptimizations");
+
+ QTest::newRow("Without backend optimizations") << false;
+ QTest::newRow("With backend optimizations") << true;
+}
+
void tst_QStaticText::drawToRect()
{
+ QFETCH(bool, useBackendOptimizations);
+
QPixmap imageDrawText(1000, 1000);
imageDrawText.fill(Qt::white);
{
@@ -119,6 +142,7 @@ void tst_QStaticText::drawToRect()
{
QPainter p(&imageDrawStaticText);
QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.", QSizeF(10, 500));
+ text.setUseBackendOptimizations(useBackendOptimizations);
p.drawStaticText(11, 12, text);
}
@@ -342,7 +366,7 @@ void tst_QStaticText::rotatedScaledAndTranslatedPainter()
{
QPainter p(&imageDrawText);
p.rotate(45.0);
- p.scale(0.2, 2.0);
+ p.scale(2.0, 2.0);
p.translate(100, 200);
p.drawText(11, 12, "Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
@@ -353,13 +377,18 @@ void tst_QStaticText::rotatedScaledAndTranslatedPainter()
{
QPainter p(&imageDrawStaticText);
p.rotate(45.0);
- p.scale(0.2, 2.0);
+ p.scale(2.0, 2.0);
p.translate(100, 200);
QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
p.drawStaticText(11, 12, text);
}
+#if defined(DEBUG_SAVE_IMAGE)
+ imageDrawText.save("rotatedScaledAndPainter_imageDrawText.png");
+ imageDrawStaticText.save("rotatedScaledAndPainter_imageDrawStaticText.png");
+#endif
+
QCOMPARE(imageDrawStaticText, imageDrawText);
}