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 keyup = false;
|
|
bool keyup2 = false;
|
|
vkvm::registerEvent(vkvm::MouseMove, [&]() {
|
|
mouseMove = true;
|
|
});
|
|
vkvm::registerEvent(vkvm::KeyUp, [&]() {
|
|
keyup = true;
|
|
});
|
|
vkvm::registerEvent(vkvm::KeyUp, [&]() {
|
|
keyup2 = true;
|
|
});
|
|
|
|
REQUIRE_FALSE(mouseMove);
|
|
vkvm::callEvent(vkvm::MouseMove);
|
|
REQUIRE(mouseMove);
|
|
|
|
REQUIRE_FALSE(keyup);
|
|
REQUIRE_FALSE(keyup2);
|
|
vkvm::callEvent(vkvm::KeyUp);
|
|
REQUIRE(keyup);
|
|
REQUIRE(keyup2);
|
|
}
|
|
}
|