@@ -156,6 +156,76 @@ fn signature() {
156156 assert ! ( client_app. world( ) . get_entity( client_entity) . is_err( ) ) ;
157157}
158158
159+ #[ test]
160+ fn signature_with_hierarchy ( ) {
161+ let mut server_app = App :: new ( ) ;
162+ let mut client_app = App :: new ( ) ;
163+ for app in [ & mut server_app, & mut client_app] {
164+ app. add_plugins ( (
165+ MinimalPlugins ,
166+ StatesPlugin ,
167+ RepliconPlugins . set ( ServerPlugin :: new ( PostUpdate ) ) ,
168+ ) )
169+ . replicate :: < TestComponent > ( )
170+ . finish ( ) ;
171+ }
172+
173+ server_app. connect_client ( & mut client_app) ;
174+
175+ let client_parent = client_app
176+ . world_mut ( )
177+ . spawn ( ( Replicated , Signature :: from ( 0 ) ) )
178+ . id ( ) ;
179+ let client_child = client_app
180+ . world_mut ( )
181+ . spawn ( ( Replicated , Signature :: from ( 1 ) , ChildOf ( client_parent) ) )
182+ . id ( ) ;
183+
184+ let server_parent = server_app
185+ . world_mut ( )
186+ . spawn ( ( Replicated , Signature :: from ( 0 ) ) )
187+ . id ( ) ;
188+ server_app
189+ . world_mut ( )
190+ . spawn ( ( Replicated , Signature :: from ( 1 ) , ChildOf ( server_parent) ) ) ;
191+
192+ server_app. update ( ) ;
193+ server_app. exchange_with_client ( & mut client_app) ;
194+ client_app. update ( ) ;
195+ server_app. exchange_with_client ( & mut client_app) ;
196+
197+ assert ! ( client_app. world( ) . get_entity( client_parent) . is_ok( ) ) ;
198+ assert ! ( client_app. world( ) . get_entity( client_child) . is_ok( ) ) ;
199+
200+ server_app. world_mut ( ) . despawn ( server_parent) ;
201+
202+ server_app. update ( ) ;
203+ server_app. exchange_with_client ( & mut client_app) ;
204+ client_app. update ( ) ;
205+
206+ assert ! ( client_app. world( ) . get_entity( client_parent) . is_err( ) ) ;
207+ assert ! ( client_app. world( ) . get_entity( client_child) . is_err( ) ) ;
208+
209+ let server_parent = server_app
210+ . world_mut ( )
211+ . spawn ( ( Replicated , Signature :: from ( 0 ) ) )
212+ . id ( ) ;
213+ server_app
214+ . world_mut ( )
215+ . spawn ( ( Replicated , Signature :: from ( 1 ) , ChildOf ( server_parent) ) ) ;
216+
217+ server_app. update ( ) ;
218+ server_app. exchange_with_client ( & mut client_app) ;
219+ client_app. update ( ) ;
220+
221+ let mut remote = client_app. world_mut ( ) . query :: < & Remote > ( ) ;
222+ assert_eq ! (
223+ remote. iter( client_app. world( ) ) . count( ) ,
224+ 2 ,
225+ "entities should be replicated as new due to removal from the signature map"
226+ ) ;
227+ }
228+
159229#[ test]
160230fn hidden_entity ( ) {
161231 let mut server_app = App :: new ( ) ;
0 commit comments