summaryrefslogtreecommitdiff
path: root/test/api/annotations.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/api/annotations.cpp')
-rw-r--r--test/api/annotations.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/test/api/annotations.cpp b/test/api/annotations.cpp
index 33374d4386..39862b1069 100644
--- a/test/api/annotations.cpp
+++ b/test/api/annotations.cpp
@@ -1,5 +1,3 @@
-#include "../fixtures/fixture_log_observer.hpp"
-#include "../fixtures/mock_file_source.hpp"
#include "../fixtures/util.hpp"
#include <mbgl/annotation/point_annotation.hpp>
@@ -7,30 +5,30 @@
#include <mbgl/map/still_image.hpp>
#include <mbgl/platform/default/headless_display.hpp>
#include <mbgl/platform/default/headless_view.hpp>
+#include <mbgl/storage/default_file_source.hpp>
+#include <mbgl/util/image.hpp>
+#include <mbgl/util/io.hpp>
#include <future>
#include <vector>
-TEST(API, PointAnnotation) {
+TEST(Annotations, PointAnnotation) {
using namespace mbgl;
auto display = std::make_shared<mbgl::HeadlessDisplay>();
HeadlessView view(display, 1);
-
- MockFileSource fileSource(MockFileSource::Success, "");
+ DefaultFileSource fileSource(nullptr);
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);
+ map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), "");
+ map.addPointAnnotation(PointAnnotation({ 0, 0 }, "default_marker"));
- std::promise<bool> promise;
- map.renderStill([&promise](std::exception_ptr, std::unique_ptr<const StillImage>) {
- promise.set_value(true);
+ std::promise<std::unique_ptr<const StillImage>> promise;
+ map.renderStill([&promise](std::exception_ptr, std::unique_ptr<const StillImage> image) {
+ promise.set_value(std::move(image));
});
- promise.get_future().get();
+ auto result = promise.get_future().get();
+ const std::string png = util::compress_png(result->width, result->height, result->pixels.get());
+ util::write_file("test/output/point_annotation.png", png);
}