From: Frank Reininghaus Date: Sat, 4 Feb 2012 16:29:09 +0000 (+0100) Subject: Simplify KItemListControllerTest::testKeyboardNavigation_data() X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/a2a78c98fc9737fcd7a126790f88b40fdcc38ae6 Simplify KItemListControllerTest::testKeyboardNavigation_data() Function-static variables do not help much in a function which is called exactly once. (cherry picked from commit 847c8ebfd3259a6f090db7451dd3350c6e01e0d2) --- diff --git a/src/tests/kitemlistcontrollertest.cpp b/src/tests/kitemlistcontrollertest.cpp index 443faa35f..7944d6d34 100644 --- a/src/tests/kitemlistcontrollertest.cpp +++ b/src/tests/kitemlistcontrollertest.cpp @@ -192,41 +192,30 @@ void KItemListControllerTest::testKeyboardNavigation_data() QTest::addColumn("groupingEnabled"); QTest::addColumn > >("testList"); - static QList layoutList; - static QHash 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 selectionBehaviorList; - static QHash 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 groupingEnabledList; - static QHash groupingEnabledNames; - if (groupingEnabledList.isEmpty()) { - groupingEnabledList.append(false); - groupingEnabledNames[false] = "ungrouped"; - - groupingEnabledList.append(true); - groupingEnabledNames[true] = "grouping enabled"; - } + QList layoutList; + QHash 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 selectionBehaviorList; + QHash 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 groupingEnabledList; + QHash 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.