コード例 #1
0
TEST_F(BitmapImageTest, destroyDecodedDataExceptCurrentFrame)
{
    loadImage("/tests/fast/images/resources/animated-10color.gif");
    size_t totalSize = decodedSize();
    size_t frame = frameCount() / 2;
    setCurrentFrame(frame);
    size_t size = frameDecodedSize(frame);
    destroyDecodedData(false);
    EXPECT_LT(m_imageObserver.m_lastDecodedSizeChangedDelta, 0);
    EXPECT_GE(m_imageObserver.m_lastDecodedSizeChangedDelta, -static_cast<int>(totalSize - size));
}
コード例 #2
0
 size_t decodedSize()
 {
     // In the context of this test, the following loop will give the correct result, but only because the test
     // forces all frames to be decoded in loadImage() above. There is no general guarantee that frameDecodedSize()
     // is up-to-date. Because of how multi frame images (like GIF) work, requesting one frame to be decoded may
     // require other previous frames to be decoded as well. In those cases frameDecodedSize() wouldn't return the
     // correct thing for the previous frame because the decoded size wouldn't have propagated upwards to the
     // BitmapImage frame cache.
     size_t size = 0;
     for (size_t i = 0; i < decodedFramesCount(); ++i)
         size += frameDecodedSize(i);
     return size;
 }