summaryrefslogtreecommitdiff
path: root/test/src/mbgl/test/stub_tile_observer.hpp
blob: 43ae4d8360e9c8b197c502109a0539a788e2ae5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once

#include <mbgl/tile/tile_observer.hpp>

using namespace mbgl;

/**
 * An implementation of TileObserver that forwards all methods to dynamically-settable lambas.
 */
class StubTileObserver : public TileObserver {
public:
    void onTileChanged(Tile& tile) override {
        if (tileChanged) tileChanged(tile);
    }

    void onTileError(Tile& tile, std::exception_ptr error) override {
        if (tileError) tileError(tile, error);
    }

    std::function<void (Tile&)> tileChanged;
    std::function<void (Tile&, std::exception_ptr)> tileError;
};