[core] Simplify asset:// implementation
* Move asset:// URL handling to DefaultFileSource. * AssetFileSource implements FileSource interface and follows familiar implementation patterns. * Move default implementation to platform/default, zip implementation to platform/android. * Don't bother with modified / expires / etag -- assets are not cached so it doesn't matter. * Don't bother with interleaving individual IO calls on the implementation thread. That adds a lot of complexity for very little benefit.
This commit is contained in:
@@ -31,7 +31,7 @@ void checkRendering(Map& map, const char * name) {
|
||||
TEST(Annotations, PointAnnotation) {
|
||||
auto display = std::make_shared<mbgl::HeadlessDisplay>();
|
||||
HeadlessView view(display, 1);
|
||||
OnlineFileSource fileSource(nullptr, test::getFileSourceRoot());
|
||||
OnlineFileSource fileSource(nullptr);
|
||||
|
||||
Map map(view, fileSource, MapMode::Still);
|
||||
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), "");
|
||||
@@ -44,7 +44,7 @@ TEST(Annotations, PointAnnotation) {
|
||||
TEST(Annotations, LineAnnotation) {
|
||||
auto display = std::make_shared<mbgl::HeadlessDisplay>();
|
||||
HeadlessView view(display, 1);
|
||||
OnlineFileSource fileSource(nullptr, test::getFileSourceRoot());
|
||||
OnlineFileSource fileSource(nullptr);
|
||||
|
||||
Map map(view, fileSource, MapMode::Still);
|
||||
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), "");
|
||||
@@ -63,7 +63,7 @@ TEST(Annotations, LineAnnotation) {
|
||||
TEST(Annotations, FillAnnotation) {
|
||||
auto display = std::make_shared<mbgl::HeadlessDisplay>();
|
||||
HeadlessView view(display, 1);
|
||||
OnlineFileSource fileSource(nullptr, test::getFileSourceRoot());
|
||||
OnlineFileSource fileSource(nullptr);
|
||||
|
||||
Map map(view, fileSource, MapMode::Still);
|
||||
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), "");
|
||||
@@ -81,7 +81,7 @@ TEST(Annotations, FillAnnotation) {
|
||||
TEST(Annotations, StyleSourcedShapeAnnotation) {
|
||||
auto display = std::make_shared<mbgl::HeadlessDisplay>();
|
||||
HeadlessView view(display, 1);
|
||||
OnlineFileSource fileSource(nullptr, test::getFileSourceRoot());
|
||||
OnlineFileSource fileSource(nullptr);
|
||||
|
||||
Map map(view, fileSource, MapMode::Still);
|
||||
map.setStyleJSON(util::read_file("test/fixtures/api/annotation.json"), "");
|
||||
@@ -96,7 +96,7 @@ TEST(Annotations, StyleSourcedShapeAnnotation) {
|
||||
TEST(Annotations, AddMultiple) {
|
||||
auto display = std::make_shared<mbgl::HeadlessDisplay>();
|
||||
HeadlessView view(display, 1);
|
||||
OnlineFileSource fileSource(nullptr, test::getFileSourceRoot());
|
||||
OnlineFileSource fileSource(nullptr);
|
||||
|
||||
Map map(view, fileSource, MapMode::Still);
|
||||
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), "");
|
||||
@@ -113,7 +113,7 @@ TEST(Annotations, AddMultiple) {
|
||||
TEST(Annotations, NonImmediateAdd) {
|
||||
auto display = std::make_shared<mbgl::HeadlessDisplay>();
|
||||
HeadlessView view(display, 1);
|
||||
OnlineFileSource fileSource(nullptr, test::getFileSourceRoot());
|
||||
OnlineFileSource fileSource(nullptr);
|
||||
|
||||
Map map(view, fileSource, MapMode::Still);
|
||||
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), "");
|
||||
@@ -133,7 +133,7 @@ TEST(Annotations, NonImmediateAdd) {
|
||||
TEST(Annotations, UpdatePoint) {
|
||||
auto display = std::make_shared<mbgl::HeadlessDisplay>();
|
||||
HeadlessView view(display, 1);
|
||||
OnlineFileSource fileSource(nullptr, test::getFileSourceRoot());
|
||||
OnlineFileSource fileSource(nullptr);
|
||||
|
||||
Map map(view, fileSource, MapMode::Still);
|
||||
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), "");
|
||||
@@ -152,7 +152,7 @@ TEST(Annotations, UpdatePoint) {
|
||||
TEST(Annotations, RemovePoint) {
|
||||
auto display = std::make_shared<mbgl::HeadlessDisplay>();
|
||||
HeadlessView view(display, 1);
|
||||
OnlineFileSource fileSource(nullptr, test::getFileSourceRoot());
|
||||
OnlineFileSource fileSource(nullptr);
|
||||
|
||||
Map map(view, fileSource, MapMode::Still);
|
||||
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), "");
|
||||
@@ -169,7 +169,7 @@ TEST(Annotations, RemovePoint) {
|
||||
TEST(Annotations, RemoveShape) {
|
||||
auto display = std::make_shared<mbgl::HeadlessDisplay>();
|
||||
HeadlessView view(display, 1);
|
||||
OnlineFileSource fileSource(nullptr, test::getFileSourceRoot());
|
||||
OnlineFileSource fileSource(nullptr);
|
||||
|
||||
AnnotationSegments segments = {{ {{ { 0, 0 }, { 45, 45 } }} }};
|
||||
|
||||
@@ -191,7 +191,7 @@ TEST(Annotations, RemoveShape) {
|
||||
TEST(Annotations, ImmediateRemoveShape) {
|
||||
auto display = std::make_shared<mbgl::HeadlessDisplay>();
|
||||
HeadlessView view(display, 1);
|
||||
OnlineFileSource fileSource(nullptr, test::getFileSourceRoot());
|
||||
OnlineFileSource fileSource(nullptr);
|
||||
Map map(view, fileSource, MapMode::Still);
|
||||
|
||||
map.removeAnnotation(map.addShapeAnnotation(ShapeAnnotation({}, {})));
|
||||
@@ -203,7 +203,7 @@ TEST(Annotations, ImmediateRemoveShape) {
|
||||
TEST(Annotations, SwitchStyle) {
|
||||
auto display = std::make_shared<mbgl::HeadlessDisplay>();
|
||||
HeadlessView view(display, 1);
|
||||
OnlineFileSource fileSource(nullptr, test::getFileSourceRoot());
|
||||
OnlineFileSource fileSource(nullptr);
|
||||
|
||||
Map map(view, fileSource, MapMode::Still);
|
||||
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), "");
|
||||
|
||||
Reference in New Issue
Block a user