TEST(ImageManager, NotifiesRequestorImmediatelyIfDependenciesAreSatisfied) { ImageManager imageManager; StubImageRequestor requestor; bool notified = false; requestor.imagesAvailable = [&] (ImageMap) { notified = true; }; uint64_t imageCorrelationID = 0; imageManager.addImage(makeMutable<style::Image::Impl>("one", PremultipliedImage({ 16, 16 }), 2)); imageManager.getImages(requestor, std::make_pair(std::set<std::string> {"one"}, imageCorrelationID)); ASSERT_TRUE(notified); }
TEST(ImageManager, NotifiesRequestorWhenSpriteIsLoaded) { ImageManager imageManager; StubImageRequestor requestor; bool notified = false; requestor.imagesAvailable = [&] (ImageMap) { notified = true; }; uint64_t imageCorrelationID = 0; imageManager.getImages(requestor, std::make_pair(std::set<std::string> {"one"}, imageCorrelationID)); ASSERT_FALSE(notified); imageManager.setLoaded(true); ASSERT_TRUE(notified); }