mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-23 06:48:15 +00:00
Reworking the view
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// Created by Zoe Roux on 6/3/21.
|
||||
//
|
||||
|
||||
#include "Entity/Entity.hpp"
|
||||
#include "Component/Position/PositionComponent.hpp"
|
||||
#include "System/Movable/MovableSystem.hpp"
|
||||
#include "System/Controllable/ControllableSystem.hpp"
|
||||
#include <catch2/catch.hpp>
|
||||
#include <Wal.hpp>
|
||||
#include <Component/Controllable/ControllableComponent.hpp>
|
||||
|
||||
#define private public
|
||||
#include <Component/Movable/MovableComponent.hpp>
|
||||
|
||||
using namespace WAL;
|
||||
using namespace BBM;
|
||||
|
||||
TEST_CASE("View creation", "[View]")
|
||||
{
|
||||
Wal wal;
|
||||
Scene scene(wal);
|
||||
scene.addEntity("player")
|
||||
.addComponent<PositionComponent>()
|
||||
.addComponent<ControllableComponent>();
|
||||
scene.addEntity("Box")
|
||||
.addComponent<PositionComponent>();
|
||||
REQUIRE(scene.view<PositionComponent>().size() == 2);
|
||||
REQUIRE(scene.view<PositionComponent, ControllableComponent>().size() == 1);
|
||||
Entity &entity = *scene.getEntities().begin();
|
||||
Entity &firstView = *scene.view<PositionComponent, ControllableComponent>().begin();
|
||||
REQUIRE(&entity == &firstView);
|
||||
}
|
||||
Reference in New Issue
Block a user