|
|
@@ -12,7 +12,7 @@ TEST(RuntimeView, Functionalities) {
|
|
|
registry.reserve<int>(0);
|
|
|
registry.reserve<char>(0);
|
|
|
|
|
|
- ENTT_ID_TYPE types[] = { entt::type_info<int>::id(), entt::type_info<char>::id() };
|
|
|
+ entt::id_type types[] = { entt::type_info<int>::id(), entt::type_info<char>::id() };
|
|
|
auto view = registry.runtime_view(std::begin(types), std::end(types));
|
|
|
|
|
|
ASSERT_TRUE(view.empty());
|
|
|
@@ -55,7 +55,7 @@ TEST(RuntimeView, Iterator) {
|
|
|
registry.emplace<int>(entity);
|
|
|
registry.emplace<char>(entity);
|
|
|
|
|
|
- ENTT_ID_TYPE types[] = { entt::type_info<int>::id(), entt::type_info<char>::id() };
|
|
|
+ entt::id_type types[] = { entt::type_info<int>::id(), entt::type_info<char>::id() };
|
|
|
auto view = registry.runtime_view(std::begin(types), std::end(types));
|
|
|
using iterator = typename decltype(view)::iterator;
|
|
|
|
|
|
@@ -91,7 +91,7 @@ TEST(RuntimeView, Contains) {
|
|
|
|
|
|
registry.destroy(e0);
|
|
|
|
|
|
- ENTT_ID_TYPE types[] = { entt::type_info<int>::id(), entt::type_info<char>::id() };
|
|
|
+ entt::id_type types[] = { entt::type_info<int>::id(), entt::type_info<char>::id() };
|
|
|
auto view = registry.runtime_view(std::begin(types), std::end(types));
|
|
|
|
|
|
ASSERT_FALSE(view.contains(e0));
|
|
|
@@ -110,7 +110,7 @@ TEST(RuntimeView, Empty) {
|
|
|
registry.emplace<char>(e1);
|
|
|
registry.emplace<float>(e1);
|
|
|
|
|
|
- ENTT_ID_TYPE types[] = { entt::type_info<int>::id(), entt::type_info<char>::id(), entt::type_info<float>::id() };
|
|
|
+ entt::id_type types[] = { entt::type_info<int>::id(), entt::type_info<char>::id(), entt::type_info<float>::id() };
|
|
|
auto view = registry.runtime_view(std::begin(types), std::end(types));
|
|
|
|
|
|
view.each([](auto) { FAIL(); });
|
|
|
@@ -130,7 +130,7 @@ TEST(RuntimeView, Each) {
|
|
|
registry.emplace<int>(e1);
|
|
|
registry.emplace<char>(e1);
|
|
|
|
|
|
- ENTT_ID_TYPE types[] = { entt::type_info<int>::id(), entt::type_info<char>::id() };
|
|
|
+ entt::id_type types[] = { entt::type_info<int>::id(), entt::type_info<char>::id() };
|
|
|
auto view = registry.runtime_view(std::begin(types), std::end(types));
|
|
|
std::size_t cnt = 0;
|
|
|
|
|
|
@@ -152,7 +152,7 @@ TEST(RuntimeView, EachWithHoles) {
|
|
|
registry.emplace<int>(e0, 0);
|
|
|
registry.emplace<int>(e2, 2);
|
|
|
|
|
|
- ENTT_ID_TYPE types[] = { entt::type_info<int>::id(), entt::type_info<char>::id() };
|
|
|
+ entt::id_type types[] = { entt::type_info<int>::id(), entt::type_info<char>::id() };
|
|
|
auto view = registry.runtime_view(std::begin(types), std::end(types));
|
|
|
|
|
|
view.each([e0](auto entity) {
|
|
|
@@ -166,7 +166,7 @@ TEST(RuntimeView, MissingPool) {
|
|
|
const auto e0 = registry.create();
|
|
|
registry.emplace<int>(e0);
|
|
|
|
|
|
- ENTT_ID_TYPE types[] = { entt::type_info<int>::id(), entt::type_info<char>::id() };
|
|
|
+ entt::id_type types[] = { entt::type_info<int>::id(), entt::type_info<char>::id() };
|
|
|
auto view = registry.runtime_view(std::begin(types), std::end(types));
|
|
|
|
|
|
ASSERT_TRUE(view.empty());
|
|
|
@@ -189,7 +189,7 @@ TEST(RuntimeView, EmptyRange) {
|
|
|
const auto e0 = registry.create();
|
|
|
registry.emplace<int>(e0);
|
|
|
|
|
|
- const ENTT_ID_TYPE *ptr = nullptr;
|
|
|
+ const entt::id_type *ptr = nullptr;
|
|
|
auto view = registry.runtime_view(ptr, ptr);
|
|
|
|
|
|
ASSERT_TRUE(view.empty());
|
|
|
@@ -200,3 +200,26 @@ TEST(RuntimeView, EmptyRange) {
|
|
|
|
|
|
ASSERT_EQ((std::find(view.begin(), view.end(), e0)), view.end());
|
|
|
}
|
|
|
+
|
|
|
+TEST(RuntimeView, ExcludedComponents) {
|
|
|
+ entt::registry registry;
|
|
|
+
|
|
|
+ const auto e0 = registry.create();
|
|
|
+ registry.emplace<int>(e0);
|
|
|
+
|
|
|
+ const auto e1 = registry.create();
|
|
|
+ registry.emplace<int>(e1);
|
|
|
+ registry.emplace<char>(e1);
|
|
|
+
|
|
|
+ entt::id_type components[] = { entt::type_info<int>::id() };
|
|
|
+ entt::id_type filter[] = { entt::type_info<char>::id(), entt::type_info<double>::id() };
|
|
|
+ auto view = registry.runtime_view(std::begin(components), std::end(components), std::begin(filter), std::end(filter));
|
|
|
+
|
|
|
+ ASSERT_FALSE(view.empty());
|
|
|
+ ASSERT_TRUE(view.contains(e0));
|
|
|
+ ASSERT_FALSE(view.contains(e1));
|
|
|
+
|
|
|
+ view.each([e0](auto entity) {
|
|
|
+ ASSERT_EQ(e0, entity);
|
|
|
+ });
|
|
|
+}
|