diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-07-01 12:39:21 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-07-08 10:40:05 +0200 |
commit | 675ddddee78fa36d60d55c266033f05edda4be48 (patch) | |
tree | e7e09473400600070778b620d1cd1eb0a78d7b7d /test/api | |
parent | 3a07cb2f1edb4e8f5e076ec0fef32f733676a95c (diff) | |
download | qtlocation-mapboxgl-675ddddee78fa36d60d55c266033f05edda4be48.tar.gz |
Make pixelRatio constant across a Map object lifetime
also moves framebuffer size out of TransformState into its own object
Diffstat (limited to 'test/api')
-rw-r--r-- | test/api/api_misuse.cpp | 8 | ||||
-rw-r--r-- | test/api/repeated_render.cpp | 10 | ||||
-rw-r--r-- | test/api/set_style.cpp | 2 |
3 files changed, 9 insertions, 11 deletions
diff --git a/test/api/api_misuse.cpp b/test/api/api_misuse.cpp index a98cf04101..1f54855323 100644 --- a/test/api/api_misuse.cpp +++ b/test/api/api_misuse.cpp @@ -17,11 +17,11 @@ TEST(API, RenderWithoutCallback) { Log::setObserver(std::unique_ptr<Log::Observer>(log)); auto display = std::make_shared<mbgl::HeadlessDisplay>(); - HeadlessView view(display); + HeadlessView view(display, 1); + view.resize(128, 512); DefaultFileSource fileSource(nullptr); std::unique_ptr<Map> map = std::make_unique<Map>(view, fileSource, MapMode::Still); - map->resize(128, 512, 1); map->renderStill(nullptr); // Force Map thread to join. @@ -39,11 +39,11 @@ TEST(API, RenderWithoutCallback) { TEST(API, RenderWithoutStyle) { auto display = std::make_shared<mbgl::HeadlessDisplay>(); - HeadlessView view(display); + HeadlessView view(display, 1); + view.resize(128, 512); DefaultFileSource fileSource(nullptr); Map map(view, fileSource, MapMode::Still); - map.resize(128, 512, 1); std::promise<std::exception_ptr> promise; map.renderStill([&promise](std::exception_ptr error, std::unique_ptr<const StillImage>) { diff --git a/test/api/repeated_render.cpp b/test/api/repeated_render.cpp index 7f55237744..f8b92b85b8 100644 --- a/test/api/repeated_render.cpp +++ b/test/api/repeated_render.cpp @@ -17,7 +17,7 @@ TEST(API, RepeatedRender) { const auto style = util::read_file("test/fixtures/api/water.json"); auto display = std::make_shared<mbgl::HeadlessDisplay>(); - HeadlessView view(display); + HeadlessView view(display, 1, 256, 512); DefaultFileSource fileSource(nullptr); Log::setObserver(std::make_unique<FixtureLogObserver>()); @@ -25,29 +25,27 @@ TEST(API, RepeatedRender) { Map map(view, fileSource, MapMode::Still); { - map.resize(128, 512, 1); map.setStyleJSON(style, "test/suite"); 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)); }); auto result = promise.get_future().get(); - ASSERT_EQ(128, result->width); + ASSERT_EQ(256, result->width); ASSERT_EQ(512, result->height); const std::string png = util::compress_png(result->width, result->height, result->pixels.get()); util::write_file("test/fixtures/api/1.png", png); } { - map.resize(512, 512, 2); map.setStyleJSON(style, "TEST_DATA/suite"); 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)); }); auto result = promise.get_future().get(); - ASSERT_EQ(1024, result->width); - ASSERT_EQ(1024, result->height); + ASSERT_EQ(256, result->width); + ASSERT_EQ(512, result->height); const std::string png = util::compress_png(result->width, result->height, result->pixels.get()); util::write_file("test/fixtures/api/2.png", png); } diff --git a/test/api/set_style.cpp b/test/api/set_style.cpp index 72260e6343..db31254dbb 100644 --- a/test/api/set_style.cpp +++ b/test/api/set_style.cpp @@ -11,7 +11,7 @@ TEST(API, SetStyle) { using namespace mbgl; auto display = std::make_shared<mbgl::HeadlessDisplay>(); - HeadlessView view(display); + HeadlessView view(display, 1); DefaultFileSource fileSource(nullptr); Log::setObserver(std::make_unique<FixtureLogObserver>()); |