Skip to content

Commit

Permalink
make reflection always be available on test context
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf committed Dec 20, 2024
1 parent 17afa13 commit 3f00945
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,12 @@ fn check_and_print_results(test_cases: &[TestCase], results: &[Result<(), Snapsh
);
}

/// Create a [`TestContext`] with a fully populated component ui registry and reflection.
/// Create a [`TestContext`] with a fully populated component ui registry.
// TODO(ab): It would be nice to generalise this utility. However, TestContext current lives in
// re_viewer_context, which cannot depend on re_component_ui.
fn get_test_context() -> TestContext {
let mut test_context = TestContext::default();
test_context.component_ui_registry = create_component_ui_registry();
test_context.reflection = re_types::reflection::generate_reflection().unwrap();
test_context
}

Expand Down
5 changes: 4 additions & 1 deletion crates/viewer/re_viewer_context/src/test_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ impl Default for TestContext {
|_ctx, _ui, _ui_layout, _query, _db, _entity_path, _row_id, _component| {},
));

let reflection =
re_types::reflection::generate_reflection().expect("Failed to generate reflection");

Self {
recording_store,
blueprint_store,
Expand All @@ -61,7 +64,7 @@ impl Default for TestContext {
recording_config,
blueprint_query,
component_ui_registry,
reflection: Default::default(),
reflection,
command_sender,
command_receiver,
}
Expand Down

0 comments on commit 3f00945

Please sign in to comment.