33 lines
781 B
C++
33 lines
781 B
C++
#include "../src/internal.hpp"
|
|
#include "../src/vkvm.hpp"
|
|
#include <catch2/catch.hpp>
|
|
|
|
TEST_CASE("Event") {
|
|
vkvm::initialize(0);
|
|
|
|
SECTION("Register") {
|
|
bool mouseMove = false;
|
|
bool timer = false;
|
|
bool timer2 = false;
|
|
vkvm::registerEvent(vkvm::MouseMove, [&]() {
|
|
mouseMove = true;
|
|
});
|
|
vkvm::registerEvent(vkvm::Timer, [&]() {
|
|
timer = true;
|
|
});
|
|
vkvm::registerEvent(vkvm::Timer, [&]() {
|
|
timer2 = true;
|
|
});
|
|
|
|
REQUIRE_FALSE(mouseMove);
|
|
vkvm::callEvent(vkvm::MouseMove);
|
|
REQUIRE(mouseMove);
|
|
|
|
REQUIRE_FALSE(timer);
|
|
REQUIRE_FALSE(timer2);
|
|
vkvm::callEvent(vkvm::Timer);
|
|
REQUIRE(timer);
|
|
REQUIRE(timer2);
|
|
}
|
|
}
|