]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/tests/testbase.cpp
Improve DolphinTreeViewTest's stability.
[dolphin.git] / src / tests / testbase.cpp
index 5945cd258882df02ea520e8d31f2a1f0caa072f8..db71fa48c4f0e3b58e8aa0149deea75ba7fc3801 100644 (file)
@@ -19,6 +19,8 @@
 
 #include "testbase.h"
 
+#include <qtest_kde.h>
+
 #include "views/dolphinview.h"
 #include "views/dolphinmodel.h"
 #include "views/dolphindirlister.h"
 #include <QtCore/QDir>
 #include <QtGui/QAbstractItemView>
 
+#include <kdebug.h>
+
 TestBase::TestBase()
 {
     m_tempDir = new KTempDir;
     Q_ASSERT(m_tempDir->exists());
     m_path = m_tempDir->name();
     m_dir = new QDir(m_path);
-    m_dirLister = new DolphinDirLister();
-    m_dirLister->setAutoUpdate(true);
-    m_dolphinModel = new DolphinModel();
-    m_dolphinModel->setDirLister(m_dirLister);
-    m_proxyModel = new DolphinSortFilterProxyModel(0);
-    m_proxyModel->setSourceModel(m_dolphinModel);
-    m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
-    m_view = new DolphinView(0, KUrl(m_path), m_proxyModel);
+    m_view = new DolphinView(KUrl(m_path), 0);
 }
 
 TestBase::~TestBase()
 {
     delete m_view;
-    delete m_proxyModel;
-    // m_dolphinModel owns m_dirLister -> do not delete it here!
-    delete m_dolphinModel;
     delete m_dir;
     delete m_tempDir;
 }
@@ -60,6 +54,11 @@ QAbstractItemView* TestBase::itemView () const
     return m_view->m_viewAccessor.itemView();
 }
 
+void TestBase::reloadViewAndWait()
+{
+    m_view->reload();
+    QVERIFY(QTest::kWaitForSignal(m_view, SIGNAL(finishedPathLoading(const KUrl&)), 2000));
+}
 
 KUrl TestBase::testDirUrl() const
 {