]> cloud.milkyroute.net Git - dolphin.git/commitdiff
1. Add method TestBase::reloadViewAndWait().
authorFrank Reininghaus <frank78ac@googlemail.com>
Tue, 9 Nov 2010 08:33:45 +0000 (08:33 +0000)
committerFrank Reininghaus <frank78ac@googlemail.com>
Tue, 9 Nov 2010 08:33:45 +0000 (08:33 +0000)
2. Remove some debug output from DolphinDetailsViewTest - it seems
that the test failure I saw on cdash.org is due to a failing kioslave,
which is probably not Dolphin's fault.

svn path=/trunk/KDE/kdebase/apps/; revision=1194514

src/tests/dolphindetailsviewtest.cpp
src/tests/testbase.cpp
src/tests/testbase.h

index 323806a0ec18719a62c6a89ad07748d744385384..20d5daebdb9505a34b979e4d6f11090171cdce6e 100644 (file)
 #include <qtestmouse.h>
 #include <qtestkeyboard.h>
 
-#include "kdebug.h"
-
 class DolphinDetailsViewTest : public TestBase
 {
     Q_OBJECT
 
 private slots:
 
-    void initTestCase();
-
     void bug217447_shiftArrowSelection();
     void bug234600_overlappingIconsWhenZooming();
 
 };
 
-void DolphinDetailsViewTest::initTestCase()
-{
-    // add time stamps to find origin of test failures due to timeout at
-    // http://my.cdash.org/index.php?project=kdebase&date=
-    qputenv("KDE_DEBUG_TIMESTAMP", QByteArray("1"));
-}
-
 /**
  * When the first item in the view is active and Shift is held while the "arrow down"
  * key is pressed repeatedly, the selection should grow by one item for each key press.
@@ -88,14 +77,7 @@ void DolphinDetailsViewTest::bug217447_shiftArrowSelection()
     m_view->resize(1000, 400);
     m_view->show();
     QTest::qWaitForWindowShown(m_view);
-
-    // We have to make sure that the view has loaded the directory before we start the test.
-    // TODO: This will be needed frequently. Maybe move to TestHelper.
-    QSignalSpy finished(m_view, SIGNAL(finishedPathLoading(const KUrl&)));
-    m_view->reload();
-    while (finished.count() != 1) {
-        QTest::qWait(50);
-    }
+    reloadViewAndWait();
 
     // Select the first item
     QModelIndex index0 = detailsView->model()->index(0, 0);
@@ -165,16 +147,7 @@ void DolphinDetailsViewTest::bug234600_overlappingIconsWhenZooming()
     m_view->resize(400, 400);
     m_view->show();
     QTest::qWaitForWindowShown(m_view);
-
-    // We have to make sure that the view has loaded the directory before we start the test.
-    // TODO: This will be needed frequently. Maybe move to TestHelper.
-    kDebug() << "Reloading view and waiting for the finishedPathLoading(const KUrl&) signal...";
-    QSignalSpy finished(m_view, SIGNAL(finishedPathLoading(const KUrl&)));
-    m_view->reload();
-    while (finished.count() != 1) {
-        QTest::qWait(50);
-    }
-    kDebug() << "...signal received, continuing";
+    reloadViewAndWait();
 
     QModelIndex index0 = detailsView->model()->index(0, 0);
     detailsView->setCurrentIndex(index0);
@@ -189,12 +162,9 @@ void DolphinDetailsViewTest::bug234600_overlappingIconsWhenZooming()
     detailsView->setCurrentIndex(index1);
     QCOMPARE(detailsView->currentIndex(), index1);
 
-    kDebug() << "Now checking zoom levels...";
-
     // Increase the zoom level successively to the maximum.
     while(zoomLevel < ZoomLevelInfo::maximumLevel()) {
         zoomLevel++;
-        kDebug() << "Testing zoom level" << zoomLevel;
         m_view->setZoomLevel(zoomLevel);
 
         //Check for each zoom level that the height of each item is at least the icon size.
@@ -202,10 +172,7 @@ void DolphinDetailsViewTest::bug234600_overlappingIconsWhenZooming()
     }
 
     m_view->hide();
-
-    kDebug() << "Cleaning up test directory...";
     cleanupTestDir();
-    kDebug() << "Done.";
 }
 
 QTEST_KDEMAIN(DolphinDetailsViewTest, GUI)
index 5945cd258882df02ea520e8d31f2a1f0caa072f8..0fd48cbd2f93d877ca65e221e870e3043da74b57 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"
@@ -29,6 +31,8 @@
 #include <QtCore/QDir>
 #include <QtGui/QAbstractItemView>
 
+#include <kdebug.h>
+
 TestBase::TestBase()
 {
     m_tempDir = new KTempDir;
@@ -60,6 +64,16 @@ QAbstractItemView* TestBase::itemView () const
     return m_view->m_viewAccessor.itemView();
 }
 
+void TestBase::reloadViewAndWait()
+{
+    kDebug() << "Reloading view and waiting for the finishedPathLoading(const KUrl&) signal...";
+    QSignalSpy finished(m_view, SIGNAL(finishedPathLoading(const KUrl&)));
+    m_view->reload();
+    while (finished.count() != 1) {
+        QTest::qWait(50);
+    }
+    kDebug() << "...signal received, continuing";
+}
 
 KUrl TestBase::testDirUrl() const
 {
index 121c230ca0e3ebe39197e68edd56300931ab57ad..a940a529675831671619bbb4bd2d4ef90d260e9f 100644 (file)
@@ -49,7 +49,10 @@ public:
     ~TestBase();
 
     // Returns the item view (icons, details, or columns)
-    QAbstractItemView* itemView () const;
+    QAbstractItemView* itemView() const;
+
+    // Reloads the view and waits for the finishedPathLoading(const KUrl&) signal.
+    void reloadViewAndWait();
 
     KUrl testDirUrl() const;