diff --git a/testmaps/q2_wal_metadata/textures/e1u1/yellow32x32.png b/testmaps/q2_wal_metadata/textures/e1u1/yellow32x32.png new file mode 100644 index 00000000..f1530e24 Binary files /dev/null and b/testmaps/q2_wal_metadata/textures/e1u1/yellow32x32.png differ diff --git a/tests/test_common.cc b/tests/test_common.cc index f402fddb..400fe77d 100644 --- a/tests/test_common.cc +++ b/tests/test_common.cc @@ -4,6 +4,9 @@ #include #include #include +#include +#include +#include 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); + } }