summaryrefslogtreecommitdiff
path: root/test/api
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2015-07-10 21:03:32 +0300
committerThiago Marcos P. Santos <thiago@mapbox.com>2015-07-10 21:03:47 +0300
commit30416c5a9886ac18ad257ace0212d9c1f5bc5d4b (patch)
tree5220958946ebc9a6e4e5cbd8eeb33b3c058aa4d6 /test/api
parent0d444026280a2c6bdffbcb302c871786fc14d9c3 (diff)
downloadqtlocation-mapboxgl-30416c5a9886ac18ad257ace0212d9c1f5bc5d4b.tar.gz
Add unit tests for addPointAnnotations()
This test would have caught #1874
Diffstat (limited to 'test/api')
-rw-r--r--test/api/annotations.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/api/annotations.cpp b/test/api/annotations.cpp
new file mode 100644
index 0000000000..33374d4386
--- /dev/null
+++ b/test/api/annotations.cpp
@@ -0,0 +1,36 @@
+#include "../fixtures/fixture_log_observer.hpp"
+#include "../fixtures/mock_file_source.hpp"
+#include "../fixtures/util.hpp"
+
+#include <mbgl/annotation/point_annotation.hpp>
+#include <mbgl/map/map.hpp>
+#include <mbgl/map/still_image.hpp>
+#include <mbgl/platform/default/headless_display.hpp>
+#include <mbgl/platform/default/headless_view.hpp>
+
+#include <future>
+#include <vector>
+
+TEST(API, PointAnnotation) {
+ using namespace mbgl;
+
+ auto display = std::make_shared<mbgl::HeadlessDisplay>();
+ HeadlessView view(display, 1);
+
+ MockFileSource fileSource(MockFileSource::Success, "");
+
+ Map map(view, fileSource, MapMode::Still);
+ map.setStyleURL("test/fixtures/resources/style.json");
+
+ std::vector<PointAnnotation> points;
+ points.emplace_back(PointAnnotation({ 50.0, 50.0 }, "default_marker"));
+
+ map.addPointAnnotations(points);
+
+ std::promise<bool> promise;
+ map.renderStill([&promise](std::exception_ptr, std::unique_ptr<const StillImage>) {
+ promise.set_value(true);
+ });
+
+ promise.get_future().get();
+}