summaryrefslogtreecommitdiffstats
path: root/tests/arthur/baselineserver/src/htmlpage.h
blob: 5f819f3a0ad031e9f84087a44bfd93fb93ee5fa7 (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
36
37
#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, const QString &hostAddress, const ImageItemList &itemList);
    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;
    QString address;
    ImageItemList imageItems;
    bool headerWritten;
};

#endif // HTMLPAGE_H