[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/apps/dolphin/src/tests
From:       Frank Reininghaus <frank78ac () googlemail ! com>
Date:       2011-01-26 13:12:50
Message-ID: 20110126131250.20D04AC8BA () svn ! kde ! org
[Download RAW message or body]

SVN commit 1217251 by freininghaus:

Improve DolphinViewTest_AllViewModes::testKeyboardFocus().

The test assumes that the view does not have the keyboard focus
initially. However, this may not be the case if this is the only test
to be executed (i.e., if testKeyboardFocus is passed to the test
executable on the command line). This commit transfers the keyboard
focus explicitly to another widget.


 M  +12 -1     dolphinviewtest_allviewmodes.cpp  


--- trunk/KDE/kdebase/apps/dolphin/src/tests/dolphinviewtest_allviewmodes.cpp #1217250:1217251
@@ -217,14 +217,25 @@
  * testKeyboardFocus() checks whether a view grabs the keyboard focus.
  *
  * A view may never grab the keyboard focus itself and must respect the focus-state
- * when switching the view mode.
+ * when switching the view mode, see
+ *
+ * https://bugs.kde.org/show_bug.cgi?id=261147
  */
 
 void DolphinViewTest_AllViewModes::testKeyboardFocus()
 {
     const DolphinView::Mode mode = m_view->mode();
 
+    // Move keyboard focus to another widget. To see that this is needed, run only this test,
+    // i.e., pass 'testKeyboardFocus' as a parameter on the command line.
+    QWidget widget;
+    widget.show();
+    QTest::qWaitForWindowShown(&widget);
+    widget.setFocus();
+
     QVERIFY(!m_view->hasFocus());
+
+    // Switch view modes and verify that the view does not get the focus back
     for (int i = 0; i <= DolphinView::MaxModeEnum; ++i) {
         m_view->setMode(static_cast<DolphinView::Mode>(i));
         QVERIFY(!m_view->hasFocus());
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic