Loading...
Searching...
No Matches
test_scene.cpp
Go to the documentation of this file.
1//
2// Created by denzel on 27/10/2025.
3//
4#include <catch2/catch_test_macros.hpp>
5
6#include "hellfire/graphics/geometry/Cube.h"
7#include "hellfire/graphics/geometry/Sphere.h"
8#include "hellfire/scene/Scene.h"
9
10TEST_CASE("Scenes can be created and destroyed") {
11 auto test_scene = std::make_unique<hellfire::Scene>("Test Scene");
12
13 REQUIRE(test_scene->get_name() == "Test Scene");
14 REQUIRE(test_scene->get_entity_count() == 0);
15
16 SECTION("adding one entity increases total count") {
17 const hellfire::EntityID test_entity_id = test_scene->create_entity("Test Object");
18 REQUIRE(test_scene->get_entity(test_entity_id)->get_name() == "Test Object");
19 REQUIRE(test_scene->get_entity_count() == 1);
20 }
21 SECTION("removing one entity decreases total count") {
22 const hellfire::EntityID entity_to_delete_id = test_scene->create_entity("Test Object To Delete");
23 REQUIRE(test_scene->get_entity_count() == 1);
24
25 test_scene->destroy_entity(entity_to_delete_id);
26 const hellfire::Entity *deleted_entity_ptr = test_scene->get_entity(entity_to_delete_id);
27
28 REQUIRE(test_scene->get_entity_count() == 0);
29 REQUIRE(deleted_entity_ptr == nullptr);
30 }
31}
32
33TEST_CASE("Scenes can be renamed") {
34 const auto test_scene = std::make_unique<hellfire::Scene>("Test Scene");
35 REQUIRE(test_scene->get_name() == "Test Scene");
36
37 test_scene->set_name("Better Name V2");
38 REQUIRE(test_scene->get_name() == "Better Name V2");
39}
40
41TEST_CASE("Scenes can have multiple entities") {
42 const auto test_scene = new hellfire::Scene("Test Scene"); // Needs to be a raw pointer
43 REQUIRE(test_scene->get_entity_count() == 0);
44
45 test_scene->create_entity("Tree");
46 REQUIRE(test_scene->get_entity_count() == 1);
47 test_scene->create_entity("Car");
48 REQUIRE(test_scene->get_entity_count() == 2);
49}
50
51TEST_CASE("Scene camera management") {
52}
53
54
55TEST_CASE("Finding entities in scene") {
56}
57
58
59TEST_CASE("Scene updates world matrices correctly") {
60}
61
62TEST_CASE("Scene can have complex hierarchies") {
63}
TEST_CASE("")
Definition main_test.cpp:6