#[derive(Debug, Clone)]
#[deprecated(since = "1.0.0", note = "使用 PageInfo 替代")]
#[allow(deprecated)]
pub struct OfdPageVo {
pub content_page_path: String,
pub template_page_path: Option<String>,
}
#[allow(deprecated)]
impl OfdPageVo {
#[must_use]
pub fn new(content_page_path: impl Into<String>, template_page_path: Option<String>) -> Self {
Self {
content_page_path: content_page_path.into(),
template_page_path,
}
}
#[must_use]
pub fn has_template(&self) -> bool {
self.template_page_path.is_some()
}
}
#[allow(deprecated)]
#[cfg(test)]
mod tests {
#[allow(deprecated)]
use super::*;
#[test]
#[allow(deprecated)]
fn test_ofd_page_vo_new() {
let vo = OfdPageVo::new("Pages/Page_0/Content.xml", None);
assert_eq!(vo.content_page_path, "Pages/Page_0/Content.xml");
assert!(!vo.has_template());
}
#[test]
#[allow(deprecated)]
fn test_ofd_page_vo_with_template() {
let vo = OfdPageVo::new(
"Pages/Page_0/Content.xml",
Some("Pages/Page_0/Template.xml".into()),
);
assert!(vo.has_template());
}
}