()
| 206 | |
| 207 | #[test] |
| 208 | fn test_plot_subplots() -> Result<(), StrError> { |
| 209 | // curve object and options |
| 210 | let mut curve = Curve::new(); |
| 211 | |
| 212 | // draw curve |
| 213 | let x = &[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]; |
| 214 | let y = &[1.0, 4.0, 9.0, 16.0, 25.0, 36.0, 49.0, 64.0]; |
| 215 | curve.draw(x, y); |
| 216 | |
| 217 | // params for super title |
| 218 | let mut params = SuperTitleParams::new(); |
| 219 | params.set_align_vertical("bottom"); |
| 220 | |
| 221 | // configure plot |
| 222 | let mut plot = Plot::new(); |
| 223 | plot.set_super_title("\"$\\int$ Plot's Owner Says $\\mathrm{d}\\sigma$\": This is the \"super title\", \\n followed by a very long text to see \\n if this whole thing will be wrapped or not \\n we hope that it gets wrapped and beautifully formatted.\"", Some(¶ms)) |
| 224 | .set_horizontal_gap(0.5) |
| 225 | .set_vertical_gap(0.5) |
| 226 | .set_gaps(0.3, 0.3); |
| 227 | |
| 228 | // add curve to subplots |
| 229 | plot.set_subplot(2, 2, 1).set_title("\"Owner's First\"").add(&curve); |
| 230 | plot.set_subplot(2, 2, 2).set_title("\"Owner's Second\"").add(&curve); |
| 231 | plot.set_subplot(2, 2, 3).set_title("\"Owner's Third\"").add(&curve); |
| 232 | plot.set_subplot(2, 2, 4).set_title("\"Owner's Fourth\"").add(&curve); |
| 233 | |
| 234 | // save figure |
| 235 | let path = Path::new(OUT_DIR).join("integ_plot_subplots.svg"); |
| 236 | plot.save(&path)?; |
| 237 | |
| 238 | // check number of lines |
| 239 | let file = File::open(path).map_err(|_| "cannot open file")?; |
| 240 | let buffered = BufReader::new(file); |
| 241 | let lines_iter = buffered.lines(); |
| 242 | assert!(lines_iter.count() > 1450); |
| 243 | Ok(()) |
| 244 | } |
| 245 | |
| 246 | #[test] |
| 247 | fn test_plot_log() -> Result<(), StrError> { |
nothing calls this directly
no test coverage detected