Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] Update ImageManager.OnStyleImageMissingBeforeSpriteLoaded
Browse files Browse the repository at this point in the history
So that it checks pending image requests for a different requestor.
  • Loading branch information
pozdnyakov committed Oct 17, 2019
1 parent 057048b commit 3ac706e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions test/renderer/image_manager.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,18 +189,28 @@ 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);

// 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) {
Expand Down

0 comments on commit 3ac706e

Please sign in to comment.