@@ -381,7 +381,8 @@ mod tests {
381
381
use bevy_app:: { App , Update } ;
382
382
use bevy_asset:: { load_internal_binary_asset, Handle } ;
383
383
use bevy_ecs:: { event:: Events , schedule:: IntoSystemConfigs } ;
384
- use bevy_utils:: default;
384
+
385
+ use crate :: { detect_text_needs_rerender, TextSpansScratch } ;
385
386
386
387
use super :: * ;
387
388
@@ -398,12 +399,15 @@ mod tests {
398
399
. init_resource :: < TextPipeline > ( )
399
400
. init_resource :: < CosmicFontSystem > ( )
400
401
. init_resource :: < SwashCache > ( )
402
+ . init_resource :: < TextSpansScratch > ( )
401
403
. add_systems (
402
404
Update ,
403
405
(
406
+ detect_text_needs_rerender :: < Text2d , TextSpan2d > ,
404
407
update_text2d_layout,
405
- calculate_bounds_text2d. after ( update_text2d_layout) ,
406
- ) ,
408
+ calculate_bounds_text2d,
409
+ )
410
+ . chain ( ) ,
407
411
) ;
408
412
409
413
// A font is needed to ensure the text is laid out with an actual size.
@@ -414,13 +418,7 @@ mod tests {
414
418
|bytes: & [ u8 ] , _path: String | { Font :: try_from_bytes( bytes. to_vec( ) ) . unwrap( ) }
415
419
) ;
416
420
417
- let entity = app
418
- . world_mut ( )
419
- . spawn ( ( Text2dBundle {
420
- text : Text :: from_section ( FIRST_TEXT , default ( ) ) ,
421
- ..default ( )
422
- } , ) )
423
- . id ( ) ;
421
+ let entity = app. world_mut ( ) . spawn ( Text2d :: new ( FIRST_TEXT ) ) . id ( ) ;
424
422
425
423
( app, entity)
426
424
}
@@ -472,8 +470,8 @@ mod tests {
472
470
. get_entity_mut ( entity)
473
471
. expect ( "Could not find entity" ) ;
474
472
* entity_ref
475
- . get_mut :: < Text > ( )
476
- . expect ( "Missing Text on entity" ) = Text :: from_section ( SECOND_TEXT , default ( ) ) ;
473
+ . get_mut :: < Text2d > ( )
474
+ . expect ( "Missing Text2d on entity" ) = Text2d :: new ( SECOND_TEXT ) ;
477
475
478
476
// Recomputes the AABB.
479
477
app. update ( ) ;
0 commit comments