File tree Expand file tree Collapse file tree 3 files changed +25
-63
lines changed Expand file tree Collapse file tree 3 files changed +25
-63
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -52,4 +52,29 @@ impl EntityChange {
5252 pub fn component ( & self ) -> ComponentId {
5353 self . component
5454 }
55+ }
56+
57+ mod tests {
58+ #![ allow( unused_imports) ]
59+ use crate :: component:: ComponentId ;
60+ use crate :: entity:: Entity ;
61+ use crate :: storage:: { Changes , EntityChange } ;
62+
63+ #[ test]
64+ fn changes ( ) {
65+ let mut storage = Changes :: new ( ) ;
66+ let entity = Entity :: PLACEHOLDER ;
67+ let component = ComponentId :: new ( 1 ) ;
68+ storage. push ( EntityChange :: new ( entity, component) ) ;
69+ storage. push ( EntityChange :: new ( entity, component) ) ;
70+
71+ let changes = storage. take_all ( ) ;
72+ assert_eq ! ( changes. len( ) , 2 ) ;
73+ assert_eq ! ( storage. take_all( ) . len( ) , 0 ) ;
74+
75+ changes. iter ( ) . for_each ( |change| {
76+ assert_eq ! ( change. component, component) ;
77+ assert_eq ! ( change. entity, entity) ;
78+ } )
79+ }
5580}
Original file line number Diff line number Diff line change @@ -63,7 +63,6 @@ use bevy_ptr::UnsafeCellDeref;
6363
6464use core:: panic:: Location ;
6565use unsafe_world_cell:: { UnsafeEntityCell , UnsafeWorldCell } ;
66- use crate :: storage:: Changes ;
6766
6867/// A [`World`] mutation.
6968///
@@ -136,14 +135,6 @@ pub struct World {
136135 pub ( crate ) command_queue : RawCommandQueue ,
137136}
138137
139- impl World {
140-
141- /// Just For Test
142- pub fn test ( & mut self ) -> & mut Changes {
143- & mut self . storages . changes
144- }
145- }
146-
147138impl Default for World {
148139 fn default ( ) -> Self {
149140 let mut world = Self {
You can’t perform that action at this time.
0 commit comments