6#include "gtest/gtest.h"
13TEST(FenceWaiterVKTest, IgnoresNullFence) {
15 auto const waiter = context->GetFenceWaiter();
16 EXPECT_FALSE(waiter->AddFence(vk::UniqueFence(), []() {}));
19TEST(FenceWaiterVKTest, IgnoresNullCallback) {
21 auto const device = context->GetDevice();
22 auto const waiter = context->GetFenceWaiter();
25 EXPECT_FALSE(waiter->AddFence(std::move(fence),
nullptr));
28TEST(FenceWaiterVKTest, ExecutesFenceCallback) {
30 auto const device = context->GetDevice();
31 auto const waiter = context->GetFenceWaiter();
35 waiter->AddFence(std::move(fence), [&signal]() { signal.Signal(); });
40TEST(FenceWaiterVKTest, ExecutesFenceCallbackX2) {
42 auto const device = context->GetDevice();
43 auto const waiter = context->GetFenceWaiter();
47 waiter->AddFence(std::move(fence), [&signal]() { signal.Signal(); });
51 waiter->AddFence(std::move(fence2), [&signal2]() { signal2.Signal(); });
57TEST(FenceWaiterVKTest, ExecutesNewFenceThenOldFence) {
59 auto const device = context->GetDevice();
60 auto const waiter = context->GetFenceWaiter();
66 waiter->AddFence(std::move(fence), [&signal]() { signal.Signal(); });
75 waiter->AddFence(std::move(fence2), [&signal2]() { signal2.Signal(); });
80 raw_fence->SetStatus(vk::Result::eSuccess);
86TEST(FenceWaiterVKTest, AddFenceDoesNothingIfTerminating) {
91 auto const device = context->GetDevice();
92 auto const waiter = context->GetFenceWaiter();
96 waiter->AddFence(std::move(fence), [&signal]() { signal.Signal(); });
103TEST(FenceWaiterVKTest, InProgressFencesStillWaitIfTerminated) {
108 auto const device = context->GetDevice();
109 auto const waiter = context->GetFenceWaiter();
117 waiter->AddFence(std::move(fence), [&signal]() { signal.Signal(); });
123 raw_fence->
SetStatus(vk::Result::eSuccess);
static constexpr TimeDelta FromMilliseconds(int64_t millis)
void SetStatus(vk::Result result)
static MockFence * GetRawPointer(vk::UniqueFence &fence)
std::shared_ptr< ContextVK > Build()
Create a Vulkan context with Vulkan functions mocked. The caller is given a chance to tinker on the s...
TEST(AiksCanvasTest, EmptyCullRect)
#define EXPECT_TRUE(handle)