#include #include #include #include "textures.hpp" #include "constants.hpp" #include "components.hpp" using namespace fmt; TEST_CASE("test texture management", "[textures]") { components::init(); textures::init(); auto spider = textures::get("hairy_spider"); REQUIRE(spider.sprite != nullptr); REQUIRE(spider.texture != nullptr); REQUIRE(spider.frame_size.x == TEXTURE_WIDTH); REQUIRE(spider.frame_size.y == TEXTURE_HEIGHT); auto image = textures::load_image("assets/sprites/hairy_spider.png"); size_t floor_tile = textures::get_id("floor_tile"); size_t gray_stone = textures::get_id("gray_stone_floor_light"); auto floor_ptr = textures::get_surface(floor_tile); REQUIRE(floor_ptr != nullptr); auto gray_stone_ptr = textures::get_surface(gray_stone); REQUIRE(gray_stone_ptr != nullptr); auto& light = textures::get_ambient_light(); REQUIRE(light.size() > 0); REQUIRE(light[floor_tile] == 0); REQUIRE(light[gray_stone] > 0); auto& tiles = textures::get_map_tile_set(); REQUIRE(tiles.size() > 0); REQUIRE(tiles[floor_tile] > 0); REQUIRE(tiles[gray_stone] > 0); auto ceiling = textures::get_ceiling(floor_tile); REQUIRE(ceiling != nullptr); }