review: registry (fix #199)

This commit is contained in:
Michele Caini
2019-03-08 23:54:22 +01:00
parent 9810da6982
commit d0deefd0d7
2 changed files with 120 additions and 95 deletions

View File

@@ -2,6 +2,7 @@
#include <entt/core/hashed_string.hpp>
#include <entt/entity/helper.hpp>
#include <entt/entity/registry.hpp>
#include <entt/core/type_traits.hpp>
TEST(Helper, AsView) {
using entity_type = typename entt::registry<>::entity_type;
@@ -71,6 +72,18 @@ TEST(Helper, Dependency) {
ASSERT_FALSE(registry.has<float>(entity));
}
TEST(Dependency, MultipleListenersOnTheSameType) {
entt::registry<> registry;
entt::connect<double>(registry.construction<int>());
entt::connect<char>(registry.construction<int>());
const auto entity = registry.create();
registry.assign<int>(entity);
ASSERT_TRUE(registry.has<double>(entity));
ASSERT_TRUE(registry.has<char>(entity));
}
TEST(Helper, Label) {
entt::registry<> registry;
const auto entity = registry.create();