]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Add test for the keyboard-focus
authorPeter Penz <peter.penz19@gmail.com>
Sat, 1 Jan 2011 20:46:51 +0000 (20:46 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sat, 1 Jan 2011 20:46:51 +0000 (20:46 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=1210707

src/tests/dolphinviewtest_allviewmodes.cpp
src/tests/dolphinviewtest_allviewmodes.h

index 3609efbd72cd71da63f22f2b0a60af7193aafc4d..2873e2c7e94fc35a9624ea22867989c126cd242c 100644 (file)
@@ -109,6 +109,21 @@ void DolphinViewTest_AllViewModes::testSelection() {
     verifySelectedItemsCount(5);
 }
 
+void DolphinViewTest_AllViewModes::testKeyboardFocus()
+{
+    const DolphinView::Mode mode = m_view->mode();
+
+    // The view may not grab the keyboard focus itself. Also when switching
+    // the view-mode, the focus-state must remain.
+    QVERIFY(!m_view->hasFocus());
+    for (int i = 0; i <= DolphinView::MaxModeEnum; ++i) {
+        m_view->setMode(static_cast<DolphinView::Mode>(i));
+        QVERIFY(!m_view->hasFocus());
+    }
+
+    m_view->setMode(mode);
+}
+
 /**
  * verifySelectedItemsCount(int) waits until the DolphinView's selectionChanged(const KFileItemList&)
  * signal is received and checks that the selection state of the view is as expected.
index 59df22fc96f8642cca6c9528a008f996e30af37b..feaa9d9fcec321398175127a37a5bcaa621b4cb8 100644 (file)
@@ -50,6 +50,8 @@ private slots:
 
     void testSelection();
 
+    void testKeyboardFocus();
+
 public:
 
     /** Returns the view mode (Icons, Details, Columns) to be used in the test. */