QmlDesigner: Fix flacky test AsynchronousImageCache.WaitForFinished

Change-Id: I94afa8ec2925b85f5dbf44e7b2ad5db484f48148
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Marco Bubke
2021-01-27 14:13:42 +01:00
parent 6a0cfc0c6e
commit 62582877f6
3 changed files with 10 additions and 4 deletions

View File

@@ -323,7 +323,11 @@ TEST_F(AsynchronousImageCache, AfterCleanNewJobsWorks)
TEST_F(AsynchronousImageCache, WaitForFinished)
{
ON_CALL(mockStorage, fetchImage(_, _))
ON_CALL(mockStorage, fetchImage(Eq("/path/to/Component1.qml"), _)).WillByDefault([&](auto, auto) {
waitInThread.notify();
return QmlDesigner::ImageCacheStorageInterface::ImageEntry{image1, true};
});
ON_CALL(mockStorage, fetchImage(Eq("/path/to/Component2.qml"), _))
.WillByDefault(Return(QmlDesigner::ImageCacheStorageInterface::ImageEntry{image1, true}));
cache.requestImage("/path/to/Component1.qml",
mockCaptureCallback.AsStdFunction(),
@@ -334,6 +338,7 @@ TEST_F(AsynchronousImageCache, WaitForFinished)
EXPECT_CALL(mockCaptureCallback, Call(_)).Times(2);
waitInThread.wait();
cache.waitForFinished();
}