@@ -352,29 +352,21 @@ pub fn ui_layout_system(
352352
353353#[ cfg( test) ]
354354mod tests {
355+ use crate :: update:: update_cameras_test_system;
356+ use crate :: {
357+ layout:: ui_surface:: UiSurface , prelude:: * , ui_layout_system,
358+ update:: propagate_ui_target_cameras, ContentSize , LayoutContext ,
359+ } ;
355360 use bevy_app:: { App , HierarchyPropagatePlugin , PostUpdate , PropagateSet } ;
356- use taffy:: TraversePartialTree ;
357-
358- use bevy_asset:: { AssetEvent , Assets } ;
359361 use bevy_camera:: { Camera , Camera2d } ;
360362 use bevy_ecs:: { prelude:: * , system:: RunSystemOnce } ;
361- use bevy_image:: Image ;
362363 use bevy_math:: { Rect , UVec2 , Vec2 } ;
363364 use bevy_platform:: collections:: HashMap ;
364- use bevy_render:: texture:: ManualTextureViews ;
365365 use bevy_transform:: systems:: mark_dirty_trees;
366366 use bevy_transform:: systems:: { propagate_parent_transforms, sync_simple_transforms} ;
367367 use bevy_utils:: prelude:: default;
368- use bevy_window:: {
369- PrimaryWindow , Window , WindowCreated , WindowResized , WindowResolution ,
370- WindowScaleFactorChanged ,
371- } ;
372- //use uuid::timestamp::UUID_TICKS_BETWEEN_EPOCHS;
373-
374- use crate :: {
375- layout:: ui_surface:: UiSurface , prelude:: * , ui_layout_system,
376- update:: propagate_ui_target_cameras, ContentSize , LayoutContext ,
377- } ;
368+ use bevy_window:: { PrimaryWindow , Window , WindowResolution } ;
369+ use taffy:: TraversePartialTree ;
378370
379371 // these window dimensions are easy to convert to and from percentage values
380372 const WINDOW_WIDTH : f32 = 1000. ;
@@ -388,22 +380,14 @@ mod tests {
388380 ) ) ;
389381 app. init_resource :: < UiScale > ( ) ;
390382 app. init_resource :: < UiSurface > ( ) ;
391- app. init_resource :: < Events < WindowScaleFactorChanged > > ( ) ;
392- app. init_resource :: < Events < WindowResized > > ( ) ;
393- // Required for the camera system
394- app. init_resource :: < Events < WindowCreated > > ( ) ;
395- app. init_resource :: < Events < AssetEvent < Image > > > ( ) ;
396- app. init_resource :: < Assets < Image > > ( ) ;
397- app. init_resource :: < ManualTextureViews > ( ) ;
398383 app. init_resource :: < bevy_text:: TextPipeline > ( ) ;
399384 app. init_resource :: < bevy_text:: CosmicFontSystem > ( ) ;
400385 app. init_resource :: < bevy_text:: SwashCache > ( ) ;
401386
402387 app. add_systems (
403388 PostUpdate ,
404389 (
405- // UI is driven by calculated camera target info, so we need to run the camera system first
406- bevy_render:: camera:: camera_system,
390+ update_cameras_test_system,
407391 propagate_ui_target_cameras,
408392 ApplyDeferred ,
409393 ui_layout_system,
@@ -1064,14 +1048,7 @@ mod tests {
10641048
10651049 app. add_systems (
10661050 PostUpdate ,
1067- (
1068- // UI is driven by calculated camera target info, so we need to run the camera system first
1069- bevy_render:: camera:: camera_system,
1070- propagate_ui_target_cameras,
1071- ApplyDeferred ,
1072- ui_layout_system,
1073- )
1074- . chain ( ) ,
1051+ ( propagate_ui_target_cameras, ApplyDeferred , ui_layout_system) . chain ( ) ,
10751052 ) ;
10761053
10771054 app. add_plugins ( HierarchyPropagatePlugin :: < ComputedUiTargetCamera > :: new (
@@ -1088,29 +1065,13 @@ mod tests {
10881065 let world = app. world_mut ( ) ;
10891066 world. init_resource :: < UiScale > ( ) ;
10901067 world. init_resource :: < UiSurface > ( ) ;
1091- world. init_resource :: < Events < WindowScaleFactorChanged > > ( ) ;
1092- world. init_resource :: < Events < WindowResized > > ( ) ;
1093- // Required for the camera system
1094- world. init_resource :: < Events < WindowCreated > > ( ) ;
1095- world. init_resource :: < Events < AssetEvent < Image > > > ( ) ;
1096- world. init_resource :: < Assets < Image > > ( ) ;
1097- world. init_resource :: < ManualTextureViews > ( ) ;
10981068
10991069 world. init_resource :: < bevy_text:: TextPipeline > ( ) ;
11001070
11011071 world. init_resource :: < bevy_text:: CosmicFontSystem > ( ) ;
11021072
11031073 world. init_resource :: < bevy_text:: SwashCache > ( ) ;
11041074
1105- // spawn a dummy primary window and camera
1106- world. spawn ( (
1107- Window {
1108- resolution : WindowResolution :: new ( WINDOW_WIDTH , WINDOW_HEIGHT ) ,
1109- ..default ( )
1110- } ,
1111- PrimaryWindow ,
1112- ) ) ;
1113-
11141075 let ui_root = world
11151076 . spawn ( Node {
11161077 width : Val :: Percent ( 100. ) ,
0 commit comments