diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-04-15 09:51:17 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-04-15 09:51:17 (GMT) |
commit | 8f223e03effba1aef6be5e50caf7482af1d7dd8a (patch) | |
tree | 263013a746d71fa88503d8939521d8dd8e7cd3d4 /tests | |
parent | 4e78de5a4281bd1c27a984b13887975798573aae (diff) | |
download | Qt-8f223e03effba1aef6be5e50caf7482af1d7dd8a.zip Qt-8f223e03effba1aef6be5e50caf7482af1d7dd8a.tar.gz Qt-8f223e03effba1aef6be5e50caf7482af1d7dd8a.tar.bz2 |
The submenu of a multicolumn menu have an incorrect position
The submenu would always appear to the side of the menu instead of its
right.
Task-number: 250673
Reviewed-by: ogoffart
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qmenu/tst_qmenu.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index 7607838..a86b754 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -92,6 +92,7 @@ private slots: void activeSubMenuPosition(); void task242454_sizeHint(); void task176201_clear(); + void task250673_activeMutliColumnSubMenuPosition(); protected slots: void onActivated(QAction*); void onHighlighted(QAction*); @@ -678,6 +679,39 @@ void tst_QMenu::task176201_clear() QTest::mouseClick(&menu, Qt::LeftButton, 0, menu.rect().center()); } +void tst_QMenu::task250673_activeMutliColumnSubMenuPosition() +{ + class MyMenu : public QMenu + { + public: + friend class tst_QMenu; + }; + + QMenu sub; + sub.addAction("Sub-Item1"); + QAction *subAction = sub.addAction("Sub-Item2"); + + MyMenu main; + main.addAction("Item 1"); + QAction *menuAction = main.addMenu(&sub); + main.popup(QPoint(200,200)); + + uint i = 2; + while (main.columnCount() < 2) { + main.addAction(QString("Item %1").arg(i)); + ++i; + Q_ASSERT(i<1000); + } + main.setActiveAction(menuAction); + sub.setActiveAction(subAction); + QVERIFY(main.isVisible()); + QCOMPARE(main.activeAction(), menuAction); + QVERIFY(sub.isVisible()); + QVERIFY(sub.pos().x() > main.pos().x()); + + const int subMenuOffset = main.style()->pixelMetric(QStyle::PM_SubMenuOverlap, 0, &main); + QVERIFY((sub.geometry().left() - subMenuOffset + 5) < main.geometry().right()); +} QTEST_MAIN(tst_QMenu) #include "tst_qmenu.moc" |