summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2009-06-08 12:49:44 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-06-09 07:43:37 (GMT)
commit9ba5a561b017ec028d675627df2eda5b13e3a6fc (patch)
tree0b336556a4926f0fad6fc3e7a9beffb7e23d9e49 /tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
parent56f23d4ccfc27f737d30e92ae5b3ecde6e8b0bbf (diff)
downloadQt-9ba5a561b017ec028d675627df2eda5b13e3a6fc.zip
Qt-9ba5a561b017ec028d675627df2eda5b13e3a6fc.tar.gz
Qt-9ba5a561b017ec028d675627df2eda5b13e3a6fc.tar.bz2
Fix two regressions in Plasma. The painter state proctection was not
properly pass to drawItemHelper. The second is a double conversion to deviceTransform in createStyleOption of QGraphicsItem. Since the recursive drawing already give a transform in device mode we don't need to convert it two times. Reviewed-by:andreas
Diffstat (limited to 'tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp')
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index 56d42c3..00f3155 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -155,6 +155,7 @@ private slots:
void windowFlags_data();
void windowFlags();
void shortcutsDeletion();
+ void painterStateProtectionOnWindowFrame();
// Task fixes
void task236127_bspTreeIndexFails();
@@ -2282,6 +2283,41 @@ void tst_QGraphicsWidget::shortcutsDeletion()
delete widget;
}
+class MessUpPainterWidget : public QGraphicsWidget
+{
+public:
+ MessUpPainterWidget(QGraphicsItem * parent = 0, Qt::WindowFlags wFlags = 0)
+ : QGraphicsWidget(parent, wFlags)
+ {}
+
+ void paintWindowFrame(QPainter * painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+ {
+ QCOMPARE(painter->opacity(), 1.0);
+ painter->setOpacity(0.0);
+ QGraphicsWidget::paintWindowFrame(painter, option, widget);
+ }
+ void paint(QPainter * painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+ {
+ QCOMPARE(painter->opacity(), 1.0);
+ painter->drawRect(0, 0, 100, 100);
+ QGraphicsWidget::paint(painter, option, widget);
+ }
+
+};
+
+void tst_QGraphicsWidget::painterStateProtectionOnWindowFrame()
+{
+ MessUpPainterWidget *widget = new MessUpPainterWidget(0, Qt::Window);
+ QGraphicsScene scene(0, 0, 300, 300);
+ QGraphicsView view(&scene);
+ scene.addItem(widget);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(500);
+}
+
class ProxyStyle : public QCommonStyle
{
public: