summaryrefslogtreecommitdiff
path: root/test/renderer
diff options
context:
space:
mode:
Diffstat (limited to 'test/renderer')
-rw-r--r--test/renderer/image_manager.test.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/renderer/image_manager.test.cpp b/test/renderer/image_manager.test.cpp
index 20451827ce..b73d9b5c7a 100644
--- a/test/renderer/image_manager.test.cpp
+++ b/test/renderer/image_manager.test.cpp
@@ -3,6 +3,7 @@
#include <mbgl/test/stub_style_observer.hpp>
#include <mbgl/renderer/image_manager.hpp>
+#include <mbgl/renderer/image_manager_observer.hpp>
#include <mbgl/sprite/sprite_parser.hpp>
#include <mbgl/style/image_impl.hpp>
#include <mbgl/util/io.hpp>
@@ -107,11 +108,11 @@ TEST(ImageManager, RemoveReleasesBinPackRect) {
class StubImageRequestor : public ImageRequestor {
public:
- void onImagesAvailable(ImageMap icons, ImageMap patterns, uint64_t imageCorrelationID_) final {
- if (imagesAvailable && imageCorrelationID == imageCorrelationID_) imagesAvailable(icons, patterns);
+ void onImagesAvailable(ImageMap icons, ImageMap patterns, std::unordered_map<std::string, uint32_t> versionMap, uint64_t imageCorrelationID_) final {
+ if (imagesAvailable && imageCorrelationID == imageCorrelationID_) imagesAvailable(icons, patterns, versionMap);
}
- std::function<void (ImageMap, ImageMap)> imagesAvailable;
+ std::function<void (ImageMap, ImageMap, std::unordered_map<std::string, uint32_t>)> imagesAvailable;
uint64_t imageCorrelationID = 0;
};
@@ -120,7 +121,10 @@ TEST(ImageManager, NotifiesRequestorWhenSpriteIsLoaded) {
StubImageRequestor requestor;
bool notified = false;
- requestor.imagesAvailable = [&] (ImageMap, ImageMap) {
+ ImageManagerObserver observer;
+ imageManager.setObserver(&observer);
+
+ requestor.imagesAvailable = [&] (ImageMap, ImageMap, std::unordered_map<std::string, uint32_t>) {
notified = true;
};
@@ -131,6 +135,8 @@ TEST(ImageManager, NotifiesRequestorWhenSpriteIsLoaded) {
ASSERT_FALSE(notified);
imageManager.setLoaded(true);
+ ASSERT_FALSE(notified);
+ imageManager.notifyIfMissingImageAdded();
ASSERT_TRUE(notified);
}
@@ -139,7 +145,7 @@ TEST(ImageManager, NotifiesRequestorImmediatelyIfDependenciesAreSatisfied) {
StubImageRequestor requestor;
bool notified = false;
- requestor.imagesAvailable = [&] (ImageMap, ImageMap) {
+ requestor.imagesAvailable = [&] (ImageMap, ImageMap, std::unordered_map<std::string, uint32_t>) {
notified = true;
};