Skip to content

Commit

Permalink
Add tests for rendering pie as scene graph
Browse files Browse the repository at this point in the history
  • Loading branch information
aleics committed Aug 30, 2024
1 parent 8ef8681 commit c8bcfda
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions bruc-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,22 @@ mod tests {
)
}

#[tokio::test]
async fn renders_pie() {
// given
let mut view = View::build(pie_chart_spec());

// when
let mut result = view.render(DebugRenderer).await;
let content = result.next().await;

// then
assert_eq!(
content.unwrap(),
"Scenegraph { root: SceneRoot { items: [Group(SceneGroup { items: [Arc(SceneArc { start_angle: 0.0, end_angle: 158.4, radius: 750.0, fill: \"#1F77B4\" }), Arc(SceneArc { start_angle: 158.4, end_angle: 230.4, radius: 750.0, fill: \"#FF7F0E\" }), Arc(SceneArc { start_angle: 230.4, end_angle: 331.2, radius: 750.0, fill: \"#2CA02C\" }), Arc(SceneArc { start_angle: 331.2, end_angle: 360.0, radius: 750.0, fill: \"#D62728\" })] })], dimensions: SceneDimensions { width: 1500, height: 300 } } }"
)
}

#[tokio::test]
async fn renders_after_set_data() {
// given
Expand Down

0 comments on commit c8bcfda

Please sign in to comment.