summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-11-17 16:33:14 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-11-18 12:09:16 (GMT)
commit6f55976270b22142da78b80abbebf018539587de (patch)
tree33963225cd9bc45e911e5230a33bdc45be6e8927 /tests
parentb6070e9a069219e4049fcf017d6a160b80bf37b7 (diff)
downloadQt-6f55976270b22142da78b80abbebf018539587de.zip
Qt-6f55976270b22142da78b80abbebf018539587de.tar.gz
Qt-6f55976270b22142da78b80abbebf018539587de.tar.bz2
QMenu: make the menu follow its parent/caused layout direction
The autotest are included Task-number: QTBUG-5884 Reviewed-by: ogoffart
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qmenu/tst_qmenu.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp
index f0f69a4..7cdfe46 100644
--- a/tests/auto/qmenu/tst_qmenu.cpp
+++ b/tests/auto/qmenu/tst_qmenu.cpp
@@ -87,6 +87,7 @@ private slots:
void widgetActionFocus();
void mouseActivation();
void tearOff();
+ void layoutDirection();
#if defined(QT3_SUPPORT)
void indexBasedInsertion_data();
@@ -596,6 +597,31 @@ void tst_QMenu::tearOff()
QVERIFY(!torn->isVisible());
}
+void tst_QMenu::layoutDirection()
+{
+ QMainWindow win;
+ win.setLayoutDirection(Qt::RightToLeft);
+
+ QMenu menu(&win);
+ menu.show();
+ QTest::qWaitForWindowShown(&menu);
+ QCOMPARE(menu.layoutDirection(), Qt::RightToLeft);
+ menu.close();
+
+ menu.setParent(0);
+ menu.show();
+ QTest::qWaitForWindowShown(&menu);
+ QCOMPARE(menu.layoutDirection(), QApplication::layoutDirection());
+ menu.close();
+
+ //now the menubar
+ QAction *action = win.menuBar()->addMenu(&menu);
+ win.menuBar()->setActiveAction(action);
+ QTest::qWaitForWindowShown(&menu);
+ QCOMPARE(menu.layoutDirection(), Qt::RightToLeft);
+}
+
+
#if defined(QT3_SUPPORT)
void tst_QMenu::indexBasedInsertion_data()