Skip to main content

re_selection_panel/
lib.rs

1//! The UI for the selection panel.
2
3#![warn(clippy::iter_over_hash_type)] //  TODO(#6198): enable everywhere
4
5mod defaults_ui;
6mod item_heading_no_breadcrumbs;
7mod item_heading_with_breadcrumbs;
8mod item_title;
9mod selection_panel;
10mod view_entity_picker;
11mod view_space_origin_ui;
12mod visible_time_range_ui;
13mod visualizer_ui;
14
15pub use selection_panel::SelectionPanel;
16
17#[cfg(test)]
18mod test {
19    use re_chunk_store::LatestAtQuery;
20    use re_viewer_context::{Item, ViewId, blueprint_timeline};
21    use re_viewport_blueprint::ViewportBlueprint;
22
23    use super::*;
24
25    /// This test mainly serve to demonstrate that non-trivial UI code can be executed with a "fake"
26    /// [`ViewerContext`].
27    // TODO(#6450): check that no warning/error is logged
28    #[test]
29    fn test_selection_panel() {
30        re_log::setup_logging();
31
32        let test_ctx = re_test_context::TestContext::new();
33        test_ctx.edit_selection(|selection_state| {
34            selection_state.set_selection(Item::View(ViewId::random()));
35        });
36
37        test_ctx.run_in_egui_central_panel(|ctx, ui| {
38            let blueprint = ViewportBlueprint::from_db(
39                ctx.store_context.blueprint,
40                &LatestAtQuery::latest(blueprint_timeline()),
41            );
42
43            let mut selection_panel = SelectionPanel::default();
44            selection_panel.show_panel(ctx, &blueprint, &mut Default::default(), ui, true);
45        });
46    }
47}