@@ -55,6 +55,12 @@ enum Action {
55
55
/// This defaults to frame 250. Set it to 0 to not stop the example automatically.
56
56
stop_frame : u32 ,
57
57
58
+ #[ arg( long, default_value = "false" ) ]
59
+ /// Automatically ends after taking a screenshot
60
+ ///
61
+ /// Only works if `screenshot-frame` is set to non-0, and overrides `stop-frame`.
62
+ auto_stop_frame : bool ,
63
+
58
64
#[ arg( long) ]
59
65
/// Which frame to take a screenshot at. Set to 0 for no screenshot.
60
66
screenshot_frame : u32 ,
@@ -150,6 +156,7 @@ fn main() {
150
156
Action :: Run {
151
157
wgpu_backend,
152
158
stop_frame,
159
+ auto_stop_frame,
153
160
screenshot_frame,
154
161
fixed_frame_time,
155
162
in_ci,
@@ -183,11 +190,21 @@ fn main() {
183
190
184
191
let mut extra_parameters = vec ! [ ] ;
185
192
186
- match ( stop_frame, screenshot_frame) {
193
+ match ( stop_frame, screenshot_frame, auto_stop_frame ) {
187
194
// When the example does not automatically stop nor take a screenshot.
188
- ( 0 , 0 ) => ( ) ,
195
+ ( 0 , 0 , _) => ( ) ,
196
+ // When the example automatically stops at an automatic frame.
197
+ ( 0 , _, true ) => {
198
+ let mut file = File :: create ( "example_showcase_config.ron" ) . unwrap ( ) ;
199
+ file. write_all (
200
+ format ! ( "(setup: (fixed_frame_time: Some({fixed_frame_time})), events: [({screenshot_frame}, ScreenshotAndExit)])" ) . as_bytes ( ) ,
201
+ )
202
+ . unwrap ( ) ;
203
+ extra_parameters. push ( "--features" ) ;
204
+ extra_parameters. push ( "bevy_ci_testing" ) ;
205
+ }
189
206
// When the example does not automatically stop.
190
- ( 0 , _) => {
207
+ ( 0 , _, false ) => {
191
208
let mut file = File :: create ( "example_showcase_config.ron" ) . unwrap ( ) ;
192
209
file. write_all (
193
210
format ! ( "(setup: (fixed_frame_time: Some({fixed_frame_time})), events: [({screenshot_frame}, Screenshot)])" ) . as_bytes ( ) ,
@@ -197,15 +214,25 @@ fn main() {
197
214
extra_parameters. push ( "bevy_ci_testing" ) ;
198
215
}
199
216
// When the example does not take a screenshot.
200
- ( _, 0 ) => {
217
+ ( _, 0 , _ ) => {
201
218
let mut file = File :: create ( "example_showcase_config.ron" ) . unwrap ( ) ;
202
219
file. write_all ( format ! ( "(events: [({stop_frame}, AppExit)])" ) . as_bytes ( ) )
203
220
. unwrap ( ) ;
204
221
extra_parameters. push ( "--features" ) ;
205
222
extra_parameters. push ( "bevy_ci_testing" ) ;
206
223
}
224
+ // When the example both automatically stops at an automatic frame and takes a screenshot.
225
+ ( _, _, true ) => {
226
+ let mut file = File :: create ( "example_showcase_config.ron" ) . unwrap ( ) ;
227
+ file. write_all (
228
+ format ! ( "(setup: (fixed_frame_time: Some({fixed_frame_time})), events: [({screenshot_frame}, ScreenshotAndExit)])" ) . as_bytes ( ) ,
229
+ )
230
+ . unwrap ( ) ;
231
+ extra_parameters. push ( "--features" ) ;
232
+ extra_parameters. push ( "bevy_ci_testing" ) ;
233
+ }
207
234
// When the example both automatically stops and takes a screenshot.
208
- ( _, _) => {
235
+ ( _, _, false ) => {
209
236
let mut file = File :: create ( "example_showcase_config.ron" ) . unwrap ( ) ;
210
237
file. write_all (
211
238
format ! ( "(setup: (fixed_frame_time: Some({fixed_frame_time})), events: [({screenshot_frame}, Screenshot), ({stop_frame}, AppExit)])" ) . as_bytes ( ) ,
0 commit comments