@@ -91,18 +91,22 @@ impl UserInterfaceTestingExtension for UserInterface {
9191 fn click_at ( & mut self , uuid : Uuid ) -> Handle < UiNode > {
9292 assert_ne ! ( uuid, Uuid :: default ( ) ) ;
9393 if let Some ( ( handle, n) ) = self . find_from_root ( & mut |n| n. id == uuid) {
94- info ! ( "{} - bounds {:?}" , uuid, n. screen_bounds( ) ) ;
94+ if self . visual_debug {
95+ info ! ( "{} - bounds {:?}" , uuid, n. screen_bounds( ) ) ;
96+ }
9597 assert ! ( is_enabled( handle, self ) ) ;
9698 assert ! ( n. is_globally_visible( ) ) ;
9799 let center = n. screen_bounds ( ) . center ( ) ;
98100 self . click ( center) ;
99- info ! (
100- "==== Clicked at {uuid}({}:{}) at [{};{}] coords. ====" ,
101- handle. index( ) ,
102- handle. generation( ) ,
103- center. x,
104- center. y
105- ) ;
101+ if self . visual_debug {
102+ info ! (
103+ "==== Clicked at {uuid}({}:{}) at [{};{}] coords. ====" ,
104+ handle. index( ) ,
105+ handle. generation( ) ,
106+ center. x,
107+ center. y
108+ ) ;
109+ }
106110 handle
107111 } else {
108112 panic ! ( "There's no widget {uuid}!" )
@@ -112,7 +116,9 @@ impl UserInterfaceTestingExtension for UserInterface {
112116 fn click_at_text ( & mut self , uuid : Uuid , text : & str ) {
113117 assert_ne ! ( uuid, Uuid :: default ( ) ) ;
114118 if let Some ( ( start_handle, start_node) ) = self . find_from_root ( & mut |n| n. id == uuid) {
115- info ! ( "{} - bounds {:?}" , uuid, start_node. screen_bounds( ) ) ;
119+ if self . visual_debug {
120+ info ! ( "{} - bounds {:?}" , uuid, start_node. screen_bounds( ) ) ;
121+ }
116122 assert ! ( is_enabled( start_handle, self ) ) ;
117123 assert ! ( start_node. is_globally_visible( ) ) ;
118124 if let Some ( ( text_handle, text_node) ) = self . find ( start_handle, & mut |n| {
@@ -126,13 +132,15 @@ impl UserInterfaceTestingExtension for UserInterface {
126132 assert ! ( text_node. is_globally_visible( ) ) ;
127133 let center = text_node. screen_bounds ( ) . center ( ) ;
128134 self . click ( center) ;
129- info ! (
135+ if self . visual_debug {
136+ info ! (
130137 "==== Clicked at {text}({}:{}) at [{};{}] coords. Found from {uuid} starting location. ====" ,
131138 text_handle. index( ) ,
132139 text_handle. generation( ) ,
133140 center. x,
134141 center. y
135142 ) ;
143+ }
136144 }
137145 } else {
138146 panic ! ( "There's no widget {uuid}!" )
@@ -159,9 +167,11 @@ impl UserInterfaceTestingExtension for UserInterface {
159167
160168 fn poll_all_messages ( & mut self ) {
161169 while let Some ( msg) = self . poll_message ( ) {
162- if let Ok ( widget) = self . try_get ( msg. destination ( ) ) {
163- let ty = Reflect :: type_name ( widget) ;
164- info ! ( "[{ty}]{msg:?}" ) ;
170+ if self . visual_debug {
171+ if let Ok ( widget) = self . try_get ( msg. destination ( ) ) {
172+ let ty = Reflect :: type_name ( widget) ;
173+ info ! ( "[{ty}]{msg:?}" ) ;
174+ }
165175 }
166176 }
167177 let screen_size = self . screen_size ( ) ;
@@ -171,9 +181,11 @@ impl UserInterfaceTestingExtension for UserInterface {
171181 fn poll_and_count ( & mut self , mut pred : impl FnMut ( & UiMessage ) -> bool ) -> usize {
172182 let mut num = 0 ;
173183 while let Some ( msg) = self . poll_message ( ) {
174- if let Ok ( widget) = self . try_get ( msg. destination ( ) ) {
175- let ty = Reflect :: type_name ( widget) ;
176- info ! ( "[{ty}]{msg:?}" ) ;
184+ if self . visual_debug {
185+ if let Ok ( widget) = self . try_get ( msg. destination ( ) ) {
186+ let ty = Reflect :: type_name ( widget) ;
187+ info ! ( "[{ty}]{msg:?}" ) ;
188+ }
177189 }
178190
179191 if pred ( & msg) {
0 commit comments