File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change 1818#include < set>
1919#include < map>
2020#include " entityx/3rdparty/catch.hpp"
21- #include " entityx/Entity .h"
21+ #include " entityx/entityx .h"
2222
2323// using namespace std;
2424using namespace entityx ;
@@ -519,3 +519,26 @@ TEST_CASE_METHOD(EntityManagerFixture, "TestEntityInStdMap") {
519519 REQUIRE (entityMap[b] == 2 );
520520 REQUIRE (entityMap[c] == 3 );
521521}
522+
523+ TEST_CASE (" TestComponentDestructorCalledWhenManagerDestroyed" ) {
524+ struct Freed {
525+ explicit Freed (bool &yes) : yes(yes) {}
526+ ~Freed () { yes = true ; }
527+
528+ bool &yes;
529+ };
530+
531+ struct Test : Component<Test> {
532+ Test (bool &yes) : freed(yes) {}
533+
534+ Freed freed;
535+ };
536+
537+ bool freed = false ;
538+ {
539+ EntityX e;
540+ auto test = e.entities .create ();
541+ test.assign <Test>(freed);
542+ }
543+ REQUIRE (freed == true );
544+ }
You can’t perform that action at this time.
0 commit comments