[core] add regression test for #16391

This commit is contained in:
Łukasz Paczos
2020-04-10 17:47:42 +02:00
parent f79334c124
commit 08ad742164

View File

@@ -137,6 +137,24 @@ TEST(Style, AddRemoveImage) {
style.removeImage("one");
style.removeImage("two");
EXPECT_TRUE(!!style.getImage("three"));
EXPECT_FALSE(!!style.getImage("two"));
EXPECT_FALSE(!!style.getImage("four"));
}
TEST(Style, AddRemoveRemoveImage) {
// regression test for https://github.com/mapbox/mapbox-gl-native/pull/16391
util::RunLoop loop;
auto fileSource = std::make_shared<StubFileSource>();
Style::Impl style{fileSource, 1.0};
style.addImage(std::make_unique<style::Image>("one", PremultipliedImage({16, 16}), 2));
style.addImage(std::make_unique<style::Image>("two", PremultipliedImage({16, 16}), 2));
style.addImage(std::make_unique<style::Image>("three", PremultipliedImage({16, 16}), 2));
style.removeImage("one");
style.removeImage("two");
style.removeImage("two");
EXPECT_TRUE(!!style.getImage("three"));
EXPECT_FALSE(!!style.getImage("two"));
EXPECT_FALSE(!!style.getImage("four"));