]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/tests/kitemlistcontrollertest.cpp
[Details mode] Allow to fill the column size of directories with actual size
[dolphin.git] / src / tests / kitemlistcontrollertest.cpp
index 926a781675f044be8c1e047a31c6d3bfc52e76a8..4cb1256e33d80ad62a54c371d4a68cb41da96b0f 100644 (file)
@@ -139,11 +139,11 @@ void KItemListControllerTest::initTestCase()
 
     m_testDir->createFiles(files);
     m_model->loadDirectory(m_testDir->url());
-    QSignalSpy spyDirectoryLoadingCompleted(m_model, SIGNAL(directoryLoadingCompleted()));
+    QSignalSpy spyDirectoryLoadingCompleted(m_model, &KFileItemModel::directoryLoadingCompleted);
     QVERIFY(spyDirectoryLoadingCompleted.wait());
 
     m_container->show();
-    QTest::qWaitForWindowExposed(m_container);
+    QVERIFY(QTest::qWaitForWindowExposed(m_container));
 }
 
 void KItemListControllerTest::cleanupTestCase()
@@ -197,7 +197,7 @@ struct KeyPress {
  */
 struct ViewState {
 
-    ViewState(int current, const KItemSet selection, bool activated = false) :
+    ViewState(int current, const KItemSet &selection, bool activated = false) :
         m_current(current),
         m_selection(selection),
         m_activated(activated)
@@ -326,6 +326,12 @@ void KItemListControllerTest::testKeyboardNavigation_data()
                         << qMakePair(KeyPress(Qt::Key_E), ViewState(13, KItemSet() << 13))
                         << qMakePair(KeyPress(Qt::Key_Space), ViewState(14, KItemSet() << 14))
                         << qMakePair(KeyPress(Qt::Key_3), ViewState(15, KItemSet() << 15))
+                        << qMakePair(KeyPress(Qt::Key_Escape), ViewState(15, KItemSet()))
+                        << qMakePair(KeyPress(Qt::Key_E), ViewState(13, KItemSet() << 13))
+                        << qMakePair(KeyPress(Qt::Key_E), ViewState(14, KItemSet() << 14))
+                        << qMakePair(KeyPress(Qt::Key_E), ViewState(15, KItemSet() << 15))
+                        << qMakePair(KeyPress(Qt::Key_Escape), ViewState(15, KItemSet()))
+                        << qMakePair(KeyPress(Qt::Key_E), ViewState(13, KItemSet() << 13))
                         << qMakePair(KeyPress(Qt::Key_Home), ViewState(0, KItemSet() << 0))
                         << qMakePair(KeyPress(Qt::Key_Escape), ViewState(0, KItemSet()));
 
@@ -507,8 +513,8 @@ void KItemListControllerTest::testKeyboardNavigation()
     adjustGeometryForColumnCount(columnCount);
     QCOMPARE(m_view->m_layouter->m_columnCount, columnCount);
 
-    QSignalSpy spySingleItemActivated(m_controller, SIGNAL(itemActivated(int)));
-    QSignalSpy spyMultipleItemsActivated(m_controller, SIGNAL(itemsActivated(KItemSet)));
+    QSignalSpy spySingleItemActivated(m_controller, &KItemListController::itemActivated);
+    QSignalSpy spyMultipleItemsActivated(m_controller, &KItemListController::itemsActivated);
 
     while (!testList.isEmpty()) {
         const QPair<KeyPress, ViewState> test = testList.takeFirst();
@@ -545,6 +551,7 @@ void KItemListControllerTest::testKeyboardNavigation()
                 }
                 // No items are selected. Therefore, the current item should be activated.
                 // This is handled by falling through to the NoSelection/SingleSelection case.
+                Q_FALLTHROUGH();
             case KItemListController::NoSelection:
             case KItemListController::SingleSelection:
                 // In NoSelection and SingleSelection mode, the current item should be activated.
@@ -584,7 +591,7 @@ void KItemListControllerTest::testMouseClickActivation()
     mouseReleaseEvent.setButton(Qt::LeftButton);
     mouseReleaseEvent.setButtons(Qt::NoButton);
 
-    QSignalSpy spyItemActivated(m_controller, SIGNAL(itemActivated(int)));
+    QSignalSpy spyItemActivated(m_controller, &KItemListController::itemActivated);
 
     // Default setting: single click activation.
     m_testStyle->setActivateItemOnSingleClick(true);