77 lines
3.1 KiB
C++
77 lines
3.1 KiB
C++
#include "../src/vkvm.hpp"
|
|
#include <catch2/catch.hpp>
|
|
#include <iostream>
|
|
|
|
TEST_CASE("Colors") {
|
|
vkvm::initialize(0);
|
|
vkvm::setMode(vkvm::RGB);
|
|
REQUIRE(vkvm::setPixel(10, 10, vkvm::black));
|
|
REQUIRE(vkvm::setPixel(11, 11, vkvm::white));
|
|
REQUIRE(vkvm::setPixel(12, 12, vkvm::green));
|
|
REQUIRE(vkvm::setPixel(13, 13, vkvm::red));
|
|
REQUIRE(vkvm::setPixel(14, 14, vkvm::blue));
|
|
REQUIRE(vkvm::setPixel(15, 15, vkvm::Color(66, 77, 88)));
|
|
REQUIRE(vkvm::setPixel(16, 16, vkvm::Color(0xFFFFFF)));
|
|
REQUIRE(vkvm::setPixel(17, 17, vkvm::Color(500, 500, 500)));
|
|
REQUIRE(vkvm::setPixel(18, 18, vkvm::Color(0x000000)));
|
|
|
|
SECTION("RGB") {
|
|
REQUIRE(vkvm::getPixel(10, 10) == vkvm::black);
|
|
REQUIRE(vkvm::getPixel(11, 11) == vkvm::white);
|
|
REQUIRE(vkvm::getPixel(12, 12) == vkvm::green);
|
|
REQUIRE(vkvm::getPixel(13, 13) == vkvm::red);
|
|
REQUIRE(vkvm::getPixel(14, 14) == vkvm::blue);
|
|
REQUIRE(vkvm::getPixel(15, 15) == vkvm::Color(66, 77, 88));
|
|
REQUIRE(vkvm::getPixel(16, 16) == vkvm::white);
|
|
REQUIRE(vkvm::getPixel(17, 17) == vkvm::white);
|
|
REQUIRE(vkvm::getPixel(18, 18) == vkvm::black);
|
|
}
|
|
|
|
SECTION("TwoColors") {
|
|
vkvm::setMode(vkvm::TwoColors);
|
|
REQUIRE(vkvm::getPixel(10, 10) == vkvm::black);
|
|
REQUIRE(vkvm::getPixel(11, 11) == vkvm::white);
|
|
REQUIRE(vkvm::getPixel(12, 12) == vkvm::black);
|
|
REQUIRE(vkvm::getPixel(13, 13) == vkvm::black);
|
|
REQUIRE(vkvm::getPixel(14, 14) == vkvm::black);
|
|
REQUIRE(vkvm::getPixel(15, 15) == vkvm::black);
|
|
REQUIRE(vkvm::getPixel(16, 16) == vkvm::white);
|
|
REQUIRE(vkvm::getPixel(17, 17) == vkvm::white);
|
|
REQUIRE(vkvm::getPixel(18, 18) == vkvm::black);
|
|
|
|
|
|
//different foreground/background color
|
|
vkvm::setBackgroundColor(vkvm::blue);
|
|
vkvm::setForegroundColor(vkvm::red);
|
|
|
|
REQUIRE(vkvm::getBackgroundColor() == vkvm::blue);
|
|
REQUIRE(vkvm::getForegroundColor() == vkvm::red);
|
|
|
|
REQUIRE(vkvm::getPixel(10, 10) == vkvm::blue);
|
|
REQUIRE(vkvm::getPixel(11, 11) == vkvm::red);
|
|
REQUIRE(vkvm::getPixel(12, 12) == vkvm::blue);
|
|
REQUIRE(vkvm::getPixel(13, 13) == vkvm::blue);
|
|
REQUIRE(vkvm::getPixel(14, 14) == vkvm::blue);
|
|
REQUIRE(vkvm::getPixel(15, 15) == vkvm::blue);
|
|
REQUIRE(vkvm::getPixel(16, 16) == vkvm::red);
|
|
REQUIRE(vkvm::getPixel(17, 17) == vkvm::red);
|
|
REQUIRE(vkvm::getPixel(18, 18) == vkvm::blue);
|
|
|
|
}
|
|
|
|
SECTION("Gray256") {
|
|
vkvm::setMode(vkvm::Gray_256);
|
|
REQUIRE(vkvm::getPixel(10, 10) == vkvm::black);
|
|
REQUIRE(vkvm::getPixel(11, 11) == vkvm::white);
|
|
REQUIRE(vkvm::getPixel(12, 12) == vkvm::Color(85, 85, 85));
|
|
REQUIRE(vkvm::getPixel(13, 13) == vkvm::Color(85, 85, 85));
|
|
REQUIRE(vkvm::getPixel(14, 14) == vkvm::Color(85, 85, 85));
|
|
REQUIRE(vkvm::getPixel(15, 15) == vkvm::Color(77, 77, 77));
|
|
REQUIRE(vkvm::getPixel(16, 16) == vkvm::white);
|
|
REQUIRE(vkvm::getPixel(17, 17) == vkvm::white);
|
|
REQUIRE(vkvm::getPixel(18, 18) == vkvm::black);
|
|
}
|
|
|
|
}
|
|
|