diff options
author | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2010-04-16 12:52:05 (GMT) |
---|---|---|
committer | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2010-04-16 14:58:08 (GMT) |
commit | 8ebcd4db8d57b7e90ec86c9290682ee9c2e576b7 (patch) | |
tree | b1a001064ec08a3dc64e098e635255af100105ce /tests | |
parent | 74f28819d985984170964d12d8f527034db93017 (diff) | |
download | Qt-8ebcd4db8d57b7e90ec86c9290682ee9c2e576b7.zip Qt-8ebcd4db8d57b7e90ec86c9290682ee9c2e576b7.tar.gz Qt-8ebcd4db8d57b7e90ec86c9290682ee9c2e576b7.tar.bz2 |
Some QWindowSurface implementations might implement flush as a buffer
flip. Such window surfaces therefore destroy the contents during flush.
In order to render correctly on these surfaces, any update, no matter
how small, needs to trigger the entire window to be redrawn.
Auto test included.
Task-number: Relates to QTBUG-9978
Reviewed-by: tom
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qwindowsurface/tst_qwindowsurface.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp index dd985ca..7dde402 100644 --- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp +++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp @@ -66,6 +66,7 @@ private slots: void getSetWindowSurface(); void flushOutsidePaintEvent(); void grabWidget(); + void staticContentsAndPartialUpdateSupport(); }; class MyWindowSurface : public QWindowSurface @@ -81,6 +82,8 @@ public: /* nothing */ } + using QWindowSurface::setStaticContentsSupport; + using QWindowSurface::setPartialUpdateSupport; private: QImage image; }; @@ -280,6 +283,51 @@ void tst_QWindowSurface::grabWidget() QVERIFY(QColor(childInvalidSubImage.pixel(0, 0)) == QColor(Qt::white)); } +void tst_QWindowSurface::staticContentsAndPartialUpdateSupport() +{ + QWidget widget; + MyWindowSurface surface(&widget); + + // Default values. + QVERIFY(surface.hasPartialUpdateSupport()); + QVERIFY(!surface.hasStaticContentsSupport()); + + // Partial: YES, Static: YES + surface.setStaticContentsSupport(true); + QVERIFY(surface.hasPartialUpdateSupport()); + QVERIFY(surface.hasStaticContentsSupport()); + + // Static contents requires support for partial updates. + // We simply ingore bad combinations and spit out a warning. + + // CONFLICT: Partial: NO, Static: YES + QTest::ignoreMessage(QtWarningMsg, "QWindowSurface::setPartialUpdateSupport: static contents support requires partial update support"); + surface.setPartialUpdateSupport(false); + QVERIFY(surface.hasPartialUpdateSupport()); + QVERIFY(surface.hasStaticContentsSupport()); + + // Partial: YES, Static: NO + surface.setStaticContentsSupport(false); + QVERIFY(surface.hasPartialUpdateSupport()); + QVERIFY(!surface.hasStaticContentsSupport()); + + // Partial: NO, Static: NO + surface.setPartialUpdateSupport(false); + QVERIFY(!surface.hasPartialUpdateSupport()); + QVERIFY(!surface.hasStaticContentsSupport()); + + // CONFLICT: Partial: NO, Static: YES + QTest::ignoreMessage(QtWarningMsg, "QWindowSurface::setStaticContentsSupport: static contents support requires partial update support"); + surface.setStaticContentsSupport(true); + QVERIFY(!surface.hasPartialUpdateSupport()); + QVERIFY(!surface.hasStaticContentsSupport()); + + // Partial: YES, Static: NO + surface.setPartialUpdateSupport(true); + QVERIFY(surface.hasPartialUpdateSupport()); + QVERIFY(!surface.hasStaticContentsSupport()); +} + QTEST_MAIN(tst_QWindowSurface) #else // Q_WS_MAC |