summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicswidget
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@nokia.com>2009-11-17 16:17:16 (GMT)
committerYoann Lopes <yoann.lopes@nokia.com>2009-11-17 16:24:39 (GMT)
commit162071d2651645358a0935b27af8a3b47474a10f (patch)
tree1d3465f815ed277f51ed4c16e6a1af1cc4999008 /tests/auto/qgraphicswidget
parent5f2489ef78956223d7f52ed02c1e580921883803 (diff)
downloadQt-162071d2651645358a0935b27af8a3b47474a10f.zip
Qt-162071d2651645358a0935b27af8a3b47474a10f.tar.gz
Qt-162071d2651645358a0935b27af8a3b47474a10f.tar.bz2
Fixes polish events for explicitly hidden GraphicsWidgetItems.
The problem was that hidden items never get added to "unpolishedItems" list and thus never get the polish event. Autotest included. Task-number: QTBUG-3939 Reviewed-by: bnilsen
Diffstat (limited to 'tests/auto/qgraphicswidget')
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index 829e55c..3b98c2f 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -161,6 +161,7 @@ private slots:
void respectHFW();
void addChildInpolishEvent();
void polishEvent();
+ void polishEvent2();
// Task fixes
void task236127_bspTreeIndexFails();
@@ -2796,6 +2797,29 @@ void tst_QGraphicsWidget::polishEvent()
QCOMPARE(widget->events.at(0), QEvent::Polish);
}
+void tst_QGraphicsWidget::polishEvent2()
+{
+ class MyGraphicsWidget : public QGraphicsWidget
+ { public:
+ void polishEvent()
+ { events << QEvent::Polish; }
+ QList<QEvent::Type> events;
+ };
+
+ QGraphicsScene scene;
+
+ MyGraphicsWidget *widget = new MyGraphicsWidget;
+ widget->hide();
+ scene.addItem(widget);
+
+ widget->events.clear();
+
+ QApplication::processEvents();
+
+ // Make sure the item got polish event.
+ QVERIFY(widget->events.contains(QEvent::Polish));
+}
+
QTEST_MAIN(tst_QGraphicsWidget)
#include "tst_qgraphicswidget.moc"