QmlDesigner: Add waitForFinished to ImageCache

Task-number: QDS-2998
Change-Id: I5ffb63b7345a17ccb499db876bb4dbb0a946ed85
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Marco Bubke
2020-11-04 13:00:17 +01:00
parent 0eb65f7211
commit c3aad50184
8 changed files with 79 additions and 12 deletions

View File

@@ -319,4 +319,27 @@ TEST_F(ImageCache, AfterCleanNewJobsWorks)
notification.wait();
}
TEST_F(ImageCache, WaitForFinished)
{
ON_CALL(mockStorage, fetchImage(_, _))
.WillByDefault(Return(QmlDesigner::ImageCacheStorageInterface::Entry{image1, true}));
cache.requestImage("/path/to/Component1.qml",
mockCaptureCallback.AsStdFunction(),
mockAbortCallback.AsStdFunction());
cache.requestImage("/path/to/Component2.qml",
mockCaptureCallback.AsStdFunction(),
mockAbortCallback.AsStdFunction());
EXPECT_CALL(mockCaptureCallback, Call(_)).Times(2);
cache.waitForFinished();
}
TEST_F(ImageCache, WaitForFinishedInGenerator)
{
EXPECT_CALL(mockGenerator, waitForFinished());
cache.waitForFinished();
}
} // namespace