+ Bitmap and Font unit tests

This commit is contained in:
Julian Hinxlage 2019-10-23 12:18:43 +02:00
parent d95f142d0f
commit cf0e6a082d
2 changed files with 22 additions and 5 deletions

View File

@ -1,9 +1,9 @@
#include <iostream>
#include "add.h" #include "add.h"
#include "Bitmap.h" #include "Bitmap.h"
#include "Font.h" #include "Font.h"
#include <iostream>
/** /**
* @author: Julian Hinxlage * @author: Julian Hinxlage
* @since: v0.0.0 * @since: v0.0.0

View File

@ -1,5 +1,6 @@
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
#include <Bitmap.h> #include "Bitmap.h"
#include "Font.h"
TEST_CASE("default values") { TEST_CASE("default values") {
Bitmap bitmap = Bitmap(); Bitmap bitmap = Bitmap();
@ -7,3 +8,19 @@ TEST_CASE("default values") {
REQUIRE(bitmap.getHeight() == 0); REQUIRE(bitmap.getHeight() == 0);
REQUIRE(bitmap.getBitsPerPixel() == 0); REQUIRE(bitmap.getBitsPerPixel() == 0);
} }
TEST_CASE("load Bitmap") {
Bitmap bitmap = Bitmap("../res/font.bmp");
REQUIRE(bitmap.getWidth() == 128);
REQUIRE(bitmap.getHeight() == 64);
REQUIRE(bitmap.getBitsPerPixel() == 24);
}
TEST_CASE("Font") {
Font font("../res/font.bmp");
REQUIRE(font.width() == 5);
REQUIRE(font.height() == 7);
REQUIRE(!font.getPixel('a', 1,1));
REQUIRE(font.getPixel('a', 1,2));
}