diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-02-24 11:19:26 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-02-24 11:26:07 (GMT) |
commit | 5cb03208083bf86c35ea838a12797d39b99c50e6 (patch) | |
tree | 956ed6342130ca83f99f91c493347b9b0a3ec460 /tests/auto/qstatictext | |
parent | bbc2099ea172ea65294bd91554145786c2a4a9e1 (diff) | |
download | Qt-5cb03208083bf86c35ea838a12797d39b99c50e6.zip Qt-5cb03208083bf86c35ea838a12797d39b99c50e6.tar.gz Qt-5cb03208083bf86c35ea838a12797d39b99c50e6.tar.bz2 |
Fix QStaticText test on QWS
Windows has the only font engine which supports transforming the
glyphs in the glyph cache currently. All other engines fall back to
drawing paths instead when using the raster engine. We disable
the transformation tests for platforms which aren't either Windows
or running a native graphics system.
Reviewed-by: Olivier
Diffstat (limited to 'tests/auto/qstatictext')
-rw-r--r-- | tests/auto/qstatictext/tst_qstatictext.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp index 68f05c1..b6b4e83 100644 --- a/tests/auto/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/qstatictext/tst_qstatictext.cpp @@ -46,12 +46,17 @@ #include <qstatictext.h> #include <private/qstatictext_p.h> +#include <private/qapplication_p.h> // #define DEBUG_SAVE_IMAGE class tst_QStaticText: public QObject { Q_OBJECT + +private: + bool supportsTransformations() const; + private slots: void init(); void cleanup(); @@ -177,6 +182,8 @@ void tst_QStaticText::prepareToCorrectData() p.drawStaticText(QPointF(11, 12), text); } + if (!supportsTransformations()) + QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort); QCOMPARE(imageDrawStaticText, imageDrawText); } @@ -288,6 +295,20 @@ void tst_QStaticText::translatedPainter() QCOMPARE(imageDrawStaticText, imageDrawText); } +bool tst_QStaticText::supportsTransformations() const +{ + + if (QApplicationPrivate::graphics_system_name == QLatin1String("opengl")) + return false; + +#if !defined(Q_WS_WIN) + if (QApplicationPrivate::graphics_system_name == "raster") + return false; +#endif + + return true; +} + void tst_QStaticText::rotatedPainter() { QPixmap imageDrawText(1000, 1000); @@ -314,6 +335,8 @@ void tst_QStaticText::rotatedPainter() imageDrawStaticText.save("rotatedPainter_imageDrawStaticText.png"); #endif + if (!supportsTransformations()) + QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort); QCOMPARE(imageDrawStaticText, imageDrawText); } @@ -340,6 +363,8 @@ void tst_QStaticText::scaledPainter() p.drawStaticText(QPointF(11, 12), text); } + if (!supportsTransformations()) + QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort); QCOMPARE(imageDrawStaticText, imageDrawText); } @@ -370,7 +395,6 @@ void tst_QStaticText::projectedPainter() } QCOMPARE(imageDrawStaticText, imageDrawText); - } void tst_QStaticText::rotatedScaledAndTranslatedPainter() @@ -405,6 +429,8 @@ void tst_QStaticText::rotatedScaledAndTranslatedPainter() imageDrawStaticText.save("rotatedScaledAndPainter_imageDrawStaticText.png"); #endif + if (!supportsTransformations()) + QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort); QCOMPARE(imageDrawStaticText, imageDrawText); } @@ -444,6 +470,8 @@ void tst_QStaticText::transformationChanged() imageDrawStaticText.save("transformationChanged_imageDrawStaticText.png"); #endif + if (!supportsTransformations()) + QEXPECT_FAIL("", "Graphics system does not support transformed text on this platform", Abort); QCOMPARE(imageDrawStaticText, imageDrawText); } |