|
18 | 18 | */ |
19 | 19 |
|
20 | 20 | #include <QtTest/QtTest> |
21 | | -#include "qtest_endorphin.h" |
22 | 21 |
|
23 | 22 | #include <historymanager.h> |
24 | | -#include <history.h> |
| 23 | +#include "history.h" |
25 | 24 | #include <historycompleter.h> |
26 | 25 | #include <modeltest.h> |
27 | 26 |
|
28 | 27 | #include <QWebEngineSettings> |
29 | 28 |
|
30 | | -class tst_HistoryManager : public QObject |
31 | | -{ |
32 | | - Q_OBJECT |
33 | | - |
34 | | -public slots: |
35 | | - void initTestCase(); |
36 | | - void cleanupTestCase(); |
37 | | - void init(); |
38 | | - void cleanup(); |
39 | | - |
40 | | -private slots: |
41 | | - void history_data(); |
42 | | - void history(); |
43 | | - void addHistoryEntry_data(); |
44 | | - void addHistoryEntry(); |
45 | | - void addHistoryEntry_private(); |
46 | | - void addHistoryEntry_url(); |
47 | | - void updateHistoryEntry_data(); |
48 | | - void updateHistoryEntry(); |
49 | | - void daysToExpire_data(); |
50 | | - void daysToExpire(); |
51 | | - void clear_data(); |
52 | | - void clear(); |
53 | | - void setHistory_data(); |
54 | | - void setHistory(); |
55 | | - void saveload_data(); |
56 | | - void saveload(); |
57 | | - |
58 | | - // TODO move to their own tests |
59 | | - void big(); |
60 | | - |
61 | | - void historyDialog_data(); |
62 | | - void historyDialog(); |
63 | | - |
64 | | -private: |
65 | | - QList<HistoryEntry> bigHistory; |
66 | | -}; |
67 | | - |
68 | | -// Subclass that exposes the protected functions. |
69 | | -class SubHistory : public HistoryManager |
70 | | -{ |
71 | | -public: |
72 | | - SubHistory() : HistoryManager() |
73 | | - { |
74 | | - QWidget w; |
75 | | - setParent(&w); |
76 | | - if (QWebHistoryInterface::defaultInterface() == this) |
77 | | - QWebHistoryInterface::setDefaultInterface(0); |
78 | | - setParent(0); |
79 | | - } |
80 | | - |
81 | | - ~SubHistory() { |
82 | | - setDaysToExpire(30); |
83 | | - } |
84 | | - |
85 | | - void prependHistoryEntry(const HistoryEntry &item) |
86 | | - { HistoryManager::prependHistoryEntry(item); } |
87 | | -}; |
| 29 | +#include "tst_historymanager.h" |
88 | 30 |
|
89 | 31 | // This will be called before the first test function is executed. |
90 | 32 | // It is only called once. |
@@ -209,17 +151,6 @@ void tst_HistoryManager::addHistoryEntry() |
209 | 151 | QCOMPARE(history.history(), expected); |
210 | 152 | } |
211 | 153 |
|
212 | | -void tst_HistoryManager::addHistoryEntry_private() |
213 | | -{ |
214 | | - SubHistory history; |
215 | | - history.setHistory(HistoryList()); |
216 | | - QWebEngineSettings *globalSettings = QWebEngineSettings::globalSettings(); |
217 | | - globalSettings->setAttribute(QWebEngineSettings::PrivateBrowsingEnabled, true); |
218 | | - history.prependHistoryEntry(HistoryEntry()); |
219 | | - globalSettings->setAttribute(QWebEngineSettings::PrivateBrowsingEnabled, false); |
220 | | - QVERIFY(history.history().isEmpty()); |
221 | | -} |
222 | | - |
223 | 154 | void tst_HistoryManager::addHistoryEntry_url() |
224 | 155 | { |
225 | 156 | SubHistory history; |
@@ -428,8 +359,6 @@ void tst_HistoryManager::big() |
428 | 359 |
|
429 | 360 | QCOMPARE(history.history().count(), bigHistory.count()); |
430 | 361 |
|
431 | | - HistoryMenu menu; |
432 | | - |
433 | 362 | HistoryModel model(&history); |
434 | 363 | ModelTest test(&model); |
435 | 364 | QCOMPARE(model.rowCount(), bigHistory.count()); |
@@ -547,5 +476,3 @@ void tst_HistoryManager::historyDialog() |
547 | 476 | } |
548 | 477 |
|
549 | 478 | QTEST_MAIN(tst_HistoryManager) |
550 | | -#include "tst_historymanager.moc" |
551 | | - |
0 commit comments