aboutsummaryrefslogtreecommitdiff
path: root/src/test/RenderSystemTest.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-12-06 19:58:15 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-12-06 19:58:15 +0100
commit9c1fb8b2253149d4a15a94b7ee576a0f9e791033 (patch)
tree666955b4308e2d59f6958119f3efbcbf179c493d /src/test/RenderSystemTest.cpp
parente8d9e38b4c265e0efde32c38d01b511cb572a34d (diff)
parent75ca0750dcc07b6ca043320397917e33638e97b4 (diff)
Merge branch 'niels/decoupling_pixel_and_pos' of github.com:lonkaars/crepe
Diffstat (limited to 'src/test/RenderSystemTest.cpp')
-rw-r--r--src/test/RenderSystemTest.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/test/RenderSystemTest.cpp b/src/test/RenderSystemTest.cpp
index 4868ddd..205f534 100644
--- a/src/test/RenderSystemTest.cpp
+++ b/src/test/RenderSystemTest.cpp
@@ -1,3 +1,4 @@
+#include "types.h"
#include <functional>
#include <gtest/gtest.h>
#include <memory>
@@ -141,10 +142,8 @@ TEST_F(RenderSystemTest, sorting_sprites) {
}
TEST_F(RenderSystemTest, Update) {
- entity1.add_component<Camera>(Camera::Data{.bg_color = Color::WHITE,
- .screen = ivec2{1080, 720},
- .viewport_size = vec2{2000, 2000},
- .zoom = 1.0f});
+ entity1.add_component<Camera>(ivec2{100, 100}, vec2{100, 100},
+ Camera::Data{.bg_color = Color::WHITE, .zoom = 1.0f});
{
vector<reference_wrapper<Sprite>> sprites = this->mgr.get_components_by_type<Sprite>();
ASSERT_EQ(sprites.size(), 4);
@@ -172,10 +171,9 @@ TEST_F(RenderSystemTest, Camera) {
EXPECT_NE(cameras.size(), 1);
}
{
- entity1.add_component<Camera>(Camera::Data{.bg_color = Color::WHITE,
- .screen = ivec2{1080, 720},
- .viewport_size = vec2{2000, 2000},
- .zoom = 1.0f});
+ entity1.add_component<Camera>(ivec2{100, 100}, vec2{100, 100},
+ Camera::Data{.bg_color = Color::WHITE, .zoom = 1.0f});
+
auto cameras = this->mgr.get_components_by_type<Camera>();
EXPECT_EQ(cameras.size(), 1);
}
@@ -183,10 +181,9 @@ TEST_F(RenderSystemTest, Camera) {
//TODO improve with newer version
}
TEST_F(RenderSystemTest, Color) {
- entity1.add_component<Camera>(Camera::Data{.bg_color = Color::WHITE,
- .screen = ivec2{1080, 720},
- .viewport_size = vec2{2000, 2000},
- .zoom = 1.0f});
+ entity1.add_component<Camera>(ivec2{100, 100}, vec2{100, 100},
+ Camera::Data{.bg_color = Color::WHITE, .zoom = 1.0f});
+
auto & sprite = this->mgr.get_components_by_id<Sprite>(entity1.id).front().get();
ASSERT_NE(sprite.texture.texture.get(), nullptr);