Skip to content

Commit

Permalink
Add a test case for vertical image
Browse files Browse the repository at this point in the history
  • Loading branch information
Laguna1989 committed Jul 7, 2024
1 parent c0c91ec commit 62db6e9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Binary file not shown.
21 changes: 20 additions & 1 deletion test/unit_tests/make_image_from_ase_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ TEST_CASE("make image from rgba ase with one layer", "[image, rgba]")
REQUIRE(img.m_pixels[img.posToIndex(407, 17)] == PixelDataRGBA { 0, 0, 0, 0 });
}

TEST_CASE("make image from grayscale ase with one layer", "[image, grayscale]")
TEST_CASE("make image from horizontal grayscale ase with one layer", "[image, grayscale]")
{
AsepriteData const ase { "assets/test/unit/16_bit_8x1_transition.aseprite" };

Expand All @@ -43,6 +43,25 @@ TEST_CASE("make image from grayscale ase with one layer", "[image, grayscale]")
REQUIRE(img.m_pixels[img.posToIndex(7, 0)] == PixelDataRGBA { 0xff, 0xff, 0xff, 255 });
}

TEST_CASE("make image from vertical grayscale ase with one layer", "[image, grayscale]")
{
AsepriteData const ase { "assets/test/unit/16_bit_1x8_transition.aseprite" };

auto const img = makeImageFromAse(ase);

REQUIRE(img.m_width == 1);
REQUIRE(img.m_height == 8);

REQUIRE(img.m_pixels[img.posToIndex(0, 0)] == PixelDataRGBA { 0, 0, 0, 255 });
REQUIRE(img.m_pixels[img.posToIndex(0, 1)] == PixelDataRGBA { 0x55, 0x55, 0x55, 255 });
REQUIRE(img.m_pixels[img.posToIndex(0, 2)] == PixelDataRGBA { 0x73, 0x73, 0x73, 255 });
REQUIRE(img.m_pixels[img.posToIndex(0, 3)] == PixelDataRGBA { 0x9b, 0x9b, 0x9b, 255 });
REQUIRE(img.m_pixels[img.posToIndex(0, 4)] == PixelDataRGBA { 0xb4, 0xb4, 0xb4, 255 });
REQUIRE(img.m_pixels[img.posToIndex(0, 5)] == PixelDataRGBA { 0xcd, 0xcd, 0xcd, 255 });
REQUIRE(img.m_pixels[img.posToIndex(0, 6)] == PixelDataRGBA { 0xf0, 0xf0, 0xf0, 255 });
REQUIRE(img.m_pixels[img.posToIndex(0, 7)] == PixelDataRGBA { 0xff, 0xff, 0xff, 255 });
}

TEST_CASE("make image from indexed ase with one layer", "[image, indexed]")
{
AsepriteData const ase { "assets/test/unit/8_bit_4x1_indexed.aseprite" };
Expand Down

0 comments on commit 62db6e9

Please sign in to comment.