From a2a78c98fc9737fcd7a126790f88b40fdcc38ae6 Mon Sep 17 00:00:00 2001 From: Frank Reininghaus Date: Sat, 4 Feb 2012 17:29:09 +0100 Subject: [PATCH] Simplify KItemListControllerTest::testKeyboardNavigation_data() Function-static variables do not help much in a function which is called exactly once. (cherry picked from commit 847c8ebfd3259a6f090db7451dd3350c6e01e0d2) --- src/tests/kitemlistcontrollertest.cpp | 59 +++++++++++---------------- 1 file changed, 24 insertions(+), 35 deletions(-) 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. -- 2.47.3