]> cloud.milkyroute.net Git - dolphin.git/blob - src/tests/testbase.h
Fix Dolphin session management regression
[dolphin.git] / src / tests / testbase.h
1 /*****************************************************************************
2 * Copyright (C) 2010-2011 by Frank Reininghaus (frank78ac@googlemail.com) *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 *****************************************************************************/
19
20 #ifndef TESTBASE_H
21 #define TESTBASE_H
22
23 #include <QtCore/QObject>
24
25 class QAbstractItemView;
26 class DolphinDirLister;
27 class DolphinModel;
28 class DolphinSortFilterProxyModel;
29 class DolphinView;
30
31 /**
32 * The class TestBase (which is a friend of DolphinView's) provides access to some
33 * parts of DolphinView to the unit tests.
34 *
35 * TODO: TestBase should also backup the DolphinSettings and restore them later!
36 */
37
38 class TestBase : public QObject
39 {
40 Q_OBJECT
41
42 public:
43
44 TestBase() {};
45 ~TestBase() {};
46
47 /** Returns the item view (icons, details, or columns) */
48 static QAbstractItemView* itemView(const DolphinView* view);
49
50 /**
51 * Waits until the view emits its finishedPathLoading(const KUrl&) signal.
52 * Asserts if the signal is not received within the given number of milliseconds.
53 */
54 static void waitForFinishedPathLoading(DolphinView* view, int milliseconds=20000);
55
56 /** Reloads the view and waits for the finishedPathLoading(const KUrl&) signal. */
57 static void reloadViewAndWait(DolphinView* view);
58
59 /** Returns the items shown in the view. The order corresponds to the sort order of the view. */
60 static QStringList viewItems(const DolphinView* view);
61
62 /** Returns the items which are selected in the view. The order corresponds to the sort order of the view. */
63 static QStringList selectedItems(const DolphinView* view);
64
65 };
66
67 #endif