Skip to content

Commit

Permalink
Automated graph checks (#8982)
Browse files Browse the repository at this point in the history
Most of it was already automated, just added the missing multi-graphs
test so we can finally get rid of the manual check.
  • Loading branch information
teh-cmc authored Feb 10, 2025
1 parent 9f5f6b7 commit 3eb6d00
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 73 deletions.
45 changes: 45 additions & 0 deletions crates/viewer/re_view_graph/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,51 @@ pub fn self_and_multi_edges() {
run_graph_view_and_save_snapshot(&mut test_context, name, Vec2::new(400.0, 400.0));
}

#[test]
pub fn multi_graphs() {
let mut test_context = TestContext::default();
let name = "multi_graphs";

// It's important to first register the view class before adding any entities,
// otherwise the `VisualizerEntitySubscriber` for our visualizers doesn't exist yet,
// and thus will not find anything applicable to the visualizer.
test_context
.view_class_registry
.add_class::<GraphView>()
.unwrap();

let timepoint = TimePoint::from([(test_context.active_timeline(), 1)]);
test_context.log_entity("graph1".into(), |builder| {
builder
.with_archetype(
RowId::new(),
timepoint.clone(),
&archetypes::GraphNodes::new(["A", "B"]).with_positions([[0.0, 0.0], [0.0, 0.0]]),
)
.with_archetype(
RowId::new(),
timepoint.clone(),
&archetypes::GraphEdges::new([("A", "B")]),
)
});
test_context.log_entity("graph2".into(), |builder| {
builder
.with_archetype(
RowId::new(),
timepoint.clone(),
&archetypes::GraphNodes::new(["A", "B"])
.with_positions([[80.0, 80.0], [80.0, 80.0]]),
)
.with_archetype(
RowId::new(),
timepoint,
&archetypes::GraphEdges::new([("A", "B")]).with_directed_edges(),
)
});

run_graph_view_and_save_snapshot(&mut test_context, name, Vec2::new(400.0, 400.0));
}

fn run_graph_view_and_save_snapshot(test_context: &mut TestContext, name: &str, size: Vec2) {
let view_id = test_context.setup_viewport_blueprint(|_, blueprint| {
let view_blueprint = ViewBlueprint::new(
Expand Down
3 changes: 3 additions & 0 deletions crates/viewer/re_view_graph/tests/snapshots/multi_graphs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 0 additions & 73 deletions tests/python/release_checklist/check_graph_view.py

This file was deleted.

0 comments on commit 3eb6d00

Please sign in to comment.