summaryrefslogtreecommitdiffstats
path: root/tests/arthur/baselineserver/src/htmlpage.h
blob: a937052e940494b133674dbba898af6976c8feb3 (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
#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 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;
    ImageItemList imageItems;
    bool headerWritten;
};

#endif // HTMLPAGE_H