summaryrefslogtreecommitdiffstats
path: root/tests/auto/qwidget
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@nokia.com>2011-10-07 14:21:59 +0200
committerLiang Qi <liang.qi@nokia.com>2011-10-07 14:21:59 +0200
commit7cf9030bd7a50b6d98d454510417c6ecc3f33d49 (patch)
tree7c5c562ba490e217d8cef81ff1fd5958a0cacccb /tests/auto/qwidget
parent7f3cd2949ccb16b1b611c05bf6ab7274cf04a0f8 (diff)
parent96fcfc720aa1c6d0b6d741f8169cd37ea9fcd9a9 (diff)
Merge remote-tracking branch 'origin/4.7' into qt-4.8-from-4.7
Conflicts: doc/src/getting-started/installation.qdoc doc/src/platforms/platform-notes.qdoc src/corelib/tools/qlocale_symbian.cpp src/gui/kernel/qwidget_p.h src/network/access/qnetworkaccesshttpbackend.cpp src/opengl/qgl.cpp src/plugins/bearer/symbian/qnetworksession_impl.cpp
Diffstat (limited to 'tests/auto/qwidget')
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp45
1 files changed, 44 insertions, 1 deletions
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index ee06b53892..a881583668 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -397,6 +397,9 @@ private slots:
void minimizedWindowModeTransitions();
void normalWindowModeTransitions();
void focusSwitchClosesPopupMenu();
+#if !defined(Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE)
+ void opacityChangeCausesBackingStoreRecreation();
+#endif
#endif
void focusProxyAndInputMethods();
@@ -10334,7 +10337,47 @@ void tst_QWidget::focusSwitchClosesPopupMenu()
mainWindow.activateWindow();
QVERIFY(!CEikonEnv::Static()->AppUiFactory()->MenuBar()->IsDisplayed());
}
-#endif
+
+#if !defined(Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE)
+class OpacityChangeWidget : public QWidget
+{
+public:
+ OpacityChangeWidget() : m_paintEngineType(QPaintEngine::MaxUser) { }
+ void paintEvent(QPaintEvent *)
+ {
+ QPainter painter(this);
+ m_paintEngineType = painter.paintEngine()->type();
+ }
+ QPaintEngine::Type paintEngineType() const { return m_paintEngineType; }
+private:
+ QPaintEngine::Type m_paintEngineType;
+};
+
+void tst_QWidget::opacityChangeCausesBackingStoreRecreation()
+{
+ OpacityChangeWidget w;
+ w.show();
+ QTest::qWaitForWindowShown(&w);
+ const QPaintEngine::Type type = w.paintEngineType();
+ if (QPaintEngine::OpenGL != type && QPaintEngine::OpenVG != type) {
+ QSKIP("Test case is only valid when using opengl or openvg graphics system", SkipAll);
+ } else {
+ if (QApplicationPrivate::instance()->useTranslucentEGLSurfaces) {
+ QSKIP("Test case is only valid when EGL surface transparency is not supported", SkipAll);
+ } else {
+ // Making window transparent should force switch to raster graphics system
+ w.setAttribute(Qt::WA_TranslucentBackground, true);
+ w.repaint();
+ QCOMPARE(w.paintEngineType(), QPaintEngine::Raster);
+ // Making window opaque should cause switch back to previous graphics system
+ w.setAttribute(Qt::WA_TranslucentBackground, false);
+ w.repaint();
+ QCOMPARE(w.paintEngineType(), type);
+ }
+ }
+}
+#endif // !Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE
+#endif // Q_OS_SYMBIAN
class InputContextTester : public QInputContext
{