summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-10-17 15:42:30 +0300
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-10-17 16:29:02 +0300
commit3ac706edfefc9c8f2ee1ad9eb38bf688364cdb77 (patch)
tree657935721fe2f044a888054648bc8075a1a190eb /test
parent057048b293d00aed6fc964109e3bfa6bc5ba39ed (diff)
downloadqtlocation-mapboxgl-3ac706edfefc9c8f2ee1ad9eb38bf688364cdb77.tar.gz
[core] Update ImageManager.OnStyleImageMissingBeforeSpriteLoaded
So that it checks pending image requests for a different requestor.
Diffstat (limited to 'test')
-rw-r--r--test/renderer/image_manager.test.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/test/renderer/image_manager.test.cpp b/test/renderer/image_manager.test.cpp
index f1061ce59e..20c0a3a7f3 100644
--- a/test/renderer/image_manager.test.cpp
+++ b/test/renderer/image_manager.test.cpp
@@ -189,7 +189,7 @@ TEST(ImageManager, OnStyleImageMissingBeforeSpriteLoaded) {
// Repeated request of the same image shall not result another
// `ImageManagerObserver.onStyleImageMissing()` call.
- imageManager.getImages(requestor, std::make_pair(dependencies, imageCorrelationID));
+ imageManager.getImages(requestor, std::make_pair(dependencies, ++imageCorrelationID));
runLoop.runOnce();
EXPECT_EQ(observer.count, 1);
@@ -197,10 +197,20 @@ TEST(ImageManager, OnStyleImageMissingBeforeSpriteLoaded) {
// Request for updated dependencies must be dispatched to the
// observer.
dependencies.emplace("post", ImageType::Icon);
- imageManager.getImages(requestor, std::make_pair(dependencies, imageCorrelationID));
+ 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) {