summaryrefslogtreecommitdiff
path: root/render-test/runner.hpp
blob: 920a9ee372765b38407d4d28317118b83970d5c6 (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
#pragma once

#include <mbgl/gfx/headless_frontend.hpp>
#include <mbgl/map/map.hpp>

#include <memory>

struct TestMetadata;

class TestRunner {
public:
    TestRunner() = default;

    bool run(TestMetadata&);
    void reset();

    /// Returns path of the render tests root directory.
    static const std::string& getBasePath();
    /// Returns path of mapbox-gl-native expectations directory.
    static const std::string& getPlatformExpectationsPath();

private:
    bool runOperations(const std::string& key, TestMetadata&);
    bool checkImage(mbgl::PremultipliedImage&& image, TestMetadata&);

    struct Impl {
        Impl(const TestMetadata&);

        mbgl::HeadlessFrontend frontend;
        mbgl::Map map;
    };
    std::unordered_map<std::string, std::unique_ptr<Impl>> maps;
};