1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
pub mod error;
pub mod image;
pub mod pdf;
pub use error::*;
pub use image::*;
pub use pdf::*;
#[cfg(test)]
mod tests {
use super::*;
use ImageFormat::Png;
#[test]
fn one_test_to_rule_them_all() {
let _ = env_logger::init();
let pdf_app = PdfApplication::new().expect("Failed to init PDF Application");
{
let res = pdf_app.builder().build_from_html("basic <b>from</b> html");
assert!(res.is_ok(), "{}", res.unwrap_err());
}
{
let res = pdf_app
.builder()
.build_from_url("https://www.rust-lang.org/en-US/".parse().unwrap());
assert!(res.is_ok(), "{}", res.unwrap_err());
}
let image_app = ImageApplication::new().expect("Failed to init image Application");
{
let res = image_app
.builder()
.format(Png)
.build_from_path("examples/input.html");
assert!(res.is_ok(), "{}", res.unwrap_err());
}
{
let res = image_app
.builder()
.format(Png)
.build_from_url(&"https://www.rust-lang.org/en-US/".parse().unwrap());
assert!(res.is_ok(), "{}", res.unwrap_err());
}
}
}