-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Laguna1989/feature/MoreUnitTests
Add more unit tests
- Loading branch information
Showing
16 changed files
with
545 additions
and
129 deletions.
There are no files selected for viewing
Binary file added
BIN
+638 Bytes
assets/test/unit/32_bit_2x2_white_with_transparent_overlay.aseprite
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "constants.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef ASELIB_CONSTANTS_HPP | ||
#define ASELIB_CONSTANTS_HPP | ||
|
||
namespace aselib { | ||
|
||
namespace magic_numbers { | ||
} // namespace magic_numbers | ||
|
||
namespace chunk_type_constants { | ||
|
||
inline constexpr auto color_profile = 0x2007; | ||
inline constexpr auto palette = 0x2019; | ||
inline constexpr auto layer = 0x2004; | ||
inline constexpr auto cel = 0x2005; | ||
inline constexpr auto tag = 0x2018; | ||
inline constexpr auto user_data = 0x2020; | ||
|
||
} // namespace chunk_type_constants | ||
|
||
} // namespace aselib | ||
|
||
#endif // ASELIB_CONSTANTS_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include "catch2/catch.hpp" | ||
#include <aselib/aseprite_data.hpp> | ||
|
||
using namespace aselib; | ||
|
||
TEST_CASE( | ||
"AsepriteData Constructor raises exception when called invalid filepath", "[AsepriteData]") | ||
{ | ||
REQUIRE_THROWS(AsepriteData { "non-existing_file&&++:," }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "catch2/catch.hpp" | ||
#include <aselib/aseprite_header.hpp> | ||
#include <aselib/chunk_data.hpp> | ||
#include <aselib/frame_header.hpp> | ||
#include <aselib/parse_functions.hpp> | ||
#include <fstream> | ||
using namespace aselib; | ||
|
||
TEST_CASE("parse first chunk header results in correct stream offset", "[header]") | ||
{ | ||
std::ifstream in { "assets/test/unit/32_bit_1x1_white.aseprite", std::ios::binary }; | ||
REQUIRE(in.good()); | ||
AsepriteHeader hdr {}; | ||
in >> hdr; | ||
|
||
REQUIRE(hdr.m_number_of_frames == 1); | ||
|
||
FrameHader frameHeader {}; | ||
in >> frameHeader; | ||
REQUIRE(in.tellg() == 128 + 16); | ||
(void)parseChunkHeader(in); | ||
REQUIRE(in.tellg() == 128 + 16 + 6); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.