Added tests for mirroring functions
This commit is contained in:
39
Test/MirrorHorizontally.cpp
Normal file
39
Test/MirrorHorizontally.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include <Bmp.h>
|
||||
#include <stdexcept>
|
||||
#include "Catch2.h"
|
||||
|
||||
using namespace Leonetienne::BmpPP;
|
||||
using namespace Eule;
|
||||
|
||||
// Tests the mirror horizontal function against reference images
|
||||
TEST_CASE(__FILE__"/Mirroring produces the correct results", "[Mirroring][MirrorHorizontally]")
|
||||
{
|
||||
SECTION("RGB") {
|
||||
// Read a gradient image
|
||||
BMP bmp("base_gradient.bmp");
|
||||
|
||||
// Mirror it
|
||||
bmp = bmp.MirrorHorizontally();
|
||||
|
||||
// Read reference image
|
||||
const BMP reference("base_gradient_flipped_hor.bmp");
|
||||
|
||||
// Assert that they are equal
|
||||
REQUIRE(bmp == reference);
|
||||
}
|
||||
|
||||
SECTION("RGBA") {
|
||||
// Read a gradient image
|
||||
BMP bmp("basea_gradient.bmp");
|
||||
|
||||
// Mirror it
|
||||
bmp = bmp.MirrorHorizontally();
|
||||
|
||||
// Read reference image
|
||||
const BMP reference("basea_gradient_flipped_hor.bmp");
|
||||
|
||||
// Assert that they are equal
|
||||
REQUIRE(bmp == reference);
|
||||
}
|
||||
return;
|
||||
}
|
||||
Reference in New Issue
Block a user