More tests converted to fuc2.
This commit is contained in:
parent
b8b42d5681
commit
903cf00661
10 changed files with 671 additions and 556 deletions
|
|
@ -1,4 +1,4 @@
|
|||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <fuc2/testing.hpp>
|
||||
#include <fmt/core.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <fstream>
|
||||
|
|
@ -8,35 +8,47 @@
|
|||
#include "algos/point.hpp"
|
||||
|
||||
using namespace lighting;
|
||||
using namespace fuc2;
|
||||
|
||||
TEST_CASE("lighting a map works", "[lighting]") {
|
||||
GameDB::init();
|
||||
auto& level = GameDB::current_level();
|
||||
auto& map = *level.map;
|
||||
namespace lighting_tests {
|
||||
|
||||
Point light1, light2;
|
||||
void test_lighting_a_map_works() {
|
||||
GameDB::init();
|
||||
auto& level = GameDB::current_level();
|
||||
auto& map = *level.map;
|
||||
|
||||
REQUIRE(map.place_entity(0, light1));
|
||||
REQUIRE(map.place_entity(0, light1));
|
||||
Point light1, light2;
|
||||
|
||||
LightSource source1{6, 1.0};
|
||||
LightSource source2{4,3};
|
||||
CHECK(map.place_entity(0, light1));
|
||||
CHECK(map.place_entity(0, light1));
|
||||
|
||||
LightRender lr(map.walls());
|
||||
LightSource source1{6, 1.0};
|
||||
LightSource source2{4,3};
|
||||
|
||||
lr.reset_light();
|
||||
LightRender lr(map.walls());
|
||||
|
||||
lr.set_light_target(light1);
|
||||
lr.set_light_target(light2);
|
||||
lr.reset_light();
|
||||
|
||||
lr.path_light(map.walls());
|
||||
lr.set_light_target(light1);
|
||||
lr.set_light_target(light2);
|
||||
|
||||
lr.render_light(source1, light1);
|
||||
lr.render_light(source2, light2);
|
||||
lr.path_light(map.walls());
|
||||
|
||||
lr.clear_light_target(light1);
|
||||
lr.clear_light_target(light2);
|
||||
lr.render_light(source1, light1);
|
||||
lr.render_light(source2, light2);
|
||||
|
||||
Matrix &lighting = lr.lighting();
|
||||
(void)lighting;
|
||||
lr.clear_light_target(light1);
|
||||
lr.clear_light_target(light2);
|
||||
|
||||
Matrix &lighting = lr.lighting();
|
||||
(void)lighting;
|
||||
}
|
||||
|
||||
|
||||
fuc2::Set TESTS{
|
||||
.name="lighting",
|
||||
.tests={
|
||||
TEST(test_lighting_a_map_works),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue