From cf0e6a082d4e96dcdebcc61df5e88777402e5423 Mon Sep 17 00:00:00 2001 From: Julian Hinxlage Date: Wed, 23 Oct 2019 12:18:43 +0200 Subject: [PATCH] + Bitmap and Font unit tests --- main/main.cpp | 6 +++--- test/test_bitmap.cpp | 21 +++++++++++++++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/main/main.cpp b/main/main.cpp index a5541a8..da3cfe1 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1,9 +1,9 @@ -#include - #include "add.h" #include "Bitmap.h" #include "Font.h" +#include + /** * @author: Julian Hinxlage * @since: v0.0.0 @@ -33,4 +33,4 @@ int main() { } return 0; -} \ No newline at end of file +} diff --git a/test/test_bitmap.cpp b/test/test_bitmap.cpp index a902711..b234e9d 100644 --- a/test/test_bitmap.cpp +++ b/test/test_bitmap.cpp @@ -1,9 +1,26 @@ #include -#include +#include "Bitmap.h" +#include "Font.h" TEST_CASE("default values") { Bitmap bitmap = Bitmap(); REQUIRE(bitmap.getWidth() == 0); REQUIRE(bitmap.getHeight() == 0); REQUIRE(bitmap.getBitsPerPixel() == 0); -} \ No newline at end of file +} + +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)); +} +