library/test/area_test.cpp

25 lines
685 B
C++
Raw Normal View History

#include "../src/vkvm.hpp"
#include <catch2/catch.hpp>
TEST_CASE("AREA") {
vkvm::initialize(0);
vkvm::setWidth(200);
vkvm::setHeight(200);
SECTION("inside bounds") {
REQUIRE(vkvm::setPixel(100, 100, vkvm::white));
REQUIRE(vkvm::getPixel(100, 100) == vkvm::white);
}
SECTION("Out of bounds") {
REQUIRE_FALSE(vkvm::setPixel(400, 400, vkvm::white));
REQUIRE(vkvm::getPixel(400, 400) == vkvm::black);
REQUIRE_FALSE(vkvm::setPixel(-5, -5, vkvm::white));
REQUIRE(vkvm::getPixel(-5, -5) == vkvm::black);
vkvm::setBackgroundColor(vkvm::blue);
REQUIRE(vkvm::getPixel(400, 400) == vkvm::blue);
}
}