summaryrefslogtreecommitdiffstats
path: root/tests/auto/qwidget
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-08-21 10:05:33 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-08-21 10:05:33 (GMT)
commit487f636523dfded4c07a39e4d96ab3e83c64f95e (patch)
tree3e3a590f42424c831215d08d19a9790ec5eb0698 /tests/auto/qwidget
parentfad6c792d4ead4ff14eaed3c9bc7564142989af7 (diff)
downloadQt-487f636523dfded4c07a39e4d96ab3e83c64f95e.zip
Qt-487f636523dfded4c07a39e4d96ab3e83c64f95e.tar.gz
Qt-487f636523dfded4c07a39e4d96ab3e83c64f95e.tar.bz2
Add auto-tests for QGraphicsItem/QWidget::setGraphicsEffect.
Diffstat (limited to 'tests/auto/qwidget')
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 34971a9..36f4ddf 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -355,6 +355,7 @@ private slots:
void focusWidget_task254563();
void rectOutsideCoordinatesLimit_task144779();
+ void setGraphicsEffect();
private:
bool ensureScreenSize(int width, int height);
@@ -9169,5 +9170,36 @@ void tst_QWidget::inputFocus_task257832()
delete widget;
}
+void tst_QWidget::setGraphicsEffect()
+{
+ // Check that we don't have any effect by default.
+ QWidget *widget = new QWidget;
+ QVERIFY(!widget->graphicsEffect());
+
+ // SetGet check.
+ QPointer<QGraphicsEffect> blurEffect = new QGraphicsBlurEffect;
+ widget->setGraphicsEffect(blurEffect);
+ QCOMPARE(widget->graphicsEffect(), static_cast<QGraphicsEffect *>(blurEffect));
+
+ // Ensure the existing effect is deleted when setting a new one.
+ QPointer<QGraphicsEffect> shadowEffect = new QGraphicsDropShadowEffect;
+ widget->setGraphicsEffect(shadowEffect);
+ QVERIFY(!blurEffect);
+ QCOMPARE(widget->graphicsEffect(), static_cast<QGraphicsEffect *>(shadowEffect));
+ blurEffect = new QGraphicsBlurEffect;
+
+ // Ensure the effect is uninstalled when setting it on a new target.
+ QWidget *anotherWidget = new QWidget;
+ anotherWidget->setGraphicsEffect(blurEffect);
+ widget->setGraphicsEffect(blurEffect);
+ QVERIFY(!anotherWidget->graphicsEffect());
+ QVERIFY(!shadowEffect);
+
+ // Ensure the existing effect is deleted when deleting the widget.
+ delete widget;
+ QVERIFY(!blurEffect);
+ delete anotherWidget;
+}
+
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"