| 23 | class ImageCacheTestsBase { |
| 24 | protected: |
| 25 | void SetUpBase() { |
| 26 | auto img = Image::makeFromBitmap(createTestBitmap(), true).value(); |
| 27 | // NOTE(rjaber): We are relying on the fact that image cache will never evict in use images |
| 28 | _cache = std::make_unique<ImageCache>(ConsoleLogger::getLogger(), ImageCacheItem::imageSize(img)); |
| 29 | _cache->setMaxAge(_maxAge); |
| 30 | |
| 31 | auto zeroBitmap = loadResourceFromDisk("testdata/0x0.bmp"); |
| 32 | ASSERT_FALSE(zeroBitmap.failure()) |
| 33 | << "Failed to load testdata/0x0.bmp (ensure the file is in test data/runfiles)"; |
| 34 | |
| 35 | _width = img->width(); |
| 36 | _height = img->height(); |
| 37 | |
| 38 | auto cancel = makeShared<SimpleAtomicCancelable>(); |
| 39 | _cache->setCachedItemAndGetResizedImage(_url, img, _width, _height); |
| 40 | |
| 41 | _imgSize = ImageCacheItem::imageSize(img); |
| 42 | } |
| 43 | |
| 44 | Result<Valdi::Ref<Image>> getImage(const StringBox& url, int32_t width, int32_t height) { |
| 45 | auto result = _cache->getResizedCachedImage(url, width, height); |
nothing calls this directly
no test coverage detected