You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.2 KiB
43 lines
1.2 KiB
#include <catch2/catch_test_macros.hpp>
|
|
#include <fmt/core.h>
|
|
#include <string>
|
|
#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);
|
|
}
|
|
|