Keep the playhead on the frame shown in the current-time field.
Timecode and Frames entries were parsed as absolute counts without the composition Start Timecode or Start Numbering Frames At offset, so committing the displayed text jumped to another frame.
This commit is contained in:
@@ -375,6 +375,29 @@ fn time_set_snaps_to_the_nearest_frame_and_ae_timecode() {
|
||||
assert_eq!(effectcraft_time::format_timecode_ae(75, fr, true), "0;00;02;15");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn time_set_keeps_the_frame_shown_in_the_current_time_field() {
|
||||
let mut s = Session::default();
|
||||
s.execute(
|
||||
"comp.new",
|
||||
json!({"name": "Example", "width": 64, "height": 64, "frameRate": 30, "duration": 0.6, "startTimecode": "0:00:00:05"}),
|
||||
)
|
||||
.unwrap();
|
||||
let r = s.execute("time.set", json!({"frame": 0})).unwrap();
|
||||
assert_eq!(r["display"], "0:00:00:05");
|
||||
let r = s.execute("time.set", json!({"timecode": "0:00:00:05"})).unwrap();
|
||||
assert_eq!((r["frame"].as_i64(), r["time"].as_f64()), (Some(0), Some(0.0)));
|
||||
|
||||
s.execute("file.projectSettings", json!({"timeDisplay": "frames"})).unwrap();
|
||||
std::sync::Arc::make_mut(&mut s.project).settings.frame_start = 1;
|
||||
let r = s.execute("time.set", json!({"frame": 12})).unwrap();
|
||||
assert_eq!(r["display"], "00013");
|
||||
let r = s.execute("time.set", json!({"timecode": "00013"})).unwrap();
|
||||
assert_eq!((r["frame"].as_i64(), r["time"].as_f64()), (Some(12), Some(0.4)));
|
||||
let r = s.execute("time.set", json!({"timecode": "+1"})).unwrap();
|
||||
assert_eq!(r["frame"], 13);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn separate_dimensions_split_and_rejoin() {
|
||||
let (mut s, l) = setup();
|
||||
|
||||
Reference in New Issue
Block a user