Skip to content

Commit 4bc70f1

Browse files
committed
Add some test case
1 parent 51c451a commit 4bc70f1

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/chart/context.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,4 +920,35 @@ mod test {
920920
.draw()
921921
.expect("Drawing error");
922922
}
923+
924+
925+
#[test]
926+
fn test_chart_context_3d() {
927+
let drawing_area = create_mocked_drawing_area(200, 200, |_| {});
928+
929+
drawing_area.fill(&WHITE).expect("Fill");
930+
931+
let mut chart = ChartBuilder::on(&drawing_area)
932+
.caption("Test Title", ("serif", 10))
933+
.x_label_area_size(20)
934+
.y_label_area_size(20)
935+
.set_label_area_size(LabelAreaPosition::Top, 20)
936+
.set_label_area_size(LabelAreaPosition::Right, 20)
937+
.build_cartesian_3d(0..10, 0..10, 0..10)
938+
.expect("Create chart");
939+
940+
chart.with_projection(|mut pb| {
941+
pb.yaw = 0.5;
942+
pb.pitch = 0.5;
943+
pb.scale = 0.5;
944+
pb.into_matrix()
945+
});
946+
947+
chart.configure_axes().draw().expect("Drawing axes");
948+
949+
950+
chart
951+
.draw_series(std::iter::once(Circle::new((5, 5, 5), 5, &RED)))
952+
.expect("Drawing error");
953+
}
923954
}

0 commit comments

Comments
 (0)