]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Simplify KItemListControllerTest::testKeyboardNavigation_data()
authorFrank Reininghaus <frank78ac@googlemail.com>
Sat, 4 Feb 2012 16:29:09 +0000 (17:29 +0100)
committerFrank Reininghaus <frank78ac@googlemail.com>
Sat, 4 Feb 2012 16:31:38 +0000 (17:31 +0100)
Function-static variables do not help much in a function which is
called exactly once.
(cherry picked from commit 847c8ebfd3259a6f090db7451dd3350c6e01e0d2)

src/tests/kitemlistcontrollertest.cpp

index 443faa35ffae9d63bbe04dd876f0400982d29054..7944d6d3490d700bc77b7b3a7bdf25719dc03ac1 100644 (file)
@@ -192,41 +192,30 @@ void KItemListControllerTest::testKeyboardNavigation_data()
     QTest::addColumn<bool>("groupingEnabled");
     QTest::addColumn<QList<QPair<KeyPress, ViewState> > >("testList");
 
-    static QList<KFileItemListView::Layout> layoutList;
-    static QHash<KFileItemListView::Layout, QString> layoutNames;
-    if (layoutList.isEmpty()) {
-        layoutList.append(KFileItemListView::IconsLayout);
-        layoutNames[KFileItemListView::IconsLayout] = "Icons";
-
-        layoutList.append(KFileItemListView::CompactLayout);
-        layoutNames[KFileItemListView::CompactLayout] = "Compact";
-
-        layoutList.append(KFileItemListView::DetailsLayout);
-        layoutNames[KFileItemListView::DetailsLayout] = "Details";
-    }
-
-    static QList<KItemListController::SelectionBehavior> selectionBehaviorList;
-    static QHash<KItemListController::SelectionBehavior, QString> selectionBehaviorNames;
-    if (selectionBehaviorList.isEmpty()) {
-        selectionBehaviorList.append(KItemListController::NoSelection);
-        selectionBehaviorNames[KItemListController::NoSelection] = "NoSelection";
-
-        selectionBehaviorList.append(KItemListController::SingleSelection);
-        selectionBehaviorNames[KItemListController::SingleSelection] = "SingleSelection";
-
-        selectionBehaviorList.append(KItemListController::MultiSelection);
-        selectionBehaviorNames[KItemListController::MultiSelection] = "MultiSelection";
-    }
-
-    static QList<bool> groupingEnabledList;
-    static QHash<bool, QString> groupingEnabledNames;
-    if (groupingEnabledList.isEmpty()) {
-        groupingEnabledList.append(false);
-        groupingEnabledNames[false] = "ungrouped";
-
-        groupingEnabledList.append(true);
-        groupingEnabledNames[true] = "grouping enabled";
-    }
+    QList<KFileItemListView::Layout> layoutList;
+    QHash<KFileItemListView::Layout, QString> layoutNames;
+    layoutList.append(KFileItemListView::IconsLayout);
+    layoutNames[KFileItemListView::IconsLayout] = "Icons";
+    layoutList.append(KFileItemListView::CompactLayout);
+    layoutNames[KFileItemListView::CompactLayout] = "Compact";
+    layoutList.append(KFileItemListView::DetailsLayout);
+    layoutNames[KFileItemListView::DetailsLayout] = "Details";
+
+    QList<KItemListController::SelectionBehavior> selectionBehaviorList;
+    QHash<KItemListController::SelectionBehavior, QString> selectionBehaviorNames;
+    selectionBehaviorList.append(KItemListController::NoSelection);
+    selectionBehaviorNames[KItemListController::NoSelection] = "NoSelection";
+    selectionBehaviorList.append(KItemListController::SingleSelection);
+    selectionBehaviorNames[KItemListController::SingleSelection] = "SingleSelection";
+    selectionBehaviorList.append(KItemListController::MultiSelection);
+    selectionBehaviorNames[KItemListController::MultiSelection] = "MultiSelection";
+
+    QList<bool> groupingEnabledList;
+    QHash<bool, QString> groupingEnabledNames;
+    groupingEnabledList.append(false);
+    groupingEnabledNames[false] = "ungrouped";
+    groupingEnabledList.append(true);
+    groupingEnabledNames[true] = "grouping enabled";
 
     foreach (KFileItemListView::Layout layout, layoutList) {
         // The following settings depend on the layout.