| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | use std::path::PathBuf; |
| 15 | use std::sync::Once; |
| 16 | use std::time::{Duration, Instant}; |
| 17 | |
| 18 | use engine::export::{ExportSettings, Format}; |
| 19 | use engine::project::{Edge, Lane, LaneKind}; |
| 20 | use engine::scratch::Scratch; |
| 21 | use engine::{DecodeSession, ExportHandle, PlaybackSession}; |
| 22 | |
| 23 | |
| 24 | const FPS: f64 = 30.0; |
| 25 | |
| 26 | const CAP: u32 = 18_000; |
| 27 | |
| 28 | const PLACED: u32 = 150; |
| 29 | |
| 30 | fn asset(name: &str) -> PathBuf { |
| 31 | PathBuf::from(env!("CARGO_MANIFEST_DIR")) |
| 32 | .join("../../assets") |
| 33 | .join(name) |
| 34 | } |
| 35 | |
| 36 | |
| 37 | fn pin_software() { |
| 38 | static PIN: Once = Once::new(); |
| 39 | PIN.call_once(|| { |
| 40 | engine::envcfg::set("VE_SW", "1"); |
| 41 | engine::envcfg::set("VE_SW_ENC", "1"); |
| 42 | }); |
| 43 | } |
| 44 | |
| 45 | |
| 46 | |
| 47 | fn source_rgb(x: u32, y: u32) -> [u8; 3] { |
| 48 | let img = ec_image::open(asset("test_still.png")) |
| 49 | .expect("the still fixture (scripts/gen_fixtures.sh)"); |
| 50 | let (width, _) = img.dimensions(); |
| 51 | let rgb = img.to_rgb8(); |
| 52 | let at = ((y * width + x) * 3) as usize; |
| 53 | [rgb[at], rgb[at + 1], rgb[at + 2]] |
| 54 | } |
| 55 | |
| 56 | |
| 57 | fn frame_rgb(bgra: &[u8], width: u32, x: u32, y: u32) -> [u8; 3] { |
| 58 | let at = ((y * width + x) * 4) as usize; |
| 59 | [bgra[at + 2], bgra[at + 1], bgra[at]] |
| 60 | } |
| 61 | |
| 62 | |
| 63 | |
| 64 | fn close(got: [u8; 3], want: [u8; 3], what: &str) { |
| 65 | let off = got |
| 66 | .iter() |
| 67 | .zip(&want) |
| 68 | .map(|(a, b)| a.abs_diff(*b)) |
| 69 | .max() |
| 70 | .unwrap_or(0); |
| 71 | assert!(off <= 6, "{what}: showed {got:?}, the file has {want:?}"); |
| 72 | } |
| 73 | |
| 74 | |
| 75 | |
| 76 | fn frame_at(session: &mut PlaybackSession, secs: f64) -> engine::Frame { |
| 77 | session.seek(secs); |
| 78 | let target = (secs * FPS) as u32; |
| 79 | let started = Instant::now(); |
| 80 | loop { |
| 81 | if let Some(frame) = session.try_frame() |
| 82 | && frame.index >= target |
| 83 | { |
| 84 | return frame; |
| 85 | } |
| 86 | assert!( |
| 87 | started.elapsed() < Duration::from_secs(20), |
| 88 | "no frame at {secs} s (timeline frame {target})" |
| 89 | ); |
| 90 | std::thread::sleep(Duration::from_millis(5)); |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | fn wait(handle: &ExportHandle, limit: Duration) -> engine::Result<()> { |
| 95 | let started = Instant::now(); |
| 96 | while !handle.is_finished() { |
| 97 | assert!( |
| 98 | started.elapsed() < limit, |
| 99 | "export did not finish in {limit:?}" |
| 100 | ); |
| 101 | std::thread::sleep(Duration::from_millis(20)); |
| 102 | } |
| 103 | handle.result().expect("a finished export has an outcome") |
| 104 | } |
| 105 | |
| 106 | |
| 107 | |
| 108 | #[test] |
| 109 | fn importing_a_still_fills_the_library_and_places_nothing() { |
| 110 | pin_software(); |
| 111 | let mut session = PlaybackSession::open(asset("test_av.mp4")).expect("open the fixture"); |
| 112 | session.set_gain(0.0); |
| 113 | let before = session.clip_spans(); |
| 114 | |
| 115 | let source = session.import(&asset("test_still.png")).expect("a picture"); |
| 116 | assert_eq!(source, 1, "a second source"); |
| 117 | assert_eq!(session.clip_spans(), before, "nothing was placed"); |
| 118 | |
| 119 | |
| 120 | assert_eq!(session.file_frames(&asset("test_still.png")), CAP); |
| 121 | |
| 122 | |
| 123 | let broken = Scratch::file("ve_not_a_png", "png"); |
| 124 | std::fs::write(&broken, b"this is not a PNG").expect("write the decoy"); |
| 125 | let refused = session.import(&broken).expect_err("not a picture"); |
| 126 | assert!( |
| 127 | refused.to_string().contains("not_a_png"), |
| 128 | "the refusal names the file: {refused}" |
| 129 | ); |
| 130 | assert_eq!(session.sources().len(), 2, "a refusal registers nothing"); |
| 131 | } |
| 132 | |
| 133 | |
| 134 | |
| 135 | #[test] |
| 136 | fn a_placed_still_shows_its_own_pixels_on_the_canvas() { |
| 137 | pin_software(); |
| 138 | let still = asset("test_still.png"); |
| 139 | let mut session = PlaybackSession::open(asset("test_av.mp4")).expect("open the fixture"); |
| 140 | session.set_gain(0.0); |
| 141 | session.import(&still).expect("a picture"); |
| 142 | let end = session.timeline_duration(); |
| 143 | assert!( |
| 144 | session |
| 145 | .place_stream_at(end, &still, 0, Some(Lane::V1)) |
| 146 | .expect("a still joins any timeline") |
| 147 | ); |
| 148 | |
| 149 | |
| 150 | |
| 151 | let placed = session.lane_clips(Lane::V1).last().expect("the still clip").clone(); |
| 152 | assert_eq!(placed.len(), PLACED, "five seconds at 30 fps"); |
| 153 | assert_eq!( |
| 154 | session.lane_clips(Lane::A1).len(), |
| 155 | 1, |
| 156 | "no audio clip for it" |
| 157 | ); |
| 158 | |
| 159 | |
| 160 | |
| 161 | let frame = frame_at(&mut session, end + 0.5); |
| 162 | assert_eq!((frame.width, frame.height), session.resolution()); |
| 163 | let (w, h) = (frame.width, frame.height); |
| 164 | close( |
| 165 | frame_rgb(&frame.bgra, w, w / 2, h / 4), |
| 166 | source_rgb(320, 90), |
| 167 | "the top band", |
| 168 | ); |
| 169 | close( |
| 170 | frame_rgb(&frame.bgra, w, w / 2, h * 3 / 4), |
| 171 | source_rgb(320, 270), |
| 172 | "the bottom band", |
| 173 | ); |
| 174 | |
| 175 | |
| 176 | |
| 177 | let video = frame_at(&mut session, end - 1.0 / FPS); |
| 178 | assert_ne!( |
| 179 | frame_rgb(&video.bgra, w, w / 2, h / 4), |
| 180 | frame_rgb(&frame.bgra, w, w / 2, h / 4), |
| 181 | "the video frame before the cut is not the still" |
| 182 | ); |
| 183 | } |
| 184 | |
| 185 | |
| 186 | |
| 187 | #[test] |
| 188 | fn a_still_trims_out_to_its_cap_and_no_further() { |
| 189 | pin_software(); |
| 190 | let still = asset("test_still.png"); |
| 191 | let mut session = PlaybackSession::open(&still).expect("open the still itself"); |
| 192 | |
| 193 | |
| 194 | assert_eq!(session.resolution(), (640, 360)); |
| 195 | assert_eq!(session.lane_clips(Lane::V1)[0].len(), PLACED); |
| 196 | assert!(session.lane_clips(Lane::A1).is_empty(), "silent"); |
| 197 | |
| 198 | let clip = session.lane_clips(Lane::V1)[0].clone(); |
| 199 | assert_eq!( |
| 200 | session.trim_room(Lane::V1, 0, Edge::End), |
| 201 | Some((clip.start + 1, clip.start + CAP)), |
| 202 | "the tail may go out to the cap" |
| 203 | ); |
| 204 | assert!(session.trim_clip(Lane::V1, 0, Edge::End, clip.start + CAP)); |
| 205 | assert_eq!(session.lane_clips(Lane::V1)[0].len(), CAP); |
| 206 | assert!( |
| 207 | !session.trim_clip(Lane::V1, 0, Edge::End, clip.start + CAP + 1), |
| 208 | "past the cap is refused" |
| 209 | ); |
| 210 | |
| 211 | assert!(session.trim_clip(Lane::V1, 0, Edge::End, clip.start + 60)); |
| 212 | assert_eq!(session.lane_clips(Lane::V1)[0].len(), 60); |
| 213 | |
| 214 | |
| 215 | |
| 216 | |
| 217 | assert!(session.trim_clip(Lane::V1, 0, Edge::Start, 20)); |
| 218 | let clip = session.lane_clips(Lane::V1)[0].clone(); |
| 219 | assert_eq!((clip.start, clip.len()), (20, 40)); |
| 220 | assert_eq!( |
| 221 | session.trim_room(Lane::V1, 0, Edge::Start), |
| 222 | Some((0, clip.end() - 1)), |
| 223 | "out to frame 0: the cap is further off than the timeline reaches" |
| 224 | ); |
| 225 | assert!(session.trim_clip(Lane::V1, 0, Edge::Start, 0), "dragged out"); |
| 226 | let clip = session.lane_clips(Lane::V1)[0].clone(); |
| 227 | assert_eq!( |
| 228 | (clip.start, clip.in_frame, clip.len()), |
| 229 | (0, 0, 60), |
| 230 | "longer by what the head took, and still read from the first frame" |
| 231 | ); |
| 232 | } |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | |
| 238 | |
| 239 | |
| 240 | |
| 241 | |
| 242 | |
| 243 | #[test] |
| 244 | fn pasting_a_copied_still_never_reaches_the_audio_lane() { |
| 245 | pin_software(); |
| 246 | let dir = Scratch::dir("ve_images_paste"); |
| 247 | let media = dir.join("test_av.mp4"); |
| 248 | let still = dir.join("test_still.png"); |
| 249 | std::fs::copy(asset("test_av.mp4"), &media).expect("copy the video"); |
| 250 | std::fs::copy(asset("test_still.png"), &still).expect("copy the still"); |
| 251 | |
| 252 | let mut session = PlaybackSession::open(&media).expect("open the fixture"); |
| 253 | session.set_gain(0.0); |
| 254 | session.import(&still).expect("a picture"); |
| 255 | let end = session.timeline_duration(); |
| 256 | assert!( |
| 257 | session |
| 258 | .place_stream_at(end, &still, 0, Some(Lane::V1)) |
| 259 | .expect("a still joins any timeline") |
| 260 | ); |
| 261 | let audio_clips = session.lane_clips(Lane::A1).len(); |
| 262 | |
| 263 | |
| 264 | |
| 265 | |
| 266 | let last = session.lane_clips(Lane::V1).len() - 1; |
| 267 | let copied = session.clip_at(last).expect("the clipboard sees the still"); |
| 268 | session.seek(0.0); |
| 269 | assert!(session.paste_at(0.0, copied), "the paste takes"); |
| 270 | |
| 271 | assert_eq!( |
| 272 | session.lane_clips(Lane::A1).len(), |
| 273 | audio_clips, |
| 274 | "a still is silent: the audio lane gains nothing from a paste" |
| 275 | ); |
| 276 | assert!( |
| 277 | session |
| 278 | .lane_clips(Lane::A1) |
| 279 | .iter() |
| 280 | .all(|c| !engine::is_image(&session.sources()[c.source].path)), |
| 281 | "no audio clip may play from a picture" |
| 282 | ); |
| 283 | |
| 284 | |
| 285 | |
| 286 | |
| 287 | let wav = dir.join("pasted.wav"); |
| 288 | let settings = ExportSettings { |
| 289 | format: Format::Wav, |
| 290 | ..ExportSettings::default() |
| 291 | }; |
| 292 | wait( |
| 293 | &session.export_to_with(&wav, &settings), |
| 294 | Duration::from_secs(120), |
| 295 | ) |
| 296 | .expect("the timeline's sound is still there"); |
| 297 | assert!( |
| 298 | std::fs::metadata(&wav).expect("the wav exists").len() > 1_000, |
| 299 | "a silent-by-failure export would be the header alone" |
| 300 | ); |
| 301 | |
| 302 | let project = dir.join("pasted.edith"); |
| 303 | session.save_project(&project).expect("save"); |
| 304 | PlaybackSession::open_project(&project).expect("the engine's own save reopens"); |
| 305 | let _ = std::fs::remove_dir_all(&dir); |
| 306 | } |
| 307 | |
| 308 | |
| 309 | |
| 310 | |
| 311 | |
| 312 | #[test] |
| 313 | fn a_still_survives_the_project_round_trip() { |
| 314 | pin_software(); |
| 315 | let dir = Scratch::dir("ve_images"); |
| 316 | let media = dir.join("test_av.mp4"); |
| 317 | let still = dir.join("test_still.png"); |
| 318 | std::fs::copy(asset("test_av.mp4"), &media).expect("copy the video"); |
| 319 | std::fs::copy(asset("test_still.png"), &still).expect("copy the still"); |
| 320 | |
| 321 | let mut session = PlaybackSession::open(&media).expect("open the fixture"); |
| 322 | session.set_gain(0.0); |
| 323 | session.import(&still).expect("a picture"); |
| 324 | let end = session.timeline_duration(); |
| 325 | assert!( |
| 326 | session |
| 327 | .place_stream_at(end, &still, 0, Some(Lane::V1)) |
| 328 | .expect("a still joins any timeline") |
| 329 | ); |
| 330 | |
| 331 | |
| 332 | let clip = session.lane_clips(Lane::V1).last().expect("the still clip").clone(); |
| 333 | let idx = session.lane_clips(Lane::V1).len() - 1; |
| 334 | assert!(session.trim_clip(Lane::V1, idx, Edge::End, clip.start + 900)); |
| 335 | let before: Vec<_> = session.lane_clips(Lane::V1).to_vec(); |
| 336 | |
| 337 | let project = dir.join("stills.edith"); |
| 338 | session.save_project(&project).expect("save"); |
| 339 | let reopened = PlaybackSession::open_project(&project).expect("reopen"); |
| 340 | assert_eq!(reopened.lane_clips(Lane::V1), &before[..]); |
| 341 | assert_eq!(reopened.file_frames(&still), CAP, "the cap came back"); |
| 342 | |
| 343 | |
| 344 | |
| 345 | let text = std::fs::read_to_string(&project).expect("read the project"); |
| 346 | let hacked = text.replace("V1", "A2"); |
| 347 | let bad = dir.join("hacked.edith"); |
| 348 | std::fs::write(&bad, &hacked).expect("write the hacked project"); |
| 349 | if hacked != text { |
| 350 | let Err(refused) = PlaybackSession::open_project(&bad) else { |
| 351 | panic!("a still cannot be heard: the audio lane took it"); |
| 352 | }; |
| 353 | assert!( |
| 354 | refused.to_string().contains("still image"), |
| 355 | "the refusal says what it is: {refused}" |
| 356 | ); |
| 357 | } |
| 358 | let _ = std::fs::remove_dir_all(&dir); |
| 359 | } |
| 360 | |
| 361 | |
| 362 | |
| 363 | |
| 364 | |
| 365 | |
| 366 | |
| 367 | |
| 368 | |
| 369 | #[test] |
| 370 | fn a_still_at_saved_source_zero_keeps_the_rate_and_the_sound() { |
| 371 | pin_software(); |
| 372 | let dir = Scratch::dir("ve_still_first"); |
| 373 | let media = dir.join("test_25fps.mp4"); |
| 374 | let still = dir.join("test_still.png"); |
| 375 | std::fs::copy(asset("test_25fps.mp4"), &media).expect("copy the video"); |
| 376 | std::fs::copy(asset("test_still.png"), &still).expect("copy the still"); |
| 377 | |
| 378 | |
| 379 | |
| 380 | |
| 381 | |
| 382 | |
| 383 | let mut session = PlaybackSession::open(&still).expect("a picture opens a timeline"); |
| 384 | session.set_gain(0.0); |
| 385 | assert!((session.meta().frame_rate - 30.0).abs() < 0.01); |
| 386 | session.import(&media).expect("the footage joins it"); |
| 387 | |
| 388 | |
| 389 | |
| 390 | |
| 391 | assert!( |
| 392 | session |
| 393 | .place_stream_at(0.0, &media, 0, Some(Lane::A1)) |
| 394 | .expect("the footage joins the timeline") |
| 395 | ); |
| 396 | assert!( |
| 397 | session |
| 398 | .place_stream_at(0.0, &still, 0, Some(Lane::V1)) |
| 399 | .expect("a still joins any timeline") |
| 400 | ); |
| 401 | assert_eq!(session.lane_clips(Lane::A1).len(), 1, "the footage's sound"); |
| 402 | assert!( |
| 403 | session.lane_clips(Lane::V1).iter().any(|c| c.source == 0), |
| 404 | "the still is on V1 under source 0" |
| 405 | ); |
| 406 | |
| 407 | let project = dir.join("still_first.edith"); |
| 408 | session.save_project(&project).expect("save"); |
| 409 | let text = std::fs::read_to_string(&project).expect("read the project"); |
| 410 | let source_0 = text |
| 411 | .lines() |
| 412 | .find(|l| l.starts_with("source ")) |
| 413 | .expect("a source line"); |
| 414 | assert!( |
| 415 | source_0.contains("test_still.png"), |
| 416 | "the premise: the save put the still at index 0 -- {source_0}" |
| 417 | ); |
| 418 | |
| 419 | let reopened = PlaybackSession::open_project(&project).expect("a saved project always reopens"); |
| 420 | |
| 421 | |
| 422 | assert!( |
| 423 | (reopened.meta().frame_rate - session.meta().frame_rate).abs() < 0.01, |
| 424 | "the saved rate, not the scaffold's: {}", |
| 425 | reopened.meta().frame_rate |
| 426 | ); |
| 427 | |
| 428 | |
| 429 | let (sound, was) = ( |
| 430 | reopened.lane_clips(Lane::A1)[0].clone(), |
| 431 | session.lane_clips(Lane::A1)[0].clone(), |
| 432 | ); |
| 433 | assert_eq!( |
| 434 | (sound.start, sound.in_frame, sound.out_frame), |
| 435 | (was.start, was.in_frame, was.out_frame) |
| 436 | ); |
| 437 | assert!( |
| 438 | reopened.sources()[sound.source] |
| 439 | .path |
| 440 | .ends_with("test_25fps.mp4"), |
| 441 | "the take's sound still names the video" |
| 442 | ); |
| 443 | assert!( |
| 444 | reopened.audio_disabled_reason().is_none(), |
| 445 | "a still is not a reason a timeline is silent: {:?}", |
| 446 | reopened.audio_disabled_reason() |
| 447 | ); |
| 448 | |
| 449 | |
| 450 | |
| 451 | let sources: Vec<_> = reopened |
| 452 | .sources() |
| 453 | .iter() |
| 454 | .map(|s| (s.path.clone(), s.audio_stream)) |
| 455 | .collect(); |
| 456 | let (meta, _rx) = engine::AudioSession::open_multi_streams(&sources, &[(Some(1), 0.0, 1.0)]) |
| 457 | .expect("the worker opens over a still at index 0") |
| 458 | .expect("the take on A1 has sound"); |
| 459 | assert_eq!(meta.sample_rate, 44_100, "the take's own rate"); |
| 460 | let _ = std::fs::remove_dir_all(&dir); |
| 461 | } |
| 462 | |
| 463 | |
| 464 | |
| 465 | #[test] |
| 466 | fn a_mixed_timeline_exports_the_still_at_the_cut() { |
| 467 | pin_software(); |
| 468 | let still = asset("test_still.png"); |
| 469 | |
| 470 | |
| 471 | let mut session = PlaybackSession::open(asset("test_mismatch.mp4")).expect("open the fixture"); |
| 472 | session.import(&still).expect("a picture"); |
| 473 | |
| 474 | assert!(session.trim_clip(Lane::V1, 0, Edge::End, 30)); |
| 475 | let end = session.timeline_duration(); |
| 476 | assert!( |
| 477 | session |
| 478 | .place_stream_at(end, &still, 0, Some(Lane::V1)) |
| 479 | .expect("a still joins any timeline") |
| 480 | ); |
| 481 | assert!(session.trim_clip(Lane::V1, 1, Edge::End, 60)); |
| 482 | assert_eq!(session.lane_clips(Lane::V1).len(), 2); |
| 483 | assert_eq!(session.resolution(), (640, 360)); |
| 484 | |
| 485 | let out = Scratch::file("ve_images_export", "mp4"); |
| 486 | wait(&session.export_to(&out), Duration::from_secs(300)).expect("export"); |
| 487 | |
| 488 | let (meta, frames) = DecodeSession::open(&out).expect("reopen the export"); |
| 489 | assert_eq!((meta.width, meta.height), (640, 360)); |
| 490 | let decoded: Vec<_> = frames.into_iter().collect(); |
| 491 | assert_eq!(decoded.len(), 60, "one second of video, one of still"); |
| 492 | |
| 493 | let frame = &decoded[50]; |
| 494 | close( |
| 495 | frame_rgb(&frame.bgra, 640, 320, 90), |
| 496 | source_rgb(320, 90), |
| 497 | "the exported top band", |
| 498 | ); |
| 499 | close( |
| 500 | frame_rgb(&frame.bgra, 640, 320, 270), |
| 501 | source_rgb(320, 270), |
| 502 | "the exported bottom band", |
| 503 | ); |
| 504 | |
| 505 | assert_ne!( |
| 506 | frame_rgb(&decoded[10].bgra, 640, 320, 90), |
| 507 | frame_rgb(&frame.bgra, 640, 320, 90), |
| 508 | "the video half is not the still" |
| 509 | ); |
| 510 | let _ = std::fs::remove_file(&out); |
| 511 | } |
| 512 | |
| 513 | |
| 514 | |
| 515 | |
| 516 | #[test] |
| 517 | fn a_still_asked_for_on_an_audio_lane_lands_on_the_video_one() { |
| 518 | pin_software(); |
| 519 | let still = asset("test_still.png"); |
| 520 | let mut session = PlaybackSession::open(asset("test_av.mp4")).expect("open the fixture"); |
| 521 | session.set_gain(0.0); |
| 522 | session.import(&still).expect("a picture"); |
| 523 | let a2 = session.add_lane(LaneKind::Audio); |
| 524 | let end = session.timeline_duration(); |
| 525 | assert!( |
| 526 | session |
| 527 | .place_stream_at(end, &still, 0, Some(a2)) |
| 528 | .expect("a still joins any timeline") |
| 529 | ); |
| 530 | assert!(session.lane_clips(a2).is_empty(), "not on the audio lane"); |
| 531 | assert_eq!( |
| 532 | session.lane_clips(Lane::V1).len(), |
| 533 | 2, |
| 534 | "on the video lane instead" |
| 535 | ); |
| 536 | } |
| 537 | |
| 538 | |
| 539 | |
| 540 | |
| 541 | #[test] |
| 542 | fn the_still_length_is_the_projects_and_sets_the_next_placement() { |
| 543 | pin_software(); |
| 544 | let still = asset("test_still.png"); |
| 545 | let mut session = PlaybackSession::open(asset("test_av.mp4")).expect("open the fixture"); |
| 546 | session.set_gain(0.0); |
| 547 | session.import(&still).expect("a picture"); |
| 548 | assert_eq!(session.still_secs(), 5.0, "the default"); |
| 549 | let end = session.timeline_duration(); |
| 550 | assert!(session.place_stream_at(end, &still, 0, Some(Lane::V1)).expect("a still joins")); |
| 551 | assert_eq!(session.lane_clips(Lane::V1).last().expect("the still").len(), PLACED); |
| 552 | |
| 553 | assert!(session.set_still_secs(2.0)); |
| 554 | assert!(!session.set_still_secs(2.0), "the same length changes nothing"); |
| 555 | let end = session.timeline_duration(); |
| 556 | assert!(session.place_stream_at(end, &still, 0, Some(Lane::V1)).expect("a still joins")); |
| 557 | let clips = session.lane_clips(Lane::V1); |
| 558 | assert_eq!(clips.last().expect("the new still").len(), 60, "two seconds at 30 fps"); |
| 559 | assert_eq!(clips[clips.len() - 2].len(), PLACED, "the still already placed keeps five seconds"); |
| 560 | |
| 561 | |
| 562 | assert!(session.set_still_secs(0.01)); |
| 563 | assert_eq!(session.still_secs(), 0.5); |
| 564 | session.set_still_secs(f64::NAN); |
| 565 | assert_eq!(session.still_secs(), 5.0, "not a number is the default"); |
| 566 | } |