summaryrefslogtreecommitdiff
path: root/test/api
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-07-18 20:21:57 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-07-26 09:50:38 -0700
commit11933f6ab81248a884db3b1f69be714a60b6a86c (patch)
treeb52ebfb6f9263f83270532f0df70a039b41f245c /test/api
parentc85193a0ad05fd4040ee711d606129e510dc45fe (diff)
downloadqtlocation-mapboxgl-11933f6ab81248a884db3b1f69be714a60b6a86c.tar.gz
[core] Remove API tests that are covered by node tests
Diffstat (limited to 'test/api')
-rw-r--r--test/api/render_missing.test.cpp71
-rw-r--r--test/api/repeated_render.test.cpp80
2 files changed, 0 insertions, 151 deletions
diff --git a/test/api/render_missing.test.cpp b/test/api/render_missing.test.cpp
deleted file mode 100644
index 02c19d359b..0000000000
--- a/test/api/render_missing.test.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <mbgl/test/util.hpp>
-#include <mbgl/test/fixture_log_observer.hpp>
-
-#include <mbgl/map/map.hpp>
-#include <mbgl/renderer/backend_scope.hpp>
-#include <mbgl/gl/headless_backend.hpp>
-#include <mbgl/gl/offscreen_view.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
-#include <mbgl/storage/default_file_source.hpp>
-#include <mbgl/renderer/renderer.hpp>
-#include <mbgl/util/image.hpp>
-#include <mbgl/util/io.hpp>
-#include <mbgl/util/run_loop.hpp>
-#include <mbgl/style/style.hpp>
-#include <mbgl/test/stub_renderer_frontend.hpp>
-
-#include <future>
-#include <memory>
-
-#if TEST_HAS_SERVER
-#define TEST_REQUIRES_SERVER(name) name
-#else
-#define TEST_REQUIRES_SERVER(name) DISABLED_ ## name
-#endif
-
-TEST(API, TEST_REQUIRES_SERVER(RenderMissingTile)) {
- using namespace mbgl;
-
- util::RunLoop loop;
-
- const auto style = util::read_file("test/fixtures/api/water_missing_tiles.json");
-
- HeadlessBackend backend;
- BackendScope scope { backend };
- OffscreenView view { backend.getContext(), { 256, 512 } };
- float pixelRatio { 1 };
- DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets");
- ThreadPool threadPool(4);
- StubRendererFrontend rendererFrontend { std::make_unique<Renderer>(backend, pixelRatio, fileSource, threadPool), view };
-
- Log::setObserver(std::make_unique<FixtureLogObserver>());
-
- Map map { rendererFrontend, MapObserver::nullObserver(), view.getSize(), pixelRatio, fileSource,
- threadPool, MapMode::Still };
-
- std::string message;
-
- // This host does not respond (== connection error).
- // Are you seeing this test fail? Make sure you don't have a server running on port 3001!
- map.getStyle().loadJSON(style);
- map.renderStill([&](std::exception_ptr err) {
- ASSERT_TRUE(err.operator bool());
- try {
- std::rethrow_exception(err);
- } catch (const std::exception& ex) {
- message = ex.what();
- EXPECT_TRUE(message.find("onnect") != std::string::npos); // [C|c]onnect
- }
- loop.stop();
- });
-
- loop.run();
-
- auto observer = Log::removeObserver();
- auto flo = dynamic_cast<FixtureLogObserver*>(observer.get());
- EXPECT_EQ(1u, flo->count(FixtureLog::Message(
- EventSeverity::Error, Event::Style, -1,
- std::string("Failed to load tile 0/0/0=>0 for source mapbox: " + message))));
- auto unchecked = flo->unchecked();
- EXPECT_TRUE(unchecked.empty()) << unchecked;
-}
diff --git a/test/api/repeated_render.test.cpp b/test/api/repeated_render.test.cpp
deleted file mode 100644
index be5336fe24..0000000000
--- a/test/api/repeated_render.test.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-#include <mbgl/test/util.hpp>
-#include <mbgl/test/fixture_log_observer.hpp>
-
-#include <mbgl/map/map.hpp>
-#include <mbgl/renderer/backend_scope.hpp>
-#include <mbgl/gl/headless_backend.hpp>
-#include <mbgl/gl/offscreen_view.hpp>
-#include <mbgl/util/default_thread_pool.hpp>
-#include <mbgl/storage/default_file_source.hpp>
-#include <mbgl/renderer/renderer.hpp>
-#include <mbgl/util/image.hpp>
-#include <mbgl/util/io.hpp>
-#include <mbgl/util/run_loop.hpp>
-#include <mbgl/style/style.hpp>
-#include <mbgl/test/stub_renderer_frontend.hpp>
-#include <mbgl/style/layers/line_layer.hpp>
-#include <mbgl/style/sources/geojson_source.hpp>
-
-#include <future>
-
-using namespace mbgl;
-
-
-TEST(API, RepeatedRender) {
-
- util::RunLoop loop;
-
- const auto style = util::read_file("test/fixtures/api/water.json");
-
- HeadlessBackend backend;
- BackendScope scope { backend };
- OffscreenView view { backend.getContext(), { 512, 512 } };
- float pixelRatio { 1 };
- DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets");
- ThreadPool threadPool(4);
- StubRendererFrontend rendererFrontend {
- std::make_unique<Renderer>(backend, pixelRatio, fileSource, threadPool), view };
-
- Log::setObserver(std::make_unique<FixtureLogObserver>());
-
- Map map(rendererFrontend, MapObserver::nullObserver(), view.getSize(), pixelRatio, fileSource,
- threadPool, MapMode::Still);
-
- {
- map.getStyle().loadJSON(style);
- PremultipliedImage result;
- map.renderStill([&](std::exception_ptr) {
- result = view.readStillImage();
- });
-
- while (!result.valid()) {
- loop.runOnce();
- }
-
- ASSERT_EQ(512u, result.size.width);
- ASSERT_EQ(512u, result.size.height);
- test::checkImage("test/fixtures/api/repeated_render", result, 0.0003, 0.1);
- }
-
- {
- map.getStyle().loadJSON(style);
- PremultipliedImage result;
- map.renderStill([&](std::exception_ptr) {
- result = view.readStillImage();
- });
-
- while (!result.valid()) {
- loop.runOnce();
- }
-
- ASSERT_EQ(512u, result.size.width);
- ASSERT_EQ(512u, result.size.height);
- test::checkImage("test/fixtures/api/repeated_render", result, 0.0003, 0.1);
- }
-
- auto observer = Log::removeObserver();
- auto flo = dynamic_cast<FixtureLogObserver*>(observer.get());
- auto unchecked = flo->unchecked();
- EXPECT_TRUE(unchecked.empty()) << unchecked;
-}