mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-03 19:05:59 -04:00
Added event wait tests
This commit is contained in:
parent
c641f5602b
commit
10c653b815
@ -8,4 +8,34 @@ using namespace SDL2pp;
|
||||
using namespace SDL2pp::Event;
|
||||
|
||||
BEGIN_TEST(int, char*[])
|
||||
// Test wait event with no timeout
|
||||
{
|
||||
SDL_Event expected;
|
||||
expected.type = SDL_USEREVENT;
|
||||
expected.user.code = 99;
|
||||
SDL_PushEvent(&expected);
|
||||
|
||||
auto result = WaitEvent();
|
||||
EXPECT_TRUE(result.type == expected.type);
|
||||
EXPECT_TRUE(result.user.code == expected.user.code);
|
||||
}
|
||||
|
||||
// Test wait event with timeout and with event
|
||||
{
|
||||
SDL_Event expected;
|
||||
expected.type = SDL_USEREVENT;
|
||||
expected.user.code = 32;
|
||||
SDL_PushEvent(&expected);
|
||||
|
||||
auto result = WaitEvent(10);
|
||||
EXPECT_TRUE(!(result == NullOpt));
|
||||
EXPECT_TRUE(result->type == expected.type);
|
||||
EXPECT_TRUE(result->user.code == expected.user.code);
|
||||
}
|
||||
|
||||
// Test wait event with timeout and no event
|
||||
{
|
||||
auto result = WaitEvent(10);
|
||||
EXPECT_TRUE(result == NullOpt);
|
||||
}
|
||||
END_TEST()
|
||||
|
Loading…
x
Reference in New Issue
Block a user