Now fully off catch2. YAY!
This commit is contained in:
parent
903cf00661
commit
21e7700deb
16 changed files with 610 additions and 498 deletions
|
|
@ -1,4 +1,4 @@
|
|||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <fuc2/testing.hpp>
|
||||
#include <fmt/core.h>
|
||||
#include <string>
|
||||
#include "graphics/textures.hpp"
|
||||
|
|
@ -6,38 +6,49 @@
|
|||
#include "game/components.hpp"
|
||||
|
||||
using namespace fmt;
|
||||
using namespace fuc2;
|
||||
|
||||
TEST_CASE("test texture management", "[textures]") {
|
||||
components::init();
|
||||
textures::init();
|
||||
namespace textures_tests {
|
||||
void test_test_texture_management() {
|
||||
components::init();
|
||||
textures::init();
|
||||
|
||||
auto spider = textures::get_sprite("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 spider = textures::get_sprite("hairy_spider");
|
||||
CHECK(spider.sprite != nullptr);
|
||||
CHECK(spider.texture != nullptr);
|
||||
CHECK(spider.frame_size.x == TEXTURE_WIDTH);
|
||||
CHECK(spider.frame_size.y == TEXTURE_HEIGHT);
|
||||
|
||||
auto image = textures::load_image("assets/sprites/hairy_spider.png");
|
||||
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");
|
||||
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 floor_ptr = textures::get_surface(floor_tile);
|
||||
CHECK(floor_ptr != nullptr);
|
||||
|
||||
auto gray_stone_ptr = textures::get_surface(gray_stone);
|
||||
REQUIRE(gray_stone_ptr != nullptr);
|
||||
auto gray_stone_ptr = textures::get_surface(gray_stone);
|
||||
CHECK(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& light = textures::get_ambient_light();
|
||||
CHECK(light.size() > 0);
|
||||
CHECK(light[floor_tile] == 0);
|
||||
CHECK(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& tiles = textures::get_map_tile_set();
|
||||
CHECK(tiles.size() > 0);
|
||||
CHECK(tiles[floor_tile] > 0);
|
||||
CHECK(tiles[gray_stone] > 0);
|
||||
|
||||
auto ceiling = textures::get_ceiling(floor_tile);
|
||||
CHECK(ceiling != nullptr);
|
||||
}
|
||||
|
||||
fuc2::Set TESTS{
|
||||
.name="textures",
|
||||
.tests={
|
||||
TEST(test_test_texture_management),
|
||||
}
|
||||
};
|
||||
|
||||
auto ceiling = textures::get_ceiling(floor_tile);
|
||||
REQUIRE(ceiling != nullptr);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue