easyofd_reader/model/
ofd_page_vo.rs1#[derive(Debug, Clone)]
14#[deprecated(since = "1.0.0", note = "使用 PageInfo 替代")]
15#[allow(deprecated)]
16pub struct OfdPageVo {
17 pub content_page_path: String,
19 pub template_page_path: Option<String>,
21}
22
23#[allow(deprecated)]
24impl OfdPageVo {
25 #[must_use]
27 pub fn new(content_page_path: impl Into<String>, template_page_path: Option<String>) -> Self {
28 Self {
29 content_page_path: content_page_path.into(),
30 template_page_path,
31 }
32 }
33
34 #[must_use]
36 pub fn has_template(&self) -> bool {
37 self.template_page_path.is_some()
38 }
39}
40
41#[allow(deprecated)]
42#[cfg(test)]
43mod tests {
44 #[allow(deprecated)]
45 use super::*;
46
47 #[test]
48 #[allow(deprecated)]
49 fn test_ofd_page_vo_new() {
50 let vo = OfdPageVo::new("Pages/Page_0/Content.xml", None);
51 assert_eq!(vo.content_page_path, "Pages/Page_0/Content.xml");
52 assert!(!vo.has_template());
53 }
54
55 #[test]
56 #[allow(deprecated)]
57 fn test_ofd_page_vo_with_template() {
58 let vo = OfdPageVo::new(
59 "Pages/Page_0/Content.xml",
60 Some("Pages/Page_0/Template.xml".into()),
61 );
62 assert!(vo.has_template());
63 }
64}