library/test/color_test.cpp

46 lines
1.8 KiB
C++

#include "../src/vkvm.hpp"
#include <catch2/catch.hpp>
#include <iostream>
TEST_CASE("Colors") {
vkvm::initialize(0);
vkvm::setPixel(10, 10, vkvm::black);//NOLINT
vkvm::setPixel(11, 11, vkvm::white);//NOLINT
vkvm::setPixel(12, 12, vkvm::green);//NOLINT
vkvm::setPixel(13, 13, vkvm::red);//NOLINT
vkvm::setPixel(14, 14, vkvm::blue);//NOLINT
vkvm::setPixel(15, 15, vkvm::Color(66, 77, 88)); //NOLINT
SECTION("RGB") {
REQUIRE(vkvm::getPixel(10, 10) == vkvm::black);//NOLINT
REQUIRE(vkvm::getPixel(11, 11) == vkvm::white);//NOLINT
REQUIRE(vkvm::getPixel(12, 12) == vkvm::green);//NOLINT
REQUIRE(vkvm::getPixel(13, 13) == vkvm::red);//NOLINT
REQUIRE(vkvm::getPixel(14, 14) == vkvm::blue);//NOLINT
REQUIRE(vkvm::getPixel(15, 15) == vkvm::Color(66, 77, 88));//NOLINT
}
SECTION("TwoColors") {
vkvm::setMode(vkvm::TwoColors);
REQUIRE(vkvm::getPixel(10, 10) == vkvm::black);//NOLINT
REQUIRE(vkvm::getPixel(11, 11) == vkvm::white);//NOLINT
REQUIRE(vkvm::getPixel(12, 12) == vkvm::black);//NOLINT
REQUIRE(vkvm::getPixel(13, 13) == vkvm::black);//NOLINT
REQUIRE(vkvm::getPixel(14, 14) == vkvm::black);//NOLINT
REQUIRE(vkvm::getPixel(15, 15) == vkvm::black);//NOLINT
}
SECTION("Gray256") {
vkvm::setMode(vkvm::Gray_256);
REQUIRE(vkvm::getPixel(10, 10) == vkvm::black);//NOLINT
REQUIRE(vkvm::getPixel(11, 11) == vkvm::white);//NOLINT
REQUIRE(vkvm::getPixel(12, 12) == vkvm::Color(85, 85, 85));//NOLINT
REQUIRE(vkvm::getPixel(13, 13) == vkvm::Color(85, 85, 85));//NOLINT
REQUIRE(vkvm::getPixel(14, 14) == vkvm::Color(85, 85, 85));//NOLINT
REQUIRE(vkvm::getPixel(15, 15) == vkvm::Color(77, 77, 77));//NOLINT
}
}