File: test_regression_gui_window.h

package info (click to toggle)
khtml 5.54.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 18,940 kB
  • sloc: cpp: 206,281; java: 4,060; ansic: 2,829; perl: 2,313; yacc: 1,497; python: 339; sh: 141; xml: 37; makefile: 7
file content (163 lines) | stat: -rw-r--r-- 4,393 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/**
 * This file is part of the KDE project
 *
 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 */

#ifndef TEST_REGRESSION_WINDOW_H
#define TEST_REGRESSION_WINDOW_H

#include <kio/job.h>

#include <QQueue>
#include <QProcess>
#include <QUrl>

#include "khtml_part.h"
#include "ui_test_regression_gui.h"

class TestRegressionWindow : public QMainWindow
{
    Q_OBJECT

public:
    TestRegressionWindow(QWidget *parent = 0);
    virtual ~TestRegressionWindow();

private Q_SLOTS:
    void toggleJSTests(bool checked);
    void toggleHTMLTests(bool checked);
    void toggleDebugOutput(bool checked);
    void toggleNoXvfbUse(bool checked);

    void setTestsDirectory();
    void setKHTMLDirectory();
    void setOutputDirectory();

    void directoryListingResult(KIO::Job *job, const KIO::UDSEntryList &list);
    void directoryListingFinished(KJob *job);

    void pauseContinueButtonClicked();
    void saveLogButtonClicked();

    void treeWidgetContextMenuRequested(const QPoint &pos);

    void runTests();
    void runSingleTest();

    void processQueue();

    void testerExited(int exitCode, QProcess::ExitStatus exitStatus);
    void testerReceivedData();

    void addToIgnores();
    void removeFromIgnores();

private: // Helpers
    enum TestResult {
        Unknown         = 0,
        Crash           = 1,
        Pass            = 2,
        PassUnexpected  = 3,
        Fail            = 4,
        FailKnown       = 5
    };

    void initLegend();
    void initOutputBrowser();
    void initTestsDirectory();
    void initRegressionTesting(const QString &testFileName);
    void updateItemStatus(TestResult result, QTreeWidgetItem *item, const QString &testFileName);
    void updateLogOutput(const QString &data);
    void updateProgressBarRange() const;
    void parseRegressionTestingOutput(QString data, TestResult result, const QString &cacheName);

    unsigned long countLogLines() const;

    QString extractTestNameFromData(QString &data, TestResult &result) const;
    QStringList readListFile(const QString &fileName) const;
    void writeListFile(const QString &fileName, const QStringList &content) const;
    void loadOutputHTML() const;

    QString pathFromItem(const QTreeWidgetItem *item) const;

public:
    // Flags
    enum ProcessArgument {
        None        = 0x0,
        JSTests     = 0x1,
        HTMLTests   = 0x2,
        DebugOutput = 0x4,
        NoXvfbUse   = 0x8
    };

    Q_DECLARE_FLAGS(ProcessArguments, ProcessArgument)

private:
    Ui::MainWindow m_ui;

    ProcessArguments m_flags;

    long m_runCounter;
    long m_testCounter;

    unsigned long m_totalTests;
    unsigned long m_totalTestsJS;
    unsigned long m_totalTestsDOMTS;

    QUrl m_khtmlUrl;
    QUrl m_testsUrl;
    QUrl m_outputUrl;
    QUrl m_saveLogUrl;

    // Temporary variables
    TestResult m_lastResult;
    QString m_lastName;

    // Status pixmaps
    QPixmap m_failPixmap;
    QPixmap m_failKnownPixmap;
    QPixmap m_passPixmap;
    QPixmap m_passUnexpectedPixmap;
    QPixmap m_crashPixmap;
    QPixmap m_ignorePixmap;
    QPixmap m_noBaselinePixmap;

    KHTMLPart *m_browserPart;
    QProcess *m_activeProcess;
    QTreeWidgetItem *m_activeTreeItem;

    // Caches
    QMap<QString, QTreeWidgetItem *> m_itemMap;

    QMap<QString, QStringList> m_ignoreMap;
    QMap<QString, QStringList> m_failureMap;
    QMap<QString, QStringList> m_directoryMap;

    bool m_suspended;

    // Processing queue
    bool m_justProcessingQueue;
    QQueue<QString> m_processingQueue;
};

Q_DECLARE_OPERATORS_FOR_FLAGS(TestRegressionWindow::ProcessArguments)

#endif