diff options
| author | Yuqian Yang <crupest@crupest.life> | 2025-11-16 14:09:50 +0800 |
|---|---|---|
| committer | Yuqian Yang <crupest@crupest.life> | 2025-11-16 14:09:50 +0800 |
| commit | 07d662aafc25b145eb20e4123ebc82b5736cdeb7 (patch) | |
| tree | 0b94baddd3235623beac4997ac09a503a00645e7 /test/ui | |
| parent | faf73c4af74bdae1abf394a33b573149b98ec2b1 (diff) | |
| download | cru-07d662aafc25b145eb20e4123ebc82b5736cdeb7.tar.gz cru-07d662aafc25b145eb20e4123ebc82b5736cdeb7.tar.bz2 cru-07d662aafc25b145eb20e4123ebc82b5736cdeb7.zip | |
New timer impl on Windows. Add Event test. Fix delete later.
Diffstat (limited to 'test/ui')
| -rw-r--r-- | test/ui/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | test/ui/DeleteLaterTest.cpp | 17 |
2 files changed, 23 insertions, 0 deletions
diff --git a/test/ui/CMakeLists.txt b/test/ui/CMakeLists.txt index e69de29b..66a7cd27 100644 --- a/test/ui/CMakeLists.txt +++ b/test/ui/CMakeLists.txt @@ -0,0 +1,6 @@ +add_executable(CruUiTest + DeleteLaterTest.cpp +) +target_link_libraries(CruUiTest PRIVATE CruUi CruTestBase) + +cru_catch_discover_tests(CruUiTest) diff --git a/test/ui/DeleteLaterTest.cpp b/test/ui/DeleteLaterTest.cpp new file mode 100644 index 00000000..c9d600de --- /dev/null +++ b/test/ui/DeleteLaterTest.cpp @@ -0,0 +1,17 @@ +#include "cru/ui/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::ui::MakeDeleteLater<MockDeleteLater>(); + auto p = ptr.get(); + ptr.reset(); + REQUIRE(p->triggered); + delete p; +} |
