Michele Caini 3 лет назад
Родитель
Сommit
80d55a226c
1 измененных файлов с 12 добавлено и 2 удалено
  1. 12 2
      test/entt/entity/handle.cpp

+ 12 - 2
test/entt/entity/handle.cpp

@@ -298,6 +298,9 @@ TEST(BasicHandle, HandleStorageIterator) {
     const auto entity = registry.create();
 
     registry.emplace<int>(entity);
+    registry.emplace<double>(entity);
+    // required to test the find-first initialization step
+    registry.storage<entt::entity>().erase(entity);
 
     auto test = [](auto iterable) {
         auto end{iterable.begin()};
@@ -313,6 +316,13 @@ TEST(BasicHandle, HandleStorageIterator) {
         ASSERT_EQ(++begin, iterable.end());
     };
 
-    test(entt::handle{registry, entity}.storage());
-    test(entt::const_handle{std::as_const(registry), entity}.storage());
+    const auto handle = entt::handle{registry, entity};
+    const auto chandle = entt::const_handle{std::as_const(registry), entity};
+
+    ASSERT_FALSE(registry.valid(entity));
+    ASSERT_FALSE(handle);
+    ASSERT_FALSE(chandle);
+
+    test(handle.storage());
+    test(chandle.storage());
 }