Fix Monochrome class with new data structure, unit tests. There is work to be done still
All checks were successful
Build ptprnt / build (push) Successful in 3m51s
All checks were successful
Build ptprnt / build (push) Successful in 3m51s
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
TEST(basic_test, Bitmap_createBitmapWithCertainSize_yieldsSpecifiedSize) {
|
||||
@@ -36,34 +35,28 @@ TEST(basic_test, Bitmap_createBitmapWithCertainSize_yieldsSpecifiedSize) {
|
||||
TEST(basic_test, Bitmap_getBitmapLineOutsideOfImage_yieldsNullopt) {
|
||||
auto bm = ptprnt::graphics::Bitmap<ptprnt::graphics::ALPHA8>(16, 8);
|
||||
// line 8 is out of bounds, count begins with 0
|
||||
auto outOfBoundsLine = bm.getLine(8);
|
||||
ASSERT_EQ(std::nullopt, outOfBoundsLine);
|
||||
EXPECT_ANY_THROW(auto outOfBoundsLine = bm.getLine(8));
|
||||
}
|
||||
|
||||
TEST(basic_test, Bitmap_getBitmapLineInsideOfImage_yieldsValidLineSize) {
|
||||
auto bm = ptprnt::graphics::Bitmap<ptprnt::graphics::ALPHA8>(16, 8);
|
||||
auto line = bm.getLine(7);
|
||||
if (!line) {
|
||||
FAIL() << "Returned line is invalid";
|
||||
}
|
||||
auto lineSize = line->size();
|
||||
auto bm = ptprnt::graphics::Bitmap<ptprnt::graphics::ALPHA8>(16, 8);
|
||||
auto line = bm.getLine(7);
|
||||
auto lineSize = line.size();
|
||||
ASSERT_EQ(16, lineSize);
|
||||
}
|
||||
|
||||
TEST(basic_test, Bitmap_getBitmapColOutsideOfImage_yieldsNullopt) {
|
||||
auto bm = ptprnt::graphics::Bitmap<ptprnt::graphics::ALPHA8>(16, 8);
|
||||
// col 16 is out of bounds, count begins with 0
|
||||
auto outOfBoundsCol = bm.getCol(16);
|
||||
ASSERT_EQ(std::nullopt, outOfBoundsCol);
|
||||
|
||||
EXPECT_ANY_THROW(auto outOfBoundsCol = bm.getCol(16));
|
||||
}
|
||||
|
||||
TEST(basic_test, Bitmap_getBitmapColInsideOfImage_yieldsValidColSize) {
|
||||
auto bm = ptprnt::graphics::Bitmap<ptprnt::graphics::ALPHA8>(16, 8);
|
||||
auto col = bm.getCol(15);
|
||||
if (!col) {
|
||||
FAIL() << "Returned Col is invalid";
|
||||
}
|
||||
auto colSize = col->size();
|
||||
|
||||
auto colSize = col.size();
|
||||
ASSERT_EQ(8, colSize);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user