summaryrefslogtreecommitdiffstats
path: root/tests/auto/qmenubar
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-10-26 14:54:18 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-10-27 09:45:13 (GMT)
commit68ab3b34571cfdde4002de9982388f9eec4d9939 (patch)
tree32594d5ba2dba363d0afdf87df136f0249617224 /tests/auto/qmenubar
parent2d750192e73244f5b4ad6b451f264728d42669be (diff)
downloadQt-68ab3b34571cfdde4002de9982388f9eec4d9939.zip
Qt-68ab3b34571cfdde4002de9982388f9eec4d9939.tar.gz
Qt-68ab3b34571cfdde4002de9982388f9eec4d9939.tar.bz2
Fixed a bug in QMenuBar in RTL that would display menu at the wrong place
This could happen when adding actions in response to the aboutToShow signal. Task-number: QT-2596 Reviewed-by: ogoffart
Diffstat (limited to 'tests/auto/qmenubar')
-rw-r--r--tests/auto/qmenubar/tst_qmenubar.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp
index 07aa9f4..4291c3e 100644
--- a/tests/auto/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/qmenubar/tst_qmenubar.cpp
@@ -86,6 +86,18 @@ private:
uint sel_count;
};
+class Menu : public QMenu
+{
+ Q_OBJECT
+ public slots:
+ void addActions()
+ {
+ //this will change the geometry of the menu
+ addAction("action1");
+ addAction("action2");
+ }
+};
+
class tst_QMenuBar : public QObject
{
Q_OBJECT
@@ -1442,7 +1454,7 @@ void tst_QMenuBar::check_menuPosition()
#ifdef Q_OS_WINCE_WM
QSKIP("Qt/CE uses native menubar", SkipAll);
#endif
- QMenu menu;
+ Menu menu;
#ifdef QT3_SUPPORT
initComplexMenubar();
#else
@@ -1496,6 +1508,21 @@ void tst_QMenuBar::check_menuPosition()
menu.close();
}
+ //in RTL, the menu should be stuck at the right of the action geometry
+ {
+ Qt::LayoutDirection dir = qApp->layoutDirection();
+ qApp->setLayoutDirection(Qt::RightToLeft);
+ menu.clear();
+ QObject::connect(&menu, SIGNAL(aboutToShow()), &menu, SLOT(addActions()));
+ QRect mbItemRect = mw->menuBar()->actionGeometry(menu_action);
+ mbItemRect.moveTo(mw->menuBar()->mapToGlobal(mbItemRect.topLeft()));
+ QTest::keyClick(mw, Qt::Key_M, Qt::AltModifier );
+ QVERIFY(menu.isActiveWindow());
+ QCOMPARE(menu.geometry().right(), mbItemRect.right());
+ menu.close();
+ qApp->setLayoutDirection(dir);
+ }
+
}
void tst_QMenuBar::task223138_triggered()