all tests passing now
This commit is contained in:
parent
1ed04a1f64
commit
d2e456eae4
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
15
src/lisp.rs
15
src/lisp.rs
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue