From 5cb03208083bf86c35ea838a12797d39b99c50e6 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 24 Feb 2010 12:19:26 +0100 Subject: 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 --- tests/auto/qstatictext/tst_qstatictext.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) 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 #include +#include // #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); } -- cgit v0.12