Warning: That file was not part of the compilation database. It may have many parsing errors.
1 | /** |
---|---|
2 | * This file is part of the KDE project |
3 | * |
4 | * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> |
5 | * |
6 | * This library is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU Library General Public |
8 | * License as published by the Free Software Foundation; either |
9 | * version 2 of the License, or (at your option) any later version. |
10 | * |
11 | * This library is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | * Library General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU Library General Public License |
17 | * along with this library; see the file COPYING.LIB. If not, write to |
18 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | * Boston, MA 02110-1301, USA. |
20 | * |
21 | */ |
22 | |
23 | #ifndef TEST_REGRESSION_WINDOW_H |
24 | #define TEST_REGRESSION_WINDOW_H |
25 | |
26 | #include <kurl.h> |
27 | #include <kio/job.h> |
28 | |
29 | #include <QtCore/QQueue> |
30 | #include <QtCore/QProcess> |
31 | |
32 | #include "khtml_part.h" |
33 | #include "ui_test_regression_gui.h" |
34 | |
35 | class TestRegressionWindow : public QMainWindow |
36 | { |
37 | Q_OBJECT |
38 | |
39 | public: |
40 | TestRegressionWindow(QWidget *parent = 0); |
41 | virtual ~TestRegressionWindow(); |
42 | |
43 | private Q_SLOTS: |
44 | void toggleJSTests(bool checked); |
45 | void toggleHTMLTests(bool checked); |
46 | void toggleDebugOutput(bool checked); |
47 | void toggleNoXvfbUse(bool checked); |
48 | |
49 | void setTestsDirectory(); |
50 | void setKHTMLDirectory(); |
51 | void setOutputDirectory(); |
52 | |
53 | void directoryListingResult(KIO::Job *job, const KIO::UDSEntryList &list); |
54 | void directoryListingFinished(KJob *job); |
55 | |
56 | void pauseContinueButtonClicked(); |
57 | void saveLogButtonClicked(); |
58 | |
59 | void treeWidgetContextMenuRequested(const QPoint &pos); |
60 | |
61 | void runTests(); |
62 | void runSingleTest(); |
63 | |
64 | void processQueue(); |
65 | |
66 | void testerExited(int exitCode, QProcess::ExitStatus exitStatus); |
67 | void testerReceivedData(); |
68 | |
69 | void addToIgnores(); |
70 | void removeFromIgnores(); |
71 | |
72 | private: // Helpers |
73 | enum TestResult |
74 | { |
75 | Unknown = 0, |
76 | Crash = 1, |
77 | Pass = 2, |
78 | PassUnexpected = 3, |
79 | Fail = 4, |
80 | FailKnown = 5 |
81 | }; |
82 | |
83 | void initLegend(); |
84 | void initOutputBrowser(); |
85 | void initTestsDirectory(); |
86 | void initRegressionTesting(const QString &testFileName); |
87 | void updateItemStatus(TestResult result, QTreeWidgetItem *item, const QString &testFileName); |
88 | void updateLogOutput(const QString &data); |
89 | void updateProgressBarRange() const; |
90 | void parseRegressionTestingOutput(QString data, TestResult result, const QString &cacheName); |
91 | |
92 | unsigned long countLogLines() const; |
93 | |
94 | QString extractTestNameFromData(QString &data, TestResult &result) const; |
95 | QStringList readListFile(const QString &fileName) const; |
96 | void writeListFile(const QString &fileName, const QStringList &content) const; |
97 | void loadOutputHTML() const; |
98 | |
99 | QString pathFromItem(const QTreeWidgetItem *item) const; |
100 | |
101 | public: |
102 | // Flags |
103 | enum ProcessArgument |
104 | { |
105 | None = 0x0, |
106 | JSTests = 0x1, |
107 | HTMLTests = 0x2, |
108 | DebugOutput = 0x4, |
109 | NoXvfbUse = 0x8 |
110 | }; |
111 | |
112 | Q_DECLARE_FLAGS(ProcessArguments, ProcessArgument) |
113 | |
114 | private: |
115 | Ui::MainWindow m_ui; |
116 | |
117 | ProcessArguments m_flags; |
118 | |
119 | long m_runCounter; |
120 | long m_testCounter; |
121 | |
122 | unsigned long m_totalTests; |
123 | unsigned long m_totalTestsJS; |
124 | unsigned long m_totalTestsDOMTS; |
125 | |
126 | KUrl m_khtmlUrl; |
127 | KUrl m_testsUrl; |
128 | KUrl m_outputUrl; |
129 | KUrl m_saveLogUrl; |
130 | |
131 | // Temporary variables |
132 | TestResult m_lastResult; |
133 | QString m_lastName; |
134 | |
135 | // Status pixmaps |
136 | QPixmap m_failPixmap; |
137 | QPixmap m_failKnownPixmap; |
138 | QPixmap m_passPixmap; |
139 | QPixmap m_passUnexpectedPixmap; |
140 | QPixmap m_crashPixmap; |
141 | QPixmap m_ignorePixmap; |
142 | QPixmap m_noBaselinePixmap; |
143 | |
144 | KHTMLPart *m_browserPart; |
145 | QProcess *m_activeProcess; |
146 | QTreeWidgetItem *m_activeTreeItem; |
147 | |
148 | // Caches |
149 | QMap<QString, QTreeWidgetItem *> m_itemMap; |
150 | |
151 | QMap<QString, QStringList> m_ignoreMap; |
152 | QMap<QString, QStringList> m_failureMap; |
153 | QMap<QString, QStringList> m_directoryMap; |
154 | |
155 | bool m_suspended; |
156 | |
157 | // Processing queue |
158 | bool m_justProcessingQueue; |
159 | QQueue<QString> m_processingQueue; |
160 | }; |
161 | |
162 | Q_DECLARE_OPERATORS_FOR_FLAGS(TestRegressionWindow::ProcessArguments) |
163 | |
164 | #endif |
165 | |
166 | // vim:ts=4:tw=4:noet |
167 |
Warning: That file was not part of the compilation database. It may have many parsing errors.