diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-10-24 17:05:01 +0300 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-10-28 13:02:32 +0200 |
commit | aa36dc87fb5583425ab29b4a15407186c31c492f (patch) | |
tree | 82d1e9eafa9aba4eecaaf76f3966773acfd50785 /test | |
parent | 6428d12a8d3de572973202016b9ee19df4b288ed (diff) | |
download | qtlocation-mapboxgl-aa36dc87fb5583425ab29b4a15407186c31c492f.tar.gz |
Revert "[core] Revert coalescing requests to the client for the same missing image"
This reverts commit 22132683797b5ea5cbe8622f77c01b399ad9c71e.
Diffstat (limited to 'test')
-rw-r--r-- | test/renderer/image_manager.test.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/renderer/image_manager.test.cpp b/test/renderer/image_manager.test.cpp index 16700d713f..20c0a3a7f3 100644 --- a/test/renderer/image_manager.test.cpp +++ b/test/renderer/image_manager.test.cpp @@ -187,6 +187,30 @@ TEST(ImageManager, OnStyleImageMissingBeforeSpriteLoaded) { EXPECT_EQ(observer.count, 1); ASSERT_TRUE(notified); + // Repeated request of the same image shall not result another + // `ImageManagerObserver.onStyleImageMissing()` call. + imageManager.getImages(requestor, std::make_pair(dependencies, ++imageCorrelationID)); + runLoop.runOnce(); + + EXPECT_EQ(observer.count, 1); + + // Request for updated dependencies must be dispatched to the + // observer. + dependencies.emplace("post", ImageType::Icon); + imageManager.getImages(requestor, std::make_pair(dependencies, ++imageCorrelationID)); + runLoop.runOnce(); + + EXPECT_EQ(observer.count, 2); + + // Another requestor shall not have pending requests for already obtained images. + StubImageRequestor anotherRequestor(imageManager); + imageManager.getImages(anotherRequestor, std::make_pair(dependencies, ++imageCorrelationID)); + ASSERT_FALSE(anotherRequestor.hasPendingRequests()); + + dependencies.emplace("unfamiliar", ImageType::Icon); + imageManager.getImages(anotherRequestor, std::make_pair(dependencies, ++imageCorrelationID)); + EXPECT_TRUE(anotherRequestor.hasPendingRequests()); + EXPECT_TRUE(anotherRequestor.hasPendingRequest("unfamiliar")); } TEST(ImageManager, OnStyleImageMissingAfterSpriteLoaded) { |