summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJani Hautakangas <ext-jani.hautakangas@nokia.com>2009-09-29 10:41:33 (GMT)
committerJani Hautakangas <ext-jani.hautakangas@nokia.com>2009-09-29 10:41:33 (GMT)
commit9a7ca912ce72476bda57f2306b38e5f6e928fbf5 (patch)
tree31a3bf33c3fae37b53b17f3eaf4dcae90521df3c /tests
parent8aec69a5cae285174b41df6d268f007edcdec84b (diff)
downloadQt-9a7ca912ce72476bda57f2306b38e5f6e928fbf5.zip
Qt-9a7ca912ce72476bda57f2306b38e5f6e928fbf5.tar.gz
Qt-9a7ca912ce72476bda57f2306b38e5f6e928fbf5.tar.bz2
Softkey fixes to QMenu tests.
Softkeys add two extra "Select" and "Back" actions to menu by default. First two actions in menu will be "Select" and "Back". Reviewed-by: Janne Anttila
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qactiongroup/tst_qactiongroup.cpp14
-rw-r--r--tests/auto/qmainwindow/tst_qmainwindow.cpp35
-rw-r--r--tests/auto/qmenu/tst_qmenu.cpp12
3 files changed, 43 insertions, 18 deletions
diff --git a/tests/auto/qactiongroup/tst_qactiongroup.cpp b/tests/auto/qactiongroup/tst_qactiongroup.cpp
index c290941..2d215a0 100644
--- a/tests/auto/qactiongroup/tst_qactiongroup.cpp
+++ b/tests/auto/qactiongroup/tst_qactiongroup.cpp
@@ -226,6 +226,14 @@ void tst_QActionGroup::separators()
mw.show();
+#ifdef QT_SOFTKEYS_ENABLED
+ // Softkeys add extra "Select" and "Back" actions to menu by default.
+ // Two first actions will be Select and Back when softkeys are enabled
+ int numSoftkeyActions = 2;
+#else
+ int numSoftkeyActions = 0;
+#endif
+
QAction *action = new QAction(&actGroup);
action->setText("test one");
@@ -237,13 +245,13 @@ void tst_QActionGroup::separators()
while (it.hasNext())
menu.addAction(it.next());
- QCOMPARE((int)menu.actions().size(), 2);
+ QCOMPARE((int)menu.actions().size(), 2 + numSoftkeyActions);
it = QListIterator<QAction*>(actGroup.actions());
while (it.hasNext())
menu.removeAction(it.next());
- QCOMPARE((int)menu.actions().size(), 0);
+ QCOMPARE((int)menu.actions().size(), 0 + numSoftkeyActions);
action = new QAction(&actGroup);
action->setText("test two");
@@ -252,7 +260,7 @@ void tst_QActionGroup::separators()
while (it.hasNext())
menu.addAction(it.next());
- QCOMPARE((int)menu.actions().size(), 3);
+ QCOMPARE((int)menu.actions().size(), 3 + numSoftkeyActions);
}
void tst_QActionGroup::testActionInTwoQActionGroup()
diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp
index 38d23b6..9615c63 100644
--- a/tests/auto/qmainwindow/tst_qmainwindow.cpp
+++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp
@@ -1297,18 +1297,27 @@ void tst_QMainWindow::createPopupMenu()
mainwindow.addDockWidget(Qt::LeftDockWidgetArea, &dockwidget3);
mainwindow.addDockWidget(Qt::LeftDockWidgetArea, &dockwidget4);
+
+#ifdef QT_SOFTKEYS_ENABLED
+ // Softkeys add extra "Select" and "Back" actions to menu by default.
+ // Two first actions will be Select and Back when softkeys are enabled
+ int numSoftkeyActions = 2;
+#else
+ int numSoftkeyActions = 0;
+#endif
+
QMenu *menu = mainwindow.createPopupMenu();
QVERIFY(menu != 0);
QList<QAction *> actions = menu->actions();
- QCOMPARE(actions.size(), 7);
+ QCOMPARE(actions.size(), 7 + numSoftkeyActions);
- QCOMPARE(actions.at(0), dockwidget1.toggleViewAction());
- QCOMPARE(actions.at(1), dockwidget2.toggleViewAction());
- QCOMPARE(actions.at(2), dockwidget3.toggleViewAction());
- QCOMPARE(actions.at(3), dockwidget4.toggleViewAction());
- QVERIFY(actions.at(4)->isSeparator());
- QCOMPARE(actions.at(5), toolbar1.toggleViewAction());
- QCOMPARE(actions.at(6), toolbar2.toggleViewAction());
+ QCOMPARE(actions.at(0 + numSoftkeyActions), dockwidget1.toggleViewAction());
+ QCOMPARE(actions.at(1 + numSoftkeyActions), dockwidget2.toggleViewAction());
+ QCOMPARE(actions.at(2 + numSoftkeyActions), dockwidget3.toggleViewAction());
+ QCOMPARE(actions.at(3 + numSoftkeyActions), dockwidget4.toggleViewAction());
+ QVERIFY(actions.at(4 + numSoftkeyActions)->isSeparator());
+ QCOMPARE(actions.at(5 + numSoftkeyActions), toolbar1.toggleViewAction());
+ QCOMPARE(actions.at(6 + numSoftkeyActions), toolbar2.toggleViewAction());
delete menu;
@@ -1319,12 +1328,12 @@ void tst_QMainWindow::createPopupMenu()
menu = mainwindow.createPopupMenu();
QVERIFY(menu != 0);
actions = menu->actions();
- QCOMPARE(actions.size(), 4);
+ QCOMPARE(actions.size(), 4 + numSoftkeyActions);
- QCOMPARE(actions.at(0), dockwidget2.toggleViewAction());
- QCOMPARE(actions.at(1), dockwidget3.toggleViewAction());
- QVERIFY(actions.at(2)->isSeparator());
- QCOMPARE(actions.at(3), toolbar2.toggleViewAction());
+ QCOMPARE(actions.at(0 + numSoftkeyActions), dockwidget2.toggleViewAction());
+ QCOMPARE(actions.at(1 + numSoftkeyActions), dockwidget3.toggleViewAction());
+ QVERIFY(actions.at(2 + numSoftkeyActions)->isSeparator());
+ QCOMPARE(actions.at(3 + numSoftkeyActions), toolbar2.toggleViewAction());
delete menu;
}
diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp
index e467229..726ca55 100644
--- a/tests/auto/qmenu/tst_qmenu.cpp
+++ b/tests/auto/qmenu/tst_qmenu.cpp
@@ -260,9 +260,17 @@ void tst_QMenu::onStatusMessageChanged(const QString &s)
void
tst_QMenu::addActionsAndClear()
{
- QCOMPARE(menus[0]->actions().count(), 0);
+#ifdef QT_SOFTKEYS_ENABLED
+ // Softkeys add extra "Select" and "Back" actions to menu by default.
+ // Two first actions will be Select and Back when softkeys are enabled
+ int numSoftkeyActions = 2;
+#else
+ int numSoftkeyActions = 0;
+#endif
+
+ QCOMPARE(menus[0]->actions().count(), 0 + numSoftkeyActions);
createActions();
- QCOMPARE(menus[0]->actions().count(), 8);
+ QCOMPARE(menus[0]->actions().count(), 8 + numSoftkeyActions);
menus[0]->clear();
QCOMPARE(menus[0]->actions().count(), 0);
}