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

Function test_text_negative_rotation

tests/test_text.rs:52–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50
51#[test]
52fn test_text_negative_rotation() -> Result<(), StrError> {
53 // text object and options
54 let mut text = Text::new();
55
56 // draw text
57 text.set_align_horizontal("center")
58 .set_align_vertical("center")
59 .set_fontsize(20.0)
60 .set_rotation(-30.0)
61 .draw(0.5, 0.5, "NEGATIVE ROTATION");
62
63 // add text to plot
64 let mut plot = Plot::new();
65 plot.add(&text).set_range(0.0, 1.0, 0.0, 1.0);
66
67 // save figure
68 let path = Path::new(OUT_DIR).join("integ_text_negative_rotation.svg");
69 plot.set_show_errors(true).save(&path)?;
70
71 // check number of lines
72 let file = File::open(path).map_err(|_| "cannot open file")?;
73 let buffered = BufReader::new(file);
74 let lines_iter = buffered.lines();
75 let n = lines_iter.count();
76 assert!(n > 570 && n < 620);
77 Ok(())
78}
79
80#[test]
81fn test_text_3d() -> Result<(), StrError> {

Callers

nothing calls this directly

Calls 9

set_rotationMethod · 0.80
saveMethod · 0.80
set_show_errorsMethod · 0.80
drawMethod · 0.45
set_fontsizeMethod · 0.45
set_align_verticalMethod · 0.45
set_align_horizontalMethod · 0.45
set_rangeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected