MCPcopy Create free account
hub / github.com/cpmech/plotpy / test_text_3d

Function test_text_3d

tests/test_text.rs:81–110  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

79
80#[test]
81fn test_text_3d() -> Result<(), StrError> {
82 // text object and options
83 let mut text = Text::new();
84 text.set_color("blue")
85 .set_align_horizontal("center")
86 .set_align_vertical("center")
87 .set_fontsize(32.0)
88 .set_bbox(true)
89 .set_bbox_facecolor("pink")
90 .set_bbox_edgecolor("black")
91 .set_bbox_alpha(0.3);
92
93 // draw text
94 text.draw_3d(0.5, 0.5, 0.5, "message: $\\frac{\\alpha}{\\beta} = \\gamma$");
95
96 // add text to plot
97 let mut plot = Plot::new();
98 plot.add(&text);
99
100 // save figure
101 let path = Path::new(OUT_DIR).join("integ_text_3d.svg");
102 plot.save(&path)?;
103
104 // check number of lines
105 let file = File::open(path).map_err(|_| "cannot open file")?;
106 let buffered = BufReader::new(file);
107 let lines_iter = buffered.lines();
108 assert!(lines_iter.count() > 800);
109 Ok(())
110}

Callers

nothing calls this directly

Calls 11

set_bbox_alphaMethod · 0.80
set_bbox_edgecolorMethod · 0.80
set_bbox_facecolorMethod · 0.80
set_bboxMethod · 0.80
saveMethod · 0.80
set_fontsizeMethod · 0.45
set_align_verticalMethod · 0.45
set_align_horizontalMethod · 0.45
set_colorMethod · 0.45
draw_3dMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected