This commit is contained in:
2024-12-12 11:07:10 +01:00
parent e23ddd6cd1
commit b40a78522f
4 changed files with 44 additions and 1 deletions

View File

@@ -76,4 +76,5 @@ PULSE_API void PulseDestroyBuffer(PulseDevice device, PulseBuffer buffer)
} }
} }
device->PFN_DestroyBuffer(device, buffer); device->PFN_DestroyBuffer(device, buffer);
device->allocated_buffers_size--;
} }

View File

@@ -140,4 +140,5 @@ PULSE_API void PulseDestroyImage(PulseDevice device, PulseImage image)
} }
} }
device->PFN_DestroyImage(device, image); device->PFN_DestroyImage(device, image);
device->allocated_images_size--;
} }

View File

@@ -136,7 +136,11 @@ void TestBufferDestruction()
ENABLE_ERRORS; ENABLE_ERRORS;
} }
DISABLE_ERRORS;
RESET_ERRORS_CHECK;
CleanupDevice(device); CleanupDevice(device);
TEST_ASSERT_TRUE(HAS_RECIEVED_ERROR);
ENABLE_ERRORS;
CleanupDevice(other_device); CleanupDevice(other_device);
CleanupPulse(backend); CleanupPulse(backend);
} }

View File

@@ -150,7 +150,44 @@ void TestImageCreation()
CleanupPulse(backend); CleanupPulse(backend);
} }
void TestImageDestruction()
{
PulseBackend backend;
SetupPulse(&backend);
PulseDevice device;
SetupDevice(backend, &device);
PulseDevice other_device;
SetupDevice(backend, &other_device);
{
PulseImageCreateInfo image_create_info = { 0 };
image_create_info.type = PULSE_IMAGE_TYPE_2D;
image_create_info.format = PULSE_IMAGE_FORMAT_R8G8B8A8_UNORM;
image_create_info.usage = PULSE_IMAGE_USAGE_STORAGE_READ;
image_create_info.width = 256;
image_create_info.height = 256;
image_create_info.layer_count_or_depth = 1;
PulseImage image = PulseCreateImage(device, &image_create_info);
TEST_ASSERT_NOT_EQUAL_MESSAGE(image, PULSE_NULL_HANDLE, PulseVerbaliseErrorType(PulseGetLastErrorType()));
DISABLE_ERRORS;
RESET_ERRORS_CHECK;
PulseDestroyImage(other_device, image);
TEST_ASSERT_TRUE(HAS_RECIEVED_ERROR);
ENABLE_ERRORS;
}
DISABLE_ERRORS;
RESET_ERRORS_CHECK;
CleanupDevice(device);
TEST_ASSERT_TRUE(HAS_RECIEVED_ERROR);
ENABLE_ERRORS;
CleanupDevice(other_device);
CleanupPulse(backend);
}
void TestImage() void TestImage()
{ {
RUN_TEST(TestImageCreation); RUN_TEST(TestImageCreation);
RUN_TEST(TestImageDestruction);
} }