summaryrefslogtreecommitdiffstats
path: root/tests/auto/qwidget
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2009-09-11 14:29:23 +0300
committerJanne Anttila <janne.anttila@digia.com>2009-09-11 14:29:23 +0300
commit7ea2c96fbd394fe930dc59b611b125ad269ec0ab (patch)
treeaa7879fb8cd28e99cd72eb31614b5ed1a5dbef27 /tests/auto/qwidget
parent842ee1617923443ebb78d998ca3c5c8721442d91 (diff)
Fixed QWidget::activateWindow for Symbian.
activeWindow documentation says: "active window is a visible top-level window that has the keyboard input focus" and "If you want to ensure that the window is stacked on top as well you should also call raise(). Note that the window must be visible, otherwise activateWindow has no effect." What we were doing earlier was basically raise. Now we just set the keyboard focus to underlying native window. Task-number: 260685 Reviewed-by: Jason Barron
Diffstat (limited to 'tests/auto/qwidget')
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp58
1 files changed, 47 insertions, 11 deletions
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 230b7c954a..47cd860438 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -367,10 +367,12 @@ private slots:
void setGraphicsEffect();
void destroyBackingStore();
-
+
+ void activateWindow();
+
#ifdef Q_OS_SYMBIAN
void cbaVisibility();
-#endif
+#endif
private:
bool ensureScreenSize(int width, int height);
@@ -9328,11 +9330,45 @@ void tst_QWidget::setGraphicsEffect()
delete anotherWidget;
}
+void tst_QWidget::activateWindow()
+{
+ // Test case for task 260685
+
+ // Create first mainwindow and set it active
+ QMainWindow* mainwindow = new QMainWindow();
+ QLabel* label = new QLabel(mainwindow);
+ mainwindow->setCentralWidget(label);
+ mainwindow->setVisible(true);
+ mainwindow->activateWindow();
+ qApp->processEvents();
+
+ QVERIFY(mainwindow->isActiveWindow());
+
+ // Create second mainwindow and set it active
+ QMainWindow* mainwindow2 = new QMainWindow();
+ QLabel* label2 = new QLabel(mainwindow2);
+ mainwindow2->setCentralWidget(label2);
+ mainwindow2->setVisible(true);
+ mainwindow2->activateWindow();
+ qApp->processEvents();
+
+ QVERIFY(!mainwindow->isActiveWindow());
+ QVERIFY(mainwindow2->isActiveWindow());
+
+ // Revert first mainwindow back to visible active
+ mainwindow->setVisible(true);
+ mainwindow->activateWindow();
+ qApp->processEvents();
+
+ QVERIFY(mainwindow->isActiveWindow());
+ QVERIFY(!mainwindow2->isActiveWindow());
+}
+
#ifdef Q_OS_SYMBIAN
void tst_QWidget::cbaVisibility()
{
// Test case for task 261048
-
+
// Create first mainwindow in fullsreen and activate it
QMainWindow* mainwindow = new QMainWindow();
QLabel* label = new QLabel(mainwindow);
@@ -9340,11 +9376,11 @@ void tst_QWidget::cbaVisibility()
mainwindow->setWindowState(Qt::WindowFullScreen);
mainwindow->setVisible(true);
mainwindow->activateWindow();
- qApp->processEvents();
+ qApp->processEvents();
QVERIFY(mainwindow->isActiveWindow());
- QVERIFY(QDesktopWidget().availableGeometry().size() == mainwindow->size());
-
+ QVERIFY(QDesktopWidget().availableGeometry().size() == mainwindow->size());
+
// Create second mainwindow in maximized and activate it
QMainWindow* mainwindow2 = new QMainWindow();
QLabel* label2 = new QLabel(mainwindow2);
@@ -9352,17 +9388,17 @@ void tst_QWidget::cbaVisibility()
mainwindow2->setWindowState(Qt::WindowMaximized);
mainwindow2->setVisible(true);
mainwindow2->activateWindow();
- qApp->processEvents();
-
+ qApp->processEvents();
+
QVERIFY(!mainwindow->isActiveWindow());
QVERIFY(mainwindow2->isActiveWindow());
- QVERIFY(QDesktopWidget().availableGeometry().size() == mainwindow2->size());
-
+ QVERIFY(QDesktopWidget().availableGeometry().size() == mainwindow2->size());
+
// 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();
- QVERIFY(buttonGroup->IsVisible());
+ QVERIFY(buttonGroup->IsVisible());
}
#endif