summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-04-11 17:18:09 +0200
committerKonstantin Käfer <mail@kkaefer.com>2017-04-24 10:42:10 +0200
commit197f0ca6b418a27412bfcc7e891ab80949fd8833 (patch)
treebb7dd2400bfc002dc5794466d3a74d39a80f8b00 /test
parenteed7dedf030ed71aac6d004becef42dbec5606bf (diff)
downloadqtlocation-mapboxgl-197f0ca6b418a27412bfcc7e891ab80949fd8833.tar.gz
[android] use AAssetManager instead of libzip
Diffstat (limited to 'test')
-rw-r--r--test/api/custom_layer.test.cpp7
-rw-r--r--test/api/render_missing.test.cpp6
-rw-r--r--test/api/repeated_render.test.cpp6
-rw-r--r--test/map/map.test.cpp12
-rw-r--r--test/src/mbgl/test/util.hpp2
-rw-r--r--test/storage/asset_file_source.test.cpp29
6 files changed, 10 insertions, 52 deletions
diff --git a/test/api/custom_layer.test.cpp b/test/api/custom_layer.test.cpp
index 658c5333c3..5a30220cd7 100644
--- a/test/api/custom_layer.test.cpp
+++ b/test/api/custom_layer.test.cpp
@@ -89,14 +89,7 @@ TEST(CustomLayer, Basic) {
HeadlessBackend backend { test::sharedDisplay() };
BackendScope scope { backend };
OffscreenView view { backend.getContext() };
-
-#ifdef MBGL_ASSET_ZIP
- // Regenerate with `cd test/fixtures/api/ && zip -r assets.zip assets/`
- DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets.zip");
-#else
DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets");
-#endif
-
ThreadPool threadPool(4);
Map map(backend, view.getSize(), 1, fileSource, threadPool, MapMode::Still);
diff --git a/test/api/render_missing.test.cpp b/test/api/render_missing.test.cpp
index 8637462cbe..6e99501708 100644
--- a/test/api/render_missing.test.cpp
+++ b/test/api/render_missing.test.cpp
@@ -29,13 +29,7 @@ TEST(API, TEST_REQUIRES_SERVER(RenderMissingTile)) {
HeadlessBackend backend { test::sharedDisplay() };
BackendScope scope { backend };
OffscreenView view { backend.getContext(), { 256, 512 } };
-#ifdef MBGL_ASSET_ZIP
- // Regenerate with `cd test/fixtures/api/ && zip -r assets.zip assets/`
- DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets.zip");
-#else
DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets");
-#endif
-
ThreadPool threadPool(4);
Log::setObserver(std::make_unique<FixtureLogObserver>());
diff --git a/test/api/repeated_render.test.cpp b/test/api/repeated_render.test.cpp
index 6648a7752e..0b9726d3fa 100644
--- a/test/api/repeated_render.test.cpp
+++ b/test/api/repeated_render.test.cpp
@@ -25,13 +25,7 @@ TEST(API, RepeatedRender) {
HeadlessBackend backend { test::sharedDisplay() };
BackendScope scope { backend };
OffscreenView view { backend.getContext(), { 256, 512 } };
-#ifdef MBGL_ASSET_ZIP
- // Regenerate with `cd test/fixtures/api/ && zip -r assets.zip assets/`
- DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets.zip");
-#else
DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets");
-#endif
-
ThreadPool threadPool(4);
Log::setObserver(std::make_unique<FixtureLogObserver>());
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index f563aaa548..2f3883fb1f 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -356,12 +356,7 @@ TEST(Map, WithoutVAOExtension) {
test.backend.getContext().disableVAOExtension = true;
-#ifdef MBGL_ASSET_ZIP
- // Regenerate with `cd test/fixtures/api/ && zip -r assets.zip assets/`
- DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets.zip");
-#else
DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets");
-#endif
Map map(test.backend, test.view.getSize(), 1, fileSource, test.threadPool, MapMode::Still);
map.setStyleJSON(util::read_file("test/fixtures/api/water.json"));
@@ -589,14 +584,7 @@ TEST(Map, TEST_DISABLED_ON_CI(ContinuousRendering)) {
BackendScope scope { backend };
OffscreenView view { backend.getContext() };
ThreadPool threadPool { 4 };
-
-#ifdef MBGL_ASSET_ZIP
- // Regenerate with `cd test/fixtures/api/ && zip -r assets.zip assets/`
- DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets.zip");
-#else
DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets");
-#endif
-
Map map(backend, view.getSize(), 1, fileSource, threadPool, MapMode::Continuous);
using namespace std::chrono_literals;
diff --git a/test/src/mbgl/test/util.hpp b/test/src/mbgl/test/util.hpp
index 82d5c520f8..8673155fe4 100644
--- a/test/src/mbgl/test/util.hpp
+++ b/test/src/mbgl/test/util.hpp
@@ -4,7 +4,7 @@
#include <TargetConditionals.h>
#endif
-#if __ANDROID__
+#if ANDROID
#define TEST_READ_ONLY 0
#define TEST_HAS_SERVER 0
#elif TARGET_OS_IOS
diff --git a/test/storage/asset_file_source.test.cpp b/test/storage/asset_file_source.test.cpp
index 7e634fc68e..010a2c9dc7 100644
--- a/test/storage/asset_file_source.test.cpp
+++ b/test/storage/asset_file_source.test.cpp
@@ -6,28 +6,16 @@
#include <gtest/gtest.h>
-namespace {
-
-std::string getFileSourceRoot() {
-#ifdef MBGL_ASSET_ZIP
- // Regenerate with `cd test/fixtures/storage/ && zip -r assets.zip assets/`
- return "test/fixtures/storage/assets.zip";
-#else
- return "test/fixtures/storage/assets";
-#endif
-}
-
-} // namespace
-
using namespace mbgl;
+#if !ANDROID
TEST(AssetFileSource, Load) {
util::RunLoop loop;
- AssetFileSource fs(getFileSourceRoot());
+ AssetFileSource fs("test/fixtures/storage/assets");
// iOS seems to run out of file descriptors...
-#if TARGET_OS_IPHONE || __ANDROID__
+#if TARGET_OS_IPHONE
unsigned numThreads = 30;
#else
unsigned numThreads = 50;
@@ -91,7 +79,7 @@ TEST(AssetFileSource, Load) {
TEST(AssetFileSource, EmptyFile) {
util::RunLoop loop;
- AssetFileSource fs(getFileSourceRoot());
+ AssetFileSource fs("test/fixtures/storage/assets");
std::unique_ptr<AsyncRequest> req = fs.request({ Resource::Unknown, "asset://empty" }, [&](Response res) {
req.reset();
@@ -107,7 +95,7 @@ TEST(AssetFileSource, EmptyFile) {
TEST(AssetFileSource, NonEmptyFile) {
util::RunLoop loop;
- AssetFileSource fs(getFileSourceRoot());
+ AssetFileSource fs("test/fixtures/storage/assets");
std::unique_ptr<AsyncRequest> req = fs.request({ Resource::Unknown, "asset://nonempty" }, [&](Response res) {
req.reset();
@@ -123,7 +111,7 @@ TEST(AssetFileSource, NonEmptyFile) {
TEST(AssetFileSource, NonExistentFile) {
util::RunLoop loop;
- AssetFileSource fs(getFileSourceRoot());
+ AssetFileSource fs("test/fixtures/storage/assets");
std::unique_ptr<AsyncRequest> req = fs.request({ Resource::Unknown, "asset://does_not_exist" }, [&](Response res) {
req.reset();
@@ -140,7 +128,7 @@ TEST(AssetFileSource, NonExistentFile) {
TEST(AssetFileSource, ReadDirectory) {
util::RunLoop loop;
- AssetFileSource fs(getFileSourceRoot());
+ AssetFileSource fs("test/fixtures/storage/assets");
std::unique_ptr<AsyncRequest> req = fs.request({ Resource::Unknown, "asset://directory" }, [&](Response res) {
req.reset();
@@ -157,7 +145,7 @@ TEST(AssetFileSource, ReadDirectory) {
TEST(AssetFileSource, URLEncoding) {
util::RunLoop loop;
- AssetFileSource fs(getFileSourceRoot());
+ AssetFileSource fs("test/fixtures/storage/assets");
std::unique_ptr<AsyncRequest> req = fs.request({ Resource::Unknown, "asset://%6eonempty" }, [&](Response res) {
req.reset();
@@ -169,3 +157,4 @@ TEST(AssetFileSource, URLEncoding) {
loop.run();
}
+#endif