From 06d1c12c24c38b0cd8822b1faf2694c7331f75cb Mon Sep 17 00:00:00 2001 From: Liang QI Date: Fri, 16 Oct 2009 16:20:31 +0200 Subject: Fix tst_QMenu on Symbian. For tst_QMenu::activeSubMenuPosition, QS60Style::pixelMetric(QStyle::PM_SubMenuOverlap) is different with other styles. For tst_QMenu::menuSizeHint, Softkey actions are not widgets and have no geometry. For tst_QMenu::task258920_mouseBorder, QS60Style::styleHint(QStyle::SH_Menu_MouseTracking) is false. RevBy: Shane Kearns RevBy: axis --- tests/auto/qmenu/tst_qmenu.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index 4eb149f..f12fa92 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -675,7 +675,13 @@ void tst_QMenu::activeSubMenuPosition() #ifdef Q_OS_WINCE_WM QSKIP("Not true for Windows Mobile Soft Keys", SkipSingle); #endif + +#ifdef Q_OS_SYMBIAN + // On Symbian, QS60Style::pixelMetric(QStyle::PM_SubMenuOverlap) is different with other styles. + QVERIFY(sub->pos().x() < main->pos().x()); +#else QVERIFY(sub->pos().x() > main->pos().x()); +#endif QCOMPARE(sub->activeAction(), subAction); } @@ -778,6 +784,11 @@ void tst_QMenu::menuSizeHint() int maxWidth =0; QRect result; foreach(QAction *action, menu.actions()) { +#ifdef QT_SOFTKEYS_ENABLED + // Softkey actions are not widgets and have no geometry. + if (menu.actionGeometry(action).topLeft() == QPoint(0,0)) + continue; +#endif maxWidth = qMax(maxWidth, menu.actionGeometry(action).width()); result |= menu.actionGeometry(action); QCOMPARE(result.x(), left + hmargin + panelWidth); @@ -816,6 +827,9 @@ void tst_QMenu::task258920_mouseBorder() QSKIP("Mouse move related signals for Windows Mobile unavailable", SkipAll); #endif Menu258920 menu; + // On Symbian, styleHint(QStyle::SH_Menu_MouseTracking) in QS60Style is false. + // For other styles which inherit from QWindowsStyle, the value is true. + menu.setMouseTracking(true); QAction *action = menu.addAction("test"); menu.popup(QApplication::desktop()->availableGeometry().center()); -- cgit v0.12