testImageCache refactored