summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlexander Shalamov <alexander.shalamov@mapbox.com>2019-04-23 16:08:16 +0300
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2019-04-25 10:00:23 +0300
commit83c33cdeb25831cde370b543d9e10c8d1859aec8 (patch)
treee21874529fbf69bd7d4bbcbb064aaf8e28d0fe50 /test
parent9a70e755dcc52a661ac29715b048afee5d938bee (diff)
downloadqtlocation-mapboxgl-83c33cdeb25831cde370b543d9e10c8d1859aec8.tar.gz
[core] Pass ImageManager to ImageRequestor's constructor
This makes ImageRequestor API explicitly dependant on ImageManager, so that ImageRequestor can unregister itself from ImageManager on destruction.
Diffstat (limited to 'test')
-rw-r--r--test/renderer/image_manager.test.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/renderer/image_manager.test.cpp b/test/renderer/image_manager.test.cpp
index d124e67e10..51b257094a 100644
--- a/test/renderer/image_manager.test.cpp
+++ b/test/renderer/image_manager.test.cpp
@@ -108,6 +108,8 @@ TEST(ImageManager, RemoveReleasesBinPackRect) {
class StubImageRequestor : public ImageRequestor {
public:
+ StubImageRequestor(ImageManager& imageManager) : ImageRequestor(imageManager) {}
+
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);
}
@@ -118,7 +120,7 @@ public:
TEST(ImageManager, NotifiesRequestorWhenSpriteIsLoaded) {
ImageManager imageManager;
- StubImageRequestor requestor;
+ StubImageRequestor requestor(imageManager);
bool notified = false;
ImageManagerObserver observer;
@@ -142,7 +144,7 @@ TEST(ImageManager, NotifiesRequestorWhenSpriteIsLoaded) {
TEST(ImageManager, NotifiesRequestorImmediatelyIfDependenciesAreSatisfied) {
ImageManager imageManager;
- StubImageRequestor requestor;
+ StubImageRequestor requestor(imageManager);
bool notified = false;
requestor.imagesAvailable = [&] (ImageMap, ImageMap, std::unordered_map<std::string, uint32_t>) {
@@ -170,7 +172,7 @@ class StubImageManagerObserver : public ImageManagerObserver {
TEST(ImageManager, OnStyleImageMissingBeforeSpriteLoaded) {
ImageManager imageManager;
- StubImageRequestor requestor;
+ StubImageRequestor requestor(imageManager);
StubImageManagerObserver observer;
imageManager.setObserver(&observer);
@@ -203,7 +205,7 @@ TEST(ImageManager, OnStyleImageMissingBeforeSpriteLoaded) {
TEST(ImageManager, OnStyleImageMissingAfterSpriteLoaded) {
ImageManager imageManager;
- StubImageRequestor requestor;
+ StubImageRequestor requestor(imageManager);
StubImageManagerObserver observer;
imageManager.setObserver(&observer);