diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2019-08-19 22:54:30 +0200 |
---|---|---|
committer | Dane Springmeyer <springmeyer@users.noreply.github.com> | 2019-08-19 13:54:30 -0700 |
commit | 71a334152ad0332f93ed4cc0d7af89e2eb689496 (patch) | |
tree | 609d918b9c53547de66b9fdeadc0d4e5539ad52e | |
parent | f4e187bde4caa54980389eaadba92d4957ee0213 (diff) | |
download | qtlocation-mapboxgl-71a334152ad0332f93ed4cc0d7af89e2eb689496.tar.gz |
[core] also remove version info in ImageManager when removing an image (#15397)
-rw-r--r-- | src/mbgl/renderer/image_manager.cpp | 1 | ||||
-rw-r--r-- | test/renderer/image_manager.test.cpp | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/mbgl/renderer/image_manager.cpp b/src/mbgl/renderer/image_manager.cpp index 3c22cdcf32..4bbdbca5d9 100644 --- a/src/mbgl/renderer/image_manager.cpp +++ b/src/mbgl/renderer/image_manager.cpp @@ -81,6 +81,7 @@ void ImageManager::removeImage(const std::string& id) { requestedImages.erase(requestedIt); } images.erase(it); + updatedImageVersions.erase(id); } const style::Image::Impl* ImageManager::getImage(const std::string& id) const { diff --git a/test/renderer/image_manager.test.cpp b/test/renderer/image_manager.test.cpp index 0b72578c35..16700d713f 100644 --- a/test/renderer/image_manager.test.cpp +++ b/test/renderer/image_manager.test.cpp @@ -50,6 +50,18 @@ TEST(ImageManager, AddRemove) { EXPECT_EQ(nullptr, imageManager.getImage("four")); } +TEST(ImageManager, Update) { + FixtureLog log; + ImageManager imageManager; + + imageManager.addImage(makeMutable<style::Image::Impl>("one", PremultipliedImage({ 16, 16 }), 2)); + EXPECT_EQ(0, imageManager.updatedImageVersions.size()); + imageManager.updateImage(makeMutable<style::Image::Impl>("one", PremultipliedImage({ 16, 16 }), 2)); + EXPECT_EQ(1, imageManager.updatedImageVersions.size()); + imageManager.removeImage("one"); + EXPECT_EQ(0, imageManager.updatedImageVersions.size()); +} + TEST(ImageManager, RemoveReleasesBinPackRect) { FixtureLog log; ImageManager imageManager; |