Added more methods to uninitialized tests

This commit is contained in:
Leonetienne 2022-03-06 17:44:55 +01:00
parent 6c92ae504c
commit 87fd692149
2 changed files with 31 additions and 5 deletions

View File

@ -1,12 +1,15 @@
#include <BMP.h> #include <BMP.h>
#include <iostream> #include <iostream>
#include <BmpHeader.h> #include <BmpHeader.h>
#include <Eule/Math.h>
using namespace Leonetienne::BmpPP; using namespace Leonetienne::BmpPP;
using namespace Eule;
int main() { int main() {
/* /*
BMP bmp({800, 600}, Colormode::RGB); BMP bmp({800, 600}, Colormode::RGB);
for (int x = 0; x < 800; x++) for (int x = 0; x < 800; x++)
@ -21,14 +24,13 @@ int main() {
} }
bmp.Write("write.bmp"); bmp.Write("write.bmp");
*/ */
BMP bmp("basea_hachi.bmp");
BMP bmp("basea_gradient.bmp"); BMP cropped = bmp.Crop(Vector2i(95, 83), Vector2i(95 + 149, 83 + 239));
BMP newBmp = bmp.MirrorHorizontally(); if(!cropped.Write("basea_hachi_cropped.bmp"))
//BMP newBmp = bmp.MirrorVertically();
if(!newBmp.Write("basea_gradient_flipped_hor.bmp"))
std::cerr << "What the hell" << std::endl; std::cerr << "What the hell" << std::endl;
/* /*

View File

@ -81,6 +81,30 @@ TEST_CASE(__FILE__"/RuntimeErrorOnUninitialized", "[Uninitialized]")
, std::runtime_error , std::runtime_error
); );
REQUIRE_THROWS_AS(
bmp.Rotate180deg()
, std::runtime_error
);
REQUIRE_THROWS_AS(
bmp.Rotate90degClockwise()
, std::runtime_error
);
REQUIRE_THROWS_AS(
bmp.Rotate90degCounterclockwise()
, std::runtime_error
);
REQUIRE_THROWS_AS(
bmp.Crop({0,0}, {5,5})
, std::runtime_error
);
REQUIRE_THROWS_AS(
bmp.ConvertColormode(Colormode::RGB)
, std::runtime_error
);
return; return;
} }