summaryrefslogtreecommitdiffstats
path: root/tests/arthur/baselineserver/src/htmlpage.h
blob: 29b4ff53319a0cdd45b6d70ae0a8819e9d5bdcd7 (plain)
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
#ifndef HTMLPAGE_H
#define HTMLPAGE_H

#include "baselineprotocol.h"
#include <QFile>
#include <QTextStream>

class HTMLPage
{
public:
    HTMLPage();
    ~HTMLPage();

    void start(const QString &storagePath, const QString &runId, const PlatformInfo pinfo);
    void addItem(const QString &baseline, const QString &rendered, const ImageItem &item);
    void end();
    QString filePath();

    static void handleCGIQuery(const QString &query);

private:
    void writeHeader(const ImageItem &item);
    void writeFooter();
    QString generateCompared(const QString &baseline, const QString &rendered, bool fuzzy = false);

    QString root;
    QString path;
    QFile file;
    QTextStream out;
    QString id;
    PlatformInfo plat;
    bool headerWritten;
};

#endif // HTMLPAGE_H