┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/tests/kitemlistcontrollertest.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2012-04-21 21:28:16 +0200
committerPeter Penz <[email protected]>2012-04-21 21:32:42 +0200
commitae4d11d918938fd9087f2035dac247969c1f2313 (patch)
tree0303667797c81814b46b9ed5ed20b48ef31f2d71 /src/tests/kitemlistcontrollertest.cpp
parent47d7cdffdd2d2c04067a5088eaeff67add53dde3 (diff)
Prepare view-engine for non-KFileItem usecase
Up to now the view-engine only provided a model-implementation that supports file-items. The view-engine always had been designed to be able to work with any kind of model, so now a KStandardItemModel is available. The plan is to convert the places panel to the new view-engine. It should be no problem to fix this until the feature freeze - in the worst case the places-panel code could be reverted while still keeping the KStandardItemModel changes.
Diffstat (limited to 'src/tests/kitemlistcontrollertest.cpp')
-rw-r--r--src/tests/kitemlistcontrollertest.cpp27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/tests/kitemlistcontrollertest.cpp b/src/tests/kitemlistcontrollertest.cpp
index 3b67e7b50..47b2b8b75 100644
--- a/src/tests/kitemlistcontrollertest.cpp
+++ b/src/tests/kitemlistcontrollertest.cpp
@@ -33,7 +33,7 @@ namespace {
const int DefaultTimeout = 2000;
};
-Q_DECLARE_METATYPE(KFileItemListView::Layout);
+Q_DECLARE_METATYPE(KFileItemListView::ItemLayout);
Q_DECLARE_METATYPE(Qt::Orientation);
Q_DECLARE_METATYPE(KItemListController::SelectionBehavior);
Q_DECLARE_METATYPE(QSet<int>);
@@ -79,15 +79,13 @@ void KItemListControllerTest::initTestCase()
m_testDir = new TestDir();
m_model = new KFileItemModel();
- m_container = new KItemListContainer();
+ m_view = new KFileItemListView();
+ m_controller = new KItemListController(m_model, m_view, this);
+ m_container = new KItemListContainer(m_controller);
m_controller = m_container->controller();
m_controller->setSelectionBehavior(KItemListController::MultiSelection);
m_selectionManager = m_controller->selectionManager();
- m_view = new KFileItemListView();
- m_controller->setView(m_view);
- m_controller->setModel(m_model);
-
QStringList files;
files
<< "a1" << "a2" << "a3"
@@ -106,15 +104,8 @@ void KItemListControllerTest::initTestCase()
void KItemListControllerTest::cleanupTestCase()
{
- delete m_view;
- m_view = 0;
-
delete m_container;
m_container = 0;
- m_controller = 0;
-
- delete m_model;
- m_model = 0;
delete m_testDir;
m_testDir = 0;
@@ -187,15 +178,15 @@ Q_DECLARE_METATYPE(QList<keyPressViewStatePair>);
*/
void KItemListControllerTest::testKeyboardNavigation_data()
{
- QTest::addColumn<KFileItemListView::Layout>("layout");
+ QTest::addColumn<KFileItemListView::ItemLayout>("layout");
QTest::addColumn<Qt::Orientation>("scrollOrientation");
QTest::addColumn<int>("columnCount");
QTest::addColumn<KItemListController::SelectionBehavior>("selectionBehavior");
QTest::addColumn<bool>("groupingEnabled");
QTest::addColumn<QList<QPair<KeyPress, ViewState> > >("testList");
- QList<KFileItemListView::Layout> layoutList;
- QHash<KFileItemListView::Layout, QString> layoutNames;
+ QList<KFileItemListView::ItemLayout> layoutList;
+ QHash<KFileItemListView::ItemLayout, QString> layoutNames;
layoutList.append(KFileItemListView::IconsLayout);
layoutNames[KFileItemListView::IconsLayout] = "Icons";
layoutList.append(KFileItemListView::CompactLayout);
@@ -219,7 +210,7 @@ void KItemListControllerTest::testKeyboardNavigation_data()
groupingEnabledList.append(true);
groupingEnabledNames[true] = "grouping enabled";
- foreach (KFileItemListView::Layout layout, layoutList) {
+ foreach (KFileItemListView::ItemLayout layout, layoutList) {
// The following settings depend on the layout.
// Note that 'columns' are actually 'rows' in
// Compact layout.
@@ -443,7 +434,7 @@ void KItemListControllerTest::testKeyboardNavigation_data()
*/
void KItemListControllerTest::testKeyboardNavigation()
{
- QFETCH(KFileItemListView::Layout, layout);
+ QFETCH(KFileItemListView::ItemLayout, layout);
QFETCH(Qt::Orientation, scrollOrientation);
QFETCH(int, columnCount);
QFETCH(KItemListController::SelectionBehavior, selectionBehavior);