all tests passing now

This commit is contained in:
Chris Cochrun 2025-03-25 11:29:37 -05:00
parent 1ed04a1f64
commit d2e456eae4
2 changed files with 32 additions and 3 deletions

View file

@ -236,6 +236,26 @@ impl From<&Slide> for Value {
} }
impl Slide { impl Slide {
pub fn set_text(mut self, text: impl AsRef<str>) -> Self {
self.text = text.as_ref().into();
self
}
pub fn set_font(mut self, font: impl AsRef<str>) -> Self {
self.font = font.as_ref().into();
self
}
pub fn set_font_size(mut self, font_size: i32) -> Self {
self.font_size = font_size;
self
}
pub fn set_audio(mut self, audio: Option<PathBuf>) -> Self {
self.audio = audio;
self
}
pub fn background(&self) -> &Background { pub fn background(&self) -> &Background {
&self.background &self.background
} }

View file

@ -37,7 +37,10 @@ pub fn parse_lisp(value: Value) -> Vec<ServiceItem> {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use std::{fs::read_to_string, path::PathBuf}; use std::{
fs::read_to_string,
path::{Path, PathBuf},
};
use crate::{ use crate::{
core::{ core::{
@ -101,13 +104,19 @@ mod test {
fn service_item_1() -> ServiceItem { fn service_item_1() -> ServiceItem {
let image = Image { let image = Image {
title: "frodo.jpg".to_string(), title: "This is frodo".to_string(),
path: PathBuf::from("~/pics/frodo.jpg"), path: PathBuf::from("~/pics/frodo.jpg"),
..Default::default() ..Default::default()
}; };
let slide = &image.to_slides().unwrap()[0]; let slide = &image.to_slides().unwrap()[0];
let slide = slide
.clone()
.set_text("This is frodo")
.set_font("Quicksand")
.set_font_size(70)
.set_audio(None);
ServiceItem { ServiceItem {
title: "frodo.jpg".to_string(), title: "This is frodo".to_string(),
kind: ServiceItemKind::Content(slide.clone()), kind: ServiceItemKind::Content(slide.clone()),
..Default::default() ..Default::default()
} }