From 02e9f3f25bdcc1b13ecf9ffaf43716c8f7053e88 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 10 Feb 2010 17:27:07 +0100 Subject: Remove fluxuating tests for QStaticText The QGLWidget tests would fail at random. The use case has been confirmed to work through manual tests, but I haven't found any good way to test them automatically. They have been removed until time permits. --- tests/auto/qstatictext/tst_qstatictext.cpp | 209 ----------------------------- 1 file changed, 209 deletions(-) diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp index 92c0008..69e9dc5 100644 --- a/tests/auto/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/qstatictext/tst_qstatictext.cpp @@ -74,11 +74,6 @@ private slots: void projectedPainter(); void rotatedScaledAndTranslatedPainter(); void transformationChanged(); - - void drawToGLWidget(); - void drawToGLWidgetRepeated(); - void drawToGLWidgetWithCaching(); - void drawToGLWidgetWithCachingRepeated(); }; void tst_QStaticText::init() @@ -437,209 +432,5 @@ void tst_QStaticText::transformationChanged() QCOMPARE(imageDrawStaticText, imageDrawText); } -class MyGLWidget: public QGLWidget -{ -public: - enum PaintEventType { - NormalDrawText, - NormalDrawStaticText, - DrawStaticTextWithCaching - }; - - MyGLWidget(PaintEventType paintEventType, QWidget *parent = 0) - : QGLWidget(parent), m_paintEventType(paintEventType) - { - m_staticText.setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); - if (m_paintEventType == DrawStaticTextWithCaching) - m_staticText.setUseBackendOptimizations(true); - shown = false; - } - - void paintEvent(QPaintEvent *) - { - QPainter painter(this); - painter.fillRect(rect(), Qt::white); - switch (m_paintEventType) { - case NormalDrawStaticText: - case DrawStaticTextWithCaching: - painter.drawStaticText(QPointF(11, 12), m_staticText); - break; - case NormalDrawText: - painter.drawText(11, 12, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); - break; - }; - shown = true; - } - - bool shown; - -private: - QStaticText m_staticText; - PaintEventType m_paintEventType; -}; - -void tst_QStaticText::drawToGLWidget() -{ - QImage imageDrawText; - { - MyGLWidget glWidget(MyGLWidget::NormalDrawText); - glWidget.show(); - while (!glWidget.shown) - QApplication::processEvents(); - imageDrawText = glWidget.grabFrameBuffer(); - } - - QImage imageDrawStaticText; - { - MyGLWidget glWidget(MyGLWidget::NormalDrawStaticText); - glWidget.show(); - while (!glWidget.shown) - QApplication::processEvents(); - imageDrawStaticText = glWidget.grabFrameBuffer(); - } - -#if defined(DEBUG_SAVE_IMAGE) - imageDrawText.save("drawToGLWidget_imageDrawText.png"); - imageDrawStaticText.save("drawToGLWidget_imageDrawStaticText.png"); -#endif - - QCOMPARE(imageDrawStaticText, imageDrawText); -} - -void tst_QStaticText::drawToGLWidgetWithCaching() -{ - QImage imageDrawText; - { - MyGLWidget glWidget(MyGLWidget::NormalDrawText); - glWidget.show(); - while (!glWidget.shown) - QApplication::processEvents(); - imageDrawText = glWidget.grabFrameBuffer(); - } - - QImage imageDrawStaticText; - { - MyGLWidget glWidget(MyGLWidget::DrawStaticTextWithCaching); - glWidget.show(); - while (!glWidget.shown) - QApplication::processEvents(); - imageDrawStaticText = glWidget.grabFrameBuffer(); - } - -#if defined(DEBUG_SAVE_IMAGE) - imageDrawText.save("drawToGLWidgetWithCaching_imageDrawText.png"); - imageDrawStaticText.save("drawToGLWidgetWithCaching_imageDrawStaticText.png"); -#endif - - QCOMPARE(imageDrawStaticText, imageDrawText); -} - -void tst_QStaticText::drawToGLWidgetWithCachingRepeated() -{ - QImage imageDrawText; - MyGLWidget glWidgetNormal(MyGLWidget::NormalDrawText); - - { - glWidgetNormal.show(); - while (!glWidgetNormal.shown) - QApplication::processEvents(); - imageDrawText = glWidgetNormal.grabFrameBuffer(); - } - - QImage imageDrawStaticText; - MyGLWidget glWidgetAbnormal(MyGLWidget::DrawStaticTextWithCaching); - { - - glWidgetAbnormal.show(); - while (!glWidgetAbnormal.shown) - QApplication::processEvents(); - imageDrawStaticText = glWidgetAbnormal.grabFrameBuffer(); - } - -#if defined(DEBUG_SAVE_IMAGE) - imageDrawText.save("drawToGLWidgetWithCachingRepeated_imageDrawText1.png"); - imageDrawStaticText.save("drawToGLWidgetWithCachingRepeated_imageDrawStaticText1.png"); -#endif - - QCOMPARE(imageDrawStaticText, imageDrawText); - - { - glWidgetNormal.shown = false; - glWidgetNormal.update(); - while (!glWidgetNormal.shown) - QApplication::processEvents(); - imageDrawText = glWidgetNormal.grabFrameBuffer(); - } - - { - glWidgetAbnormal.shown = false; - glWidgetAbnormal.update(); - while (!glWidgetAbnormal.shown) - QApplication::processEvents(); - imageDrawStaticText = glWidgetAbnormal.grabFrameBuffer(); - } - -#if defined(DEBUG_SAVE_IMAGE) - imageDrawText.save("drawToGLWidgetWithCachingRepeated_imageDrawText2.png"); - imageDrawStaticText.save("drawToGLWidgetWithCachingRepeated_imageDrawStaticText2.png"); -#endif - - QCOMPARE(imageDrawStaticText, imageDrawText); -} - -void tst_QStaticText::drawToGLWidgetRepeated() -{ - QImage imageDrawText; - MyGLWidget glWidgetNormal(MyGLWidget::NormalDrawText); - - { - glWidgetNormal.show(); - while (!glWidgetNormal.shown) - QApplication::processEvents(); - imageDrawText = glWidgetNormal.grabFrameBuffer(); - } - - QImage imageDrawStaticText; - MyGLWidget glWidgetAbnormal(MyGLWidget::NormalDrawStaticText); - { - - glWidgetAbnormal.show(); - while (!glWidgetAbnormal.shown) - QApplication::processEvents(); - imageDrawStaticText = glWidgetAbnormal.grabFrameBuffer(); - } - -#if defined(DEBUG_SAVE_IMAGE) - imageDrawText.save("drawToGLWidgetWithCachingRepeated_imageDrawText1.png"); - imageDrawStaticText.save("drawToGLWidgetWithCachingRepeated_imageDrawStaticText1.png"); -#endif - - QCOMPARE(imageDrawStaticText, imageDrawText); - - { - glWidgetNormal.shown = false; - glWidgetNormal.update(); - while (!glWidgetNormal.shown) - QApplication::processEvents(); - imageDrawText = glWidgetNormal.grabFrameBuffer(); - } - - { - glWidgetAbnormal.shown = false; - glWidgetAbnormal.update(); - while (!glWidgetAbnormal.shown) - QApplication::processEvents(); - imageDrawStaticText = glWidgetAbnormal.grabFrameBuffer(); - } - -#if defined(DEBUG_SAVE_IMAGE) - imageDrawText.save("drawToGLWidgetWithCachingRepeated_imageDrawText2.png"); - imageDrawStaticText.save("drawToGLWidgetWithCachingRepeated_imageDrawStaticText2.png"); -#endif - - QCOMPARE(imageDrawStaticText, imageDrawText); -} - - QTEST_MAIN(tst_QStaticText) #include "tst_qstatictext.moc" -- cgit v0.12