blob: 0faddcac7e855583dac0bcf82983bfc21eb791f6 (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#pragma once
#include <cstdint>
#include <string>
#include <memory>
#include <set>
#include <map>
#include <mbgl/tile/tile_id.hpp>
struct MockSourceInfo {
uint8_t maxZoom = 16;
uint8_t minZoom = 0;
};
struct MockTileData;
struct MockRenderable {
MockRenderable(mbgl::UnwrappedTileID id_, MockTileData& data_) : id(id_), data(data_) {}
const mbgl::UnwrappedTileID id;
MockTileData& data;
bool operator==(const MockRenderable& rhs) const {
return &data == &rhs.data;
}
};
::std::ostream& operator<<(::std::ostream& os, const MockRenderable&) {
return os << "Renderable{}";
}
struct MockSource {
MockSourceInfo info;
std::map<mbgl::OverscaledTileID, std::unique_ptr<MockTileData>> dataTiles;
std::set<mbgl::UnwrappedTileID> idealTiles;
std::map<mbgl::UnwrappedTileID, MockRenderable> renderables;
// Test API
inline MockTileData* createTileData(const mbgl::OverscaledTileID& tileID);
};
struct MockBucket {};
struct MockTileData {
bool isReady() {
return ready;
}
bool ready = false;
};
MockTileData* MockSource::createTileData(const mbgl::OverscaledTileID& tileID) {
// Replace the existing MockTileData object, if any.
return (dataTiles[tileID] = std::make_unique<MockTileData>()).get();
}
|