summaryrefslogtreecommitdiffstats
path: root/tests/auto/qmenubar
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-06-18 10:39:46 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-06-18 10:41:29 (GMT)
commitcc08a4d04894eace196631029731a3af37547b7f (patch)
tree4a2751fe03b6506090886d7333386fb477398661 /tests/auto/qmenubar
parentcab70bbf1d29a7cdf81d561fdd74e16f7280c689 (diff)
downloadQt-cc08a4d04894eace196631029731a3af37547b7f.zip
Qt-cc08a4d04894eace196631029731a3af37547b7f.tar.gz
Qt-cc08a4d04894eace196631029731a3af37547b7f.tar.bz2
QMenuBar: fixed highlight problem on actions without menu
An item without menu could stay highlighted even when the mouse left the menu bar. Task-number: 256322 Reviewed-by: alexis
Diffstat (limited to 'tests/auto/qmenubar')
-rw-r--r--tests/auto/qmenubar/tst_qmenubar.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp
index 5404d46..8a38782 100644
--- a/tests/auto/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/qmenubar/tst_qmenubar.cpp
@@ -149,6 +149,7 @@ private slots:
void check_shortcutPress();
void check_menuPosition();
void task223138_triggered();
+ void task256322_highlight();
#if defined(QT3_SUPPORT)
void indexBasedInsertion_data();
@@ -1520,6 +1521,41 @@ void tst_QMenuBar::task223138_triggered()
QCOMPARE(submenuSpy.count(), 1);
}
+void tst_QMenuBar::task256322_highlight()
+{
+ QMainWindow win;
+ QMenu menu;
+ QAction *file = win.menuBar()->addMenu(&menu);
+ file->setText("file");
+ QMenu menu2;
+ QAction *file2 = win.menuBar()->addMenu(&menu2);
+ file2->setText("file2");
+ QAction *nothing = win.menuBar()->addAction("nothing");
+
+ win.show();
+
+ QTest::mouseClick(win.menuBar(), Qt::LeftButton, 0, win.menuBar()->actionGeometry(file).center());
+ QVERIFY(menu.isVisible());
+ QVERIFY(!menu2.isVisible());
+ QCOMPARE(win.menuBar()->activeAction(), file);
+
+ QTest::mouseMove(win.menuBar(), win.menuBar()->actionGeometry(file2).center());
+ QVERIFY(!menu.isVisible());
+ QVERIFY(menu2.isVisible());
+ QCOMPARE(win.menuBar()->activeAction(), file2);
+
+ QTest::mouseMove(win.menuBar(), win.menuBar()->actionGeometry(nothing).center());
+ QVERIFY(!menu.isVisible());
+ QVERIFY(!menu2.isVisible());
+ QCOMPARE(win.menuBar()->activeAction(), nothing);
+
+ QTest::mouseMove(&win, win.menuBar()->geometry().bottomLeft() + QPoint(1,1));
+
+ QVERIFY(!menu.isVisible());
+ QVERIFY(!menu2.isVisible());
+ QVERIFY(!win.menuBar()->activeAction());
+}
+
#if defined(QT3_SUPPORT)
void tst_QMenuBar::indexBasedInsertion_data()