diff options
| author | Frank Reininghaus <[email protected]> | 2012-02-04 17:29:09 +0100 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2012-02-04 17:31:38 +0100 |
| commit | a2a78c98fc9737fcd7a126790f88b40fdcc38ae6 (patch) | |
| tree | 009e6c4a0c702af4d58352a6c0c7e823d8459ea6 /src/tests/kitemlistcontrollertest.cpp | |
| parent | 1041f340a2ddb634476c5d84585a56c29e5a70fd (diff) | |
Simplify KItemListControllerTest::testKeyboardNavigation_data()
Function-static variables do not help much in a function which is
called exactly once.
(cherry picked from commit 847c8ebfd3259a6f090db7451dd3350c6e01e0d2)
Diffstat (limited to 'src/tests/kitemlistcontrollertest.cpp')
| -rw-r--r-- | src/tests/kitemlistcontrollertest.cpp | 55 |
1 files changed, 22 insertions, 33 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<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"; + 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"; - layoutList.append(KFileItemListView::CompactLayout); - layoutNames[KFileItemListView::CompactLayout] = "Compact"; + 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"; - 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<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. |
