Skip to content

Commit

Permalink
CI testing: don't crash if screenshot manager resource is not availab…
Browse files Browse the repository at this point in the history
…le (#12385)

# Objective

- After #12370, ci testing with minimal plugins doesn't hang but it
crash as the resource `ScreenshotManager` doesn't exist

## Solution

- Check if the resource exists
  • Loading branch information
mockersf committed Mar 8, 2024
1 parent 7546624 commit 8e467f4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions crates/bevy_dev_tools/src/ci_testing.rs
Expand Up @@ -3,8 +3,9 @@
use bevy_app::{App, AppExit, Update};
use bevy_ecs::{
entity::Entity,
prelude::Resource,
prelude::{resource_exists, Resource},
query::With,
schedule::IntoSystemConfigs,
system::{Local, Query, Res, ResMut},
};
use bevy_render::view::screenshot::ScreenshotManager;
Expand Down Expand Up @@ -67,8 +68,13 @@ pub(crate) fn setup_app(app: &mut App) -> &mut App {
)));
}

app.insert_resource(config)
.add_systems(Update, (ci_testing_exit_after, ci_testing_screenshot_at));
app.insert_resource(config).add_systems(
Update,
(
ci_testing_exit_after,
ci_testing_screenshot_at.run_if(resource_exists::<ScreenshotManager>),
),
);

app
}
Expand Down

0 comments on commit 8e467f4

Please sign in to comment.