Improve QMenu autotest
authorJason McDonald <jason.mcdonald@nokia.com>
Mon, 31 Oct 2011 06:36:42 +0000 (16:36 +1000)
committerQt by Nokia <qt-info@nokia.com>
Mon, 31 Oct 2011 23:25:34 +0000 (00:25 +0100)
The test for keyboard navigation was only checking correct highlighting
when a menu item was not activated by the latest key-click.  It should
also check that no item is highlighted after an item is activated.

Change-Id: I443e154be5cdc2def4f12d3f0abab2cc1bc6e4a8
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp

index ef50a52..61bbd54 100644 (file)
@@ -360,9 +360,12 @@ void tst_QMenu::keyboardNavigation()
         QCOMPARE(menus[expected_menu]->activeAction(), (QAction *)0);
     } else {
         QCOMPARE(menus[expected_menu]->activeAction(), builtins[expected_action]);
-        if (expected_highlighted)
-            QCOMPARE(menus[expected_menu]->activeAction(), highlighted);
     }
+
+    if (expected_highlighted)
+        QCOMPARE(menus[expected_menu]->activeAction(), highlighted);
+    else
+        QCOMPARE(highlighted, (QAction *)0);
 }
 
 #ifdef Q_WS_MAC