summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2010-12-10 11:04:37 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2010-12-10 11:22:42 (GMT)
commitc2b13ddde2f4998b03ff9036cc5ab81fd4132e61 (patch)
tree70582e8b6ee859fe2531834c9adb6da9f1c57bce /tests
parentcde178fdc12262ecbbd99edb73477c6d6143e30e (diff)
downloadQt-c2b13ddde2f4998b03ff9036cc5ab81fd4132e61.zip
Qt-c2b13ddde2f4998b03ff9036cc5ab81fd4132e61.tar.gz
Qt-c2b13ddde2f4998b03ff9036cc5ab81fd4132e61.tar.bz2
Fix qwidget test crash
CEikonEnv::Static()->AppUiFactory()->Cba() call always returns NULL unless cba was defined via resources, which we are no longer doing. Due to the buggy implementation of MEikAppUiFactory interface in Symbian, the only way to get non-resources created cba is to use the return value of CEikonEnv::Static()->AppUiFactory()->SwapButtonGroup() method, so changed the test cases to do a dummy swap. Since the swap just changes the value of a member variable and doesn't trigger anything, it should not cause any interference for the tests. Task-number: QTBUG-15915 Reviewed-by: Janne Koskinen Reviewed-by: Sami Merila
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp32
1 files changed, 27 insertions, 5 deletions
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 5521873..6069383 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -10029,6 +10029,28 @@ void tst_QWidget::openModal_taskQTBUG_5804()
}
#ifdef Q_OS_SYMBIAN
+
+static CEikButtonGroupContainer* cba()
+{
+ CEikButtonGroupContainer *oldCba = NULL;
+
+ // Due to convoluted/buggy implementation of MEikAppUiFactory interface in Symbian,
+ // the only way to get the correct cba is to use SwapButtonGroup function.
+ // Calling SwapButtonGroup doesn't trigger anything, it only changes the value of iToolbar
+ // member variable, so this double switching should not cause any interference for test.
+ QT_TRAP_THROWING(
+ CEikButtonGroupContainer *dummyCba = CEikButtonGroupContainer::NewL(
+ CEikButtonGroupContainer::ECba, CEikButtonGroupContainer::EHorizontal, NULL, 0);
+
+ oldCba = CEikonEnv::Static()->AppUiFactory()->SwapButtonGroup(dummyCba);
+ CEikonEnv::Static()->AppUiFactory()->SwapButtonGroup(oldCba);
+
+ delete dummyCba;
+ )
+
+ return oldCba;
+}
+
void tst_QWidget::cbaVisibility()
{
// Test case for task 261048
@@ -10061,7 +10083,7 @@ void tst_QWidget::cbaVisibility()
// Verify window decorations i.e. status pane and CBA are visible.
CEikStatusPane* statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
QVERIFY(statusPane->IsVisible());
- CEikButtonGroupContainer* buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba();
+ CEikButtonGroupContainer* buttonGroup = cba();
QVERIFY(buttonGroup->IsVisible());
}
@@ -10078,7 +10100,7 @@ void tst_QWidget::fullScreenWindowModeTransitions()
const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget);
const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget);
CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
- CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba();
+ CEikButtonGroupContainer *buttonGroup = cba();
//Enter
widget.showNormal();
@@ -10132,7 +10154,7 @@ void tst_QWidget::maximizedWindowModeTransitions()
const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget);
const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget);
CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
- CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba();
+ CEikButtonGroupContainer *buttonGroup = cba();
//Enter
widget.showNormal();
@@ -10188,7 +10210,7 @@ void tst_QWidget::minimizedWindowModeTransitions()
const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget);
const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget);
CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
- CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba();
+ CEikButtonGroupContainer *buttonGroup = cba();
//Enter
widget.showNormal();
@@ -10244,7 +10266,7 @@ void tst_QWidget::normalWindowModeTransitions()
const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget);
const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget);
CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
- CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba();
+ CEikButtonGroupContainer *buttonGroup = cba();
//Enter
widget.showMaximized();