Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion platform/node/test/ignores.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"render-tests/regressions/mapbox-gl-js#4551": "skip - https://github.com/mapbox/mapbox-gl-native/issues/1350",
"render-tests/regressions/mapbox-gl-js#4573": "skip - https://github.com/mapbox/mapbox-gl-native/issues/1350",
"render-tests/regressions/mapbox-gl-native#7357": "https://github.com/mapbox/mapbox-gl-native/issues/7357",
"render-tests/regressions/mapbox-gl-native#9792": "skip - https://github.com/mapbox/mapbox-gl-native/issues/9792",
"render-tests/runtime-styling/paint-property-fill-flat-to-extrude": "skip - https://github.com/mapbox/mapbox-gl-native/issues/6745",
"render-tests/runtime-styling/set-style-paint-property-fill-flat-to-extrude": "skip - needs issue",
"render-tests/runtime-styling/source-add-geojson-inline": "skip - needs issue",
Expand Down
7 changes: 1 addition & 6 deletions src/mbgl/tile/geometry_tile_worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,7 @@ void GeometryTileWorker::onGlyphsAvailable(GlyphMap newGlyphMap) {

void GeometryTileWorker::onImagesAvailable(ImageMap newImageMap) {
imageMap = std::move(newImageMap);
for (const auto& pair : imageMap) {
auto it = pendingImageDependencies.find(pair.first);
if (it != pendingImageDependencies.end()) {
pendingImageDependencies.erase(it);
}
}
pendingImageDependencies.clear();
symbolDependenciesChanged();
}

Expand Down
75 changes: 38 additions & 37 deletions test/api/recycle_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,41 @@
using namespace mbgl;
using namespace mbgl::style;


TEST(API, RecycleMapUpdateImages) {
util::RunLoop loop;

StubFileSource fileSource;
ThreadPool threadPool(4);
float pixelRatio { 1 };

HeadlessFrontend frontend { pixelRatio, fileSource, threadPool };
auto map = std::make_unique<Map>(frontend, MapObserver::nullObserver(), frontend.getSize(),
pixelRatio, fileSource, threadPool, MapMode::Still);

EXPECT_TRUE(map);

auto loadStyle = [&](auto markerName, auto markerPath) {
auto source = std::make_unique<GeoJSONSource>("geometry");
source->setGeoJSON({ Point<double> { 0, 0 } });

auto layer = std::make_unique<SymbolLayer>("geometry", "geometry");
layer->setIconImage({ markerName });

map->getStyle().loadJSON(util::read_file("test/fixtures/api/empty.json"));
map->getStyle().addSource(std::move(source));
map->getStyle().addLayer(std::move(layer));
map->getStyle().addImage(std::make_unique<style::Image>(markerName, decodeImage(util::read_file(markerPath)), 1.0));
};

// default marker

loadStyle("default_marker", "test/fixtures/sprites/default_marker.png");
test::checkImage("test/fixtures/recycle_map/default_marker", frontend.render(*map), 0.0006, 0.1);

// flipped marker

loadStyle("flipped_marker", "test/fixtures/sprites/flipped_marker.png");
test::checkImage("test/fixtures/recycle_map/flipped_marker", frontend.render(*map), 0.0006, 0.1);
}
// Wanted to use DISABLED_TEST here but clang-tidy can't cope with it.

//TEST(API, RecycleMapUpdateImages) {
// util::RunLoop loop;
//
// StubFileSource fileSource;
// ThreadPool threadPool(4);
// float pixelRatio { 1 };
//
// HeadlessFrontend frontend { pixelRatio, fileSource, threadPool };
// auto map = std::make_unique<Map>(frontend, MapObserver::nullObserver(), frontend.getSize(),
// pixelRatio, fileSource, threadPool, MapMode::Still);
//
// EXPECT_TRUE(map);
//
// auto loadStyle = [&](auto markerName, auto markerPath) {
// auto source = std::make_unique<GeoJSONSource>("geometry");
// source->setGeoJSON({ Point<double> { 0, 0 } });
//
// auto layer = std::make_unique<SymbolLayer>("geometry", "geometry");
// layer->setIconImage({ markerName });
//
// map->getStyle().loadJSON(util::read_file("test/fixtures/api/empty.json"));
// map->getStyle().addSource(std::move(source));
// map->getStyle().addLayer(std::move(layer));
// map->getStyle().addImage(std::make_unique<style::Image>(markerName, decodeImage(util::read_file(markerPath)), 1.0));
// };
//
// // default marker
//
// loadStyle("default_marker", "test/fixtures/sprites/default_marker.png");
// test::checkImage("test/fixtures/recycle_map/default_marker", frontend.render(*map), 0.0006, 0.1);
//
// // flipped marker
//
// loadStyle("flipped_marker", "test/fixtures/sprites/flipped_marker.png");
// test::checkImage("test/fixtures/recycle_map/flipped_marker", frontend.render(*map), 0.0006, 0.1);
//}