Explorar o código

tests + bug fixing

Michele Caini %!s(int64=7) %!d(string=hai) anos
pai
achega
c45de0c032
Modificáronse 2 ficheiros con 8 adicións e 1 borrados
  1. 3 1
      src/entt/entity/registry.hpp
  2. 5 0
      test/entt/entity/registry.cpp

+ 3 - 1
src/entt/entity/registry.hpp

@@ -440,10 +440,12 @@ public:
         const auto other = create();
 
         for(auto pos = pools.size(); pos; --pos) {
-            auto &cpool = std::get<0>(pools[pos-1]);
+            auto &tup = pools[pos-1];
+            auto &cpool = std::get<0>(tup);
 
             if(cpool && cpool->has(entity)) {
                 cpool->clone(other, entity);
+                std::get<1>(tup).publish(*this, other);
             }
         }
 

+ 5 - 0
test/entt/entity/registry.cpp

@@ -719,6 +719,11 @@ TEST(DefaultRegistry, ComponentSignals) {
 
     ASSERT_EQ(listener.counter, 1);
     ASSERT_EQ(listener.last, e1);
+
+    e1 = registry.clone(e0);
+
+    ASSERT_EQ(listener.counter, 2);
+    ASSERT_EQ(listener.last, e1);
 }
 
 TEST(DefaultRegistry, TagSignals) {