library/test/default_test.cpp

71 lines
2.5 KiB
C++

#include "../src/internal.hpp"
#include "../src/vkvm.hpp"
#include <catch2/catch.hpp>
TEST_CASE("Default values") {
vkvm::initialize(0);
SECTION("before") {
REQUIRE(vkvm::getMode() == vkvm::RGB);
REQUIRE(vkvm::getCharactersPerRow() == 60);
REQUIRE(vkvm::getCharactersPerColumn() == 20);
REQUIRE(vkvm::getHeight() == 600);
REQUIRE(vkvm::getWidth() == 800);
REQUIRE(vkvm::getMousePosition().x == 42);
REQUIRE(vkvm::getMousePosition().y == 42);
REQUIRE(vkvm::getBackgroundColor() == vkvm::black);
REQUIRE(vkvm::getForegroundColor() == vkvm::white);
REQUIRE(vkvm::getRedrawInterval() == 500);
REQUIRE(vkvm::getTimerInterruptInterval() == 1000);
REQUIRE(vkvm::getFont() == vkvm::FuturisticBlack);
}
SECTION("change") {
vkvm::setMode(vkvm::TwoColors);
vkvm::setCharactersPerRow(100);
vkvm::setCharactersPerColumn(100);
vkvm::setHeight(40);
vkvm::setWidth(40);
vkvm::setMousePosition(41, 43);
vkvm::setBackgroundColor(vkvm::red);
vkvm::setForegroundColor(vkvm::blue);
vkvm::setRedrawInterval(1);
vkvm::setTimerInterruptInterval(2);
vkvm::setFont(vkvm::ProFontIIX);
REQUIRE(vkvm::getMode() == vkvm::TwoColors);
REQUIRE(vkvm::getCharactersPerRow() == 100);
REQUIRE(vkvm::getCharactersPerColumn() == 100);
REQUIRE(vkvm::getHeight() == 40);
REQUIRE(vkvm::getWidth() == 40);
REQUIRE(vkvm::getMousePosition().x == 41);
REQUIRE(vkvm::getMousePosition().y == 43);
REQUIRE(vkvm::getBackgroundColor() == vkvm::red);
REQUIRE(vkvm::getForegroundColor() == vkvm::blue);
REQUIRE(vkvm::getRedrawInterval() == 1);
REQUIRE(vkvm::getTimerInterruptInterval() == 2);
REQUIRE(vkvm::getFont() == vkvm::ProFontIIX);
}
SECTION("after") {
vkvm::reset();
REQUIRE(vkvm::getMode() == vkvm::RGB);
REQUIRE(vkvm::getCharactersPerRow() == 60);
REQUIRE(vkvm::getCharactersPerColumn() == 20);
REQUIRE(vkvm::getHeight() == 600);
REQUIRE(vkvm::getWidth() == 800);
REQUIRE(vkvm::getMousePosition().x == 42);
REQUIRE(vkvm::getMousePosition().y == 42);
REQUIRE(vkvm::getBackgroundColor() == vkvm::black);
REQUIRE(vkvm::getForegroundColor() == vkvm::white);
REQUIRE(vkvm::getRedrawInterval() == 500);
REQUIRE(vkvm::getTimerInterruptInterval() == 1000);
REQUIRE(vkvm::getFont() == vkvm::FuturisticBlack);
}
}