aboutsummaryrefslogtreecommitdiff
path: root/test/platform
diff options
context:
space:
mode:
Diffstat (limited to 'test/platform')
-rw-r--r--test/platform/CMakeLists.txt1
-rw-r--r--test/platform/DeleteLaterTest.cpp17
2 files changed, 18 insertions, 0 deletions
diff --git a/test/platform/CMakeLists.txt b/test/platform/CMakeLists.txt
index e4237cd3..ea6493c4 100644
--- a/test/platform/CMakeLists.txt
+++ b/test/platform/CMakeLists.txt
@@ -1,5 +1,6 @@
add_executable(CruPlatformBaseTest
ColorTest.cpp
+ DeleteLaterTest.cpp
MatrixTest.cpp
)
target_link_libraries(CruPlatformBaseTest PRIVATE CruPlatformBase CruTestBase)
diff --git a/test/platform/DeleteLaterTest.cpp b/test/platform/DeleteLaterTest.cpp
new file mode 100644
index 00000000..932ac357
--- /dev/null
+++ b/test/platform/DeleteLaterTest.cpp
@@ -0,0 +1,17 @@
+#include "cru/platform/gui/DeleteLater.h"
+
+#include <catch2/catch_test_macros.hpp>
+
+struct MockDeleteLater {
+ bool triggered = false;
+
+ void DeleteLater() { triggered = true; }
+};
+
+TEST_CASE("DeleteLaterPtr should work.", "[delete-later]") {
+ auto ptr = cru::platform::gui::MakeDeleteLater<MockDeleteLater>();
+ auto p = ptr.get();
+ ptr.reset();
+ REQUIRE(p->triggered);
+ delete p;
+}