common: add png loader test

This commit is contained in:
Eric Wasylishen 2023-04-10 14:06:35 -06:00
parent 3997e8c9bc
commit ac21db8722
2 changed files with 29 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

View File

@ -4,6 +4,9 @@
#include <common/bspfile.hh>
#include <common/bspfile_q1.hh>
#include <common/bspfile_q2.hh>
#include <common/imglib.hh>
#include <common/settings.hh>
#include <testmaps.hh>
TEST_SUITE("common")
{
@ -211,4 +214,30 @@ TEST_SUITE("common")
}
}
}
TEST_CASE("imglib png loader")
{
auto *game = bspver_q2.game;
auto wal_metadata_path = std::filesystem::path(testmaps_dir) / "q2_wal_metadata";
settings::common_settings settings;
settings.paths.addValue(wal_metadata_path.string(), settings::source::COMMANDLINE);
game->init_filesystem("placeholder.map", settings);
auto [texture, resolve, data] = img::load_texture("e1u1/yellow32x32", false, game, settings);
REQUIRE(texture);
CHECK(texture->meta.name == "e1u1/yellow32x32");
CHECK(texture->meta.width == 32);
CHECK(texture->meta.height == 32);
CHECK(texture->meta.extension.value() == img::ext::STB);
CHECK(!texture->meta.color_override);
CHECK(texture->width == 32);
CHECK(texture->height == 32);
CHECK(texture->width_scale == 1);
CHECK(texture->height_scale == 1);
}
}