From 084ab8445706d93c9672cfc0ffa630f9da7dc491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Fri, 10 Apr 2020 17:47:42 +0200 Subject: [core] add regression test for #16391 --- test/style/style.test.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/style/style.test.cpp b/test/style/style.test.cpp index 2c9cdb5792..e47ae542bb 100644 --- a/test/style/style.test.cpp +++ b/test/style/style.test.cpp @@ -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(); + Style::Impl style{fileSource, 1.0}; + style.addImage(std::make_unique("one", PremultipliedImage({16, 16}), 2)); + style.addImage(std::make_unique("two", PremultipliedImage({16, 16}), 2)); + style.addImage(std::make_unique("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")); -- cgit v1.2.1