forge
Explore
Log in

Don't you dare go Hollow

The removal bin goes, the way back is the file's own door

Browse files at this commit

bbe4e406f230c3d94815a60e5700680bedaeb8c4Ahmet Kaan GümüşParent: f41b4c6
  • revert
    • the removal bin goes, the way back is the file's own door
Show full message
⏪ revert(subtitles): the removal bin goes, the way back is the file's own door

The recovery bin was the wrong answer to the right complaint. What a
person wants after removing a row is not that row back out of a session
cupboard -- it is a way to put *any* file's subtitles on a timeline
without importing the file, which is the door the next commit is about
and which brings the removed one back as a side effect.

So `Project` keeps no bin: a removal removes, as it did before, and the
row's × and the notice now name the add-subtitles stroke as the way
back rather than "import the file again". That old sentence does not
come back: the file itself never has to be imported for its subtitles.

The engine and app halves both go (b13bd53 here, and the app half that
rode into 4420513 while two lanes shared one worktree).
crates/app/src/main.rsmodified+9 -66
@@ -4863,10 +4863,11 @@ impl Player {
4863 /// would name a *different* track -- and the pick is what an export writes4863 /// would name a *different* track -- and the pick is what an export writes
4864 /// into the file.4864 /// into the file.
4865 ///4865 ///
4866- /// Not an undo step: subtitles are not on the history's snapshots. The way4866+ /// Not an undo step: subtitles are not on the history's snapshots, so the
4867- /// back is the row the removal leaves behind under the list4867+ /// way back is putting the file's subtitles on again -- which is a door of
4868- /// ([`Player::restore_subtitle_track`]) -- a click, not a re-import -- and4868+ /// its own ([`Player::pick_and_add_subtitles`]) and reads the subtitles
4869- /// the notice says so rather than promising a ctrl+z that would do nothing.4869+ /// alone, never the media. The notice says that rather than promising a
4870+ /// ctrl+z that would do nothing.
4870 fn remove_subtitle_track(&mut self, track: usize, cx: &mut Context<Self>) {4871 fn remove_subtitle_track(&mut self, track: usize, cx: &mut Context<Self>) {
4871 // The one availability oracle, for the same reason the × on a row and4872 // The one availability oracle, for the same reason the × on a row and
4872 // the stroke are one call: an empty list is not a failure, it is an4873 // the stroke are one call: an empty list is not a failure, it is an
@@ -4903,7 +4904,10 @@ impl Player {
4903 // ponytail: its atlas tile is not released -- `close_session`'s4904 // ponytail: its atlas tile is not released -- `close_session`'s
4904 // note, for its reason and with its upgrade path.4905 // note, for its reason and with its upgrade path.
4905 self.sub_image = None;4906 self.sub_image = None;
4906- format!("{name} REMOVED — it is under the list; click it to bring it back")4907+ format!(
4908+ "{name} REMOVED — {} puts a file's subtitles back on, the file itself stays off",
4909+ self.keymap.display(ActionId::AddSubtitleTrack)
4910+ )
4907 }4911 }
4908 Some(Err(e)) => format!("NO SUBTITLES REMOVED — {e}"),4912 Some(Err(e)) => format!("NO SUBTITLES REMOVED — {e}"),
4909 None => "NO SUBTITLES REMOVED — open a file first".to_string(),4913 None => "NO SUBTITLES REMOVED — open a file first".to_string(),
@@ -4913,42 +4917,6 @@ impl Player {
4913 cx.notify();4917 cx.notify();
4914 }4918 }
4915 4919
4916- /// The removed row's own way back: the `+` under the subtitle list, and the
4917- /// row itself. The track goes back on the timeline with the cues it was
4918- /// removed with ([`engine::PlaybackSession::restore_subtitles`]) -- no file
4919- /// is read again, which is the whole complaint this answers.
4920- ///
4921- /// The restored track becomes the pick and the overlay goes on, for the
4922- /// reason a click on a live row does: bringing a subtitle back is asking to
4923- /// see it, and a restore that changed nothing on screen would read as a
4924- /// dead row.
4925- fn restore_subtitle_track(&mut self, removed: usize, cx: &mut Context<Self>) {
4926- let name = self
4927- .session
4928- .as_ref()
4929- .and_then(|session| sub_pick_name(session.removed_subtitles(), removed))
4930- .unwrap_or_else(|| format!("subtitle track {removed}"));
4931- let text = match self
4932- .session
4933- .as_mut()
4934- .map(|session| session.restore_subtitles(removed))
4935- {
4936- Some(Ok(track)) => {
4937- self.sub_track = track;
4938- self.subs_on = true;
4939- // The drawn cue is keyed by the pick, which has just moved --
4940- // `remove_subtitle_track`'s note, for its reason.
4941- self.sub_image = None;
4942- format!("{name} IS BACK — showing over the picture")
4943- }
4944- Some(Err(e)) => format!("NOTHING BROUGHT BACK — {e}"),
4945- None => "NOTHING BROUGHT BACK — open a file first".to_string(),
4946- };
4947- eprintln!("{text}");
4948- self.notify_user(text.into());
4949- cx.notify();
4950- }
4951-
4952 /// Swaps the whole timeline for one restored from a `.edith`, for4920 /// Swaps the whole timeline for one restored from a `.edith`, for
4953 /// [`Player::install_media`]'s reason: the open is a worker's -- a project4921 /// [`Player::install_media`]'s reason: the open is a worker's -- a project
4954 /// naming a 24 GB film opens that film, which is the same twenty seconds4922 /// naming a 24 GB film opens that film, which is the same twenty seconds
@@ -15527,31 +15495,6 @@ mod tests {
15527 assert_eq!(sub_pick_name(&[], 0), None);15495 assert_eq!(sub_pick_name(&[], 0), None);
15528 }15496 }
15529 15497
15530- /// Whatever a removal took off can be put back from the panel, without the
15531- /// file being imported again: the removed row and its `+` are things on
15532- /// screen, which is what makes the way back an action and not a sentence in
15533- /// a notice. The names on those rows come off the same
15534- /// [`sub_pick_name`] the live ones do, so a removed track reads as the
15535- /// track it was.
15536- #[test]
15537- fn a_removed_subtitle_row_has_its_way_back_in_the_panel() {
15538- let source = ui_source();
15539- for id in ["subtitle-restore", "subtitle-restore-button"] {
15540- assert!(
15541- source.contains(&format!("\"{id}\"")),
15542- "{id} is on no row: a removed subtitle would need a re-import"
15543- );
15544- }
15545- // What those rows are named by, off the removed list rather than the
15546- // live one -- the bin's own indexes.
15547- let gone = [
15548- sub("/films/a.mkv", Some(1), "eng"),
15549- sub("/subs/late.srt", None, "late.srt"),
15550- ];
15551- assert_eq!(sub_pick_name(&gone, 0).as_deref(), Some("eng — a"));
15552- assert_eq!(sub_pick_name(&gone, 1).as_deref(), Some("late.srt"));
15553- }
15554-
15555 /// The one thing regrouping must not break: `sub_track` is a flat index15498 /// The one thing regrouping must not break: `sub_track` is a flat index
15556 /// into the add-order list, a click sets it and a save writes it into the15499 /// into the add-order list, a click sets it and a save writes it into the
15557 /// `.edith`. Every row must still name the track it was made from -- rows15500 /// `.edith`. Every row must still name the track it was made from -- rows
crates/app/src/ui/timeline.rsmodified+9 -101
@@ -333,14 +333,13 @@ impl Player {
333 cx: &mut Context<Self>,333 cx: &mut Context<Self>,
334 ) -> Option<impl IntoElement> {334 ) -> Option<impl IntoElement> {
335 let tracks = self.session.as_ref()?.subtitles();335 let tracks = self.session.as_ref()?.subtitles();
336- // The rows a removal left behind: still a section, because a list that336+ if tracks.is_empty() {
337- // has just been emptied is exactly when the way back has to be on
338- // screen.
339- let gone = self.session.as_ref()?.removed_subtitles();
340- if tracks.is_empty() && gone.is_empty() {
341 return None;337 return None;
342 }338 }
343 let groups = subtitle_rows(tracks);339 let groups = subtitle_rows(tracks);
340+ // What the row's × says the way back is, in the stroke this keymap
341+ // actually binds: a file's subtitles go on without the file.
342+ let add_key = self.keymap.display(ActionId::AddSubtitleTrack);
344 // One file's tracks need no prefix saying which file: it is the only343 // One file's tracks need no prefix saying which file: it is the only
345 // one, and every row would carry the same word.344 // one, and every row would carry the same word.
346 let several_files = groups.len() > 1;345 let several_files = groups.len() > 1;
@@ -389,7 +388,10 @@ impl Player {
389 // Named, because a × is the same glyph on every row and388 // Named, because a × is the same glyph on every row and
390 // the tooltip is what says which track it takes off.389 // the tooltip is what says which track it takes off.
391 let remove_tip: SharedString =390 let remove_tip: SharedString =
392- format!("Remove {title} — it drops to the list below, one click back")391+ format!(
392+ "Remove {title} — {} puts a file's subtitles back on",
393+ add_key
394+ )
393 .into();395 .into();
394 div()396 div()
395 // The *flat* index into the session's add-order397 // The *flat* index into the session's add-order
@@ -541,99 +543,6 @@ impl Player {
541 .children(rows)543 .children(rows)
542 })544 })
543 .collect();545 .collect();
544- // What a removal left behind, under the live rows and dimmed: the same
545- // row shape with a `+` where the × was, so the way off the timeline and
546- // the way back on are one thing in one place. The cues are still in
547- // hand (`engine::PlaybackSession::removed_subtitles`), so this is a
548- // click and not a re-read of a 25 GB file.
549- let back = (!gone.is_empty()).then(|| {
550- let rows: Vec<_> = (0..gone.len())
551- .map(|bin| {
552- let name = sub_pick_name(gone, bin).unwrap_or_else(|| format!("track {bin}"));
553- let tint = file_tint(self.sources(), &gone[bin].path);
554- let detail = subtitle_detail(&gone[bin]);
555- let tip: SharedString =
556- format!("Bring {name} back — the cues are still here, nothing is re-read")
557- .into();
558- let back_tip = tip.clone();
559- div()
560- .id(("subtitle-restore", bin))
561- .flex_none()
562- .h(px(ROW_H))
563- .flex()
564- .items_center()
565- .gap(px(6.))
566- .pr(px(6.))
567- .rounded(px(3.))
568- .text_color(rgb(FG_SECONDARY()))
569- .cursor_pointer()
570- .hover(|s| s.bg(rgb(BG_HOVER())))
571- .tooltip(move |_, cx| cx.new(|_| Tip(tip.clone())).into())
572- .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
573- this.restore_subtitle_track(bin, cx);
574- }))
575- .child(
576- div()
577- .flex_none()
578- .w(px(SWATCH_W))
579- .h_full()
580- .rounded(px(2.))
581- .opacity(0.55)
582- .when_some(tint, |d, tint| d.bg(rgb(tint))),
583- )
584- .child(
585- div()
586- .flex_1()
587- .min_w(px(0.))
588- .flex()
589- .flex_col()
590- .child(div().truncate().text_size(px(11.)).child(name))
591- .child(div().truncate().text_size(px(10.)).child(detail)),
592- )
593- // The × 's own twin: a `HIT_MIN` target at the same
594- // edge, and it stops the click there for the same
595- // reason the × does -- the row under it does the same
596- // thing, and a doubled restore would be a second
597- // notice about a row that is already back.
598- .child(
599- div()
600- .id(("subtitle-restore-button", bin))
601- .flex_none()
602- .w(px(HIT_MIN))
603- .h_full()
604- .flex()
605- .items_center()
606- .justify_center()
607- .rounded(px(3.))
608- .cursor_pointer()
609- .hover(|s| s.bg(rgb(BG_HOVER())))
610- .tooltip(move |_, cx| cx.new(|_| Tip(back_tip.clone())).into())
611- .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
612- cx.stop_propagation();
613- this.restore_subtitle_track(bin, cx);
614- }))
615- .child("+"),
616- )
617- })
618- .collect();
619- div()
620- .flex_none()
621- .flex()
622- .flex_col()
623- .gap(px(2.))
624- .child(
625- div()
626- .flex_none()
627- .h(px(SUB_HEAD_H))
628- .flex()
629- .items_center()
630- .truncate()
631- .text_size(px(10.))
632- .text_color(rgb(FG_SECONDARY()))
633- .child("Removed — click to bring one back"),
634- )
635- .children(rows)
636- });
637 Some(546 Some(
638 div()547 div()
639 .flex_none()548 .flex_none()
@@ -665,8 +574,7 @@ impl Player {
665 .gap(px(2.))574 .gap(px(2.))
666 .max_h(px(SUB_ROWS_H))575 .max_h(px(SUB_ROWS_H))
667 .overflow_y_scroll()576 .overflow_y_scroll()
668- .children(rows)577+ .children(rows),
669- .children(back),
670 ),578 ),
671 )579 )
672 }580 }
crates/engine/src/playback.rsmodified+3 -17
@@ -1066,27 +1066,13 @@ impl PlaybackSession {
1066 /// unlike [`remove_source`](Self::remove_source) this does not reseek. Rows1066 /// unlike [`remove_source`](Self::remove_source) this does not reseek. Rows
1067 /// past `idx` move down by one: a caller holding a picked row (the export's1067 /// past `idx` move down by one: a caller holding a picked row (the export's
1068 /// subtitle pick) has to fix it up or drop it. Not an undo step, for the1068 /// subtitle pick) has to fix it up or drop it. Not an undo step, for the
1069- /// reason [`Project::remove_subtitles`] gives -- and not a loss either: the1069+ /// reason [`Project::remove_subtitles`] gives -- the way back is
1070- /// track keeps its cues in1070+ /// [`import_subtitles`](Self::import_subtitles), which reads a file's
1071- /// [`removed_subtitles`](Self::removed_subtitles) and1071+ /// subtitles and touches nothing else on the timeline.
1072- /// [`restore_subtitles`](Self::restore_subtitles) puts it back.
1073 pub fn remove_subtitles(&mut self, idx: usize) -> crate::Result<()> {1072 pub fn remove_subtitles(&mut self, idx: usize) -> crate::Result<()> {
1074 self.project.remove_subtitles(idx)1073 self.project.remove_subtitles(idx)
1075 }1074 }
1076 1075
1077- /// The tracks removed from this timeline, oldest first: what a front-end
1078- /// lists as the way back ([`Project::removed_subtitles`]).
1079- pub fn removed_subtitles(&self) -> &[crate::subtitle::SubtitleTrack] {
1080- self.project.removed_subtitles()
1081- }
1082-
1083- /// Brings the `idx`th removed track back, cues and all, and hands back
1084- /// which row it is now ([`Project::restore_subtitles`]). Nothing is read
1085- /// off disk: this is the removal undone, not the import repeated.
1086- pub fn restore_subtitles(&mut self, idx: usize) -> crate::Result<usize> {
1087- self.project.restore_subtitles(idx)
1088- }
1089-
1090 /// Writes the timeline to `path` as a `.edith`, atomically (see1076 /// Writes the timeline to `path` as a `.edith`, atomically (see
1091 /// [`crate::edith`]). Sources no clip plays from are left out, and the1077 /// [`crate::edith`]). Sources no clip plays from are left out, and the
1092 /// playhead is saved with it so a reopened project resumes where it stood.1078 /// playhead is saved with it so a reopened project resumes where it stood.
crates/engine/src/project.rsmodified+8 -59
@@ -650,17 +650,6 @@ pub struct Project {
650 /// it, and it is saved as a *reference* to the file the cues came out of650 /// it, and it is saved as a *reference* to the file the cues came out of
651 /// ([`crate::subtitle`]).651 /// ([`crate::subtitle`]).
652 subtitles: Vec<SubtitleTrack>,652 subtitles: Vec<SubtitleTrack>,
653- /// What [`Project::remove_subtitles`] took off, oldest first, cues and all
654- /// -- the bin [`Project::restore_subtitles`] puts one back from. A removal
655- /// keeps the track rather than dropping it because the cues cost a walk of
656- /// the whole container to read (210 ms on a 25 GB remux) and re-reading the
657- /// file is the one thing a person who removed a row by mistake should not
658- /// have to do.
659- ///
660- /// Not saved and not on the history's snapshots: a `.edith` is what the
661- /// timeline *has* ([`crate::edith`]), so the bin is the session's, exactly
662- /// as a clipboard is.
663- removed_subs: Vec<SubtitleTrack>,
664 /// The master limiter every lane's sound is summed *through*653 /// The master limiter every lane's sound is summed *through*
665 /// ([`Project::limiter`]). Off by default, and not in the lane list, which654 /// ([`Project::limiter`]). Off by default, and not in the lane list, which
666 /// is what the history snapshots hold: it is a setting on the mix, like the655 /// is what the history snapshots hold: it is a setting on the mix, like the
@@ -700,7 +689,6 @@ impl Project {
700 history: Vec::new(),689 history: Vec::new(),
701 next_link: 1,690 next_link: 1,
702 subtitles: Vec::new(),691 subtitles: Vec::new(),
703- removed_subs: Vec::new(),
704 limiter: Limiter::default(),692 limiter: Limiter::default(),
705 tone: crate::tonemap::Preset::default(),693 tone: crate::tonemap::Preset::default(),
706 }694 }
@@ -811,7 +799,6 @@ impl Project {
811 history: Vec::new(),799 history: Vec::new(),
812 next_link,800 next_link,
813 subtitles: Vec::new(),801 subtitles: Vec::new(),
814- removed_subs: Vec::new(),
815 limiter: Limiter::default(),802 limiter: Limiter::default(),
816 tone: crate::tonemap::Preset::default(),803 tone: crate::tonemap::Preset::default(),
817 })804 })
@@ -1250,56 +1237,21 @@ impl Project {
1250 /// [`crate::export::ExportSettings::subtitles`]) has to fix it up or drop1237 /// [`crate::export::ExportSettings::subtitles`]) has to fix it up or drop
1251 /// it, or it names a different track afterwards.1238 /// it, or it names a different track afterwards.
1252 ///1239 ///
1253- /// Not an undo step, for the reason the limiter is not -- the history1240+ /// ponytail: not an undo step, for the reason the limiter is not -- the
1254- /// snapshots hold the lane list and subtitles are not on it1241+ /// history snapshots hold the lane list and subtitles are not on it
1255- /// ([`Project::subtitles`]). The way back is1242+ /// ([`Project::subtitles`]). The inverse is putting the file's tracks back
1256- /// [`restore_subtitles`](Project::restore_subtitles) and not a re-import:1243+ /// on -- [`crate::PlaybackSession::import_subtitles`], the panel's own
1257- /// the track goes to [`removed_subtitles`](Project::removed_subtitles) with1244+ /// door, which reads the subtitles of a file and nothing else -- and not a
1258- /// its cues, so nothing that was read has to be read again.1245+ /// ctrl+z; the upgrade path is the same one the limiter has: a history
1246+ /// entry holding the project's own settings beside the lanes.
1259 pub fn remove_subtitles(&mut self, idx: usize) -> crate::Result<()> {1247 pub fn remove_subtitles(&mut self, idx: usize) -> crate::Result<()> {
1260 if idx >= self.subtitles.len() {1248 if idx >= self.subtitles.len() {
1261 return Err(format!("there is no subtitle track {idx} to remove").into());1249 return Err(format!("there is no subtitle track {idx} to remove").into());
1262 }1250 }
1263- self.removed_subs.push(self.subtitles.remove(idx));1251+ self.subtitles.remove(idx);
1264 Ok(())1252 Ok(())
1265 }1253 }
1266 1254
1267- /// The tracks removed so far, oldest first: what a front-end lists beside
1268- /// the live ones so a removal can be taken back
1269- /// ([`restore_subtitles`](Project::restore_subtitles) indexes into this).
1270- pub fn removed_subtitles(&self) -> &[SubtitleTrack] {
1271- &self.removed_subs
1272- }
1273-
1274- /// Puts the `idx`th removed track back on the timeline, cues and all, and
1275- /// hands back which row it is now. The inverse of
1276- /// [`remove_subtitles`](Project::remove_subtitles) and the same thing a
1277- /// re-import of that file would have added -- minus the walk of the
1278- /// container, which is the whole point.
1279- ///
1280- /// Refused by name for a bin this project does not have that many entries
1281- /// in, exactly as a bad removal index is: a front-end holding a stale index
1282- /// has picked the wrong row and needs to hear it.
1283- ///
1284- /// ponytail: it lands at the *end* of the list rather than where it was,
1285- /// which is where a re-import would have put it too. What that costs is the
1286- /// row order after a restore; the upgrade path is remembering the index
1287- /// beside the track in the bin and inserting there.
1288- pub fn restore_subtitles(&mut self, idx: usize) -> crate::Result<usize> {
1289- if idx >= self.removed_subs.len() {
1290- return Err(format!("there is no removed subtitle track {idx} to bring back").into());
1291- }
1292- let track = self.removed_subs.remove(idx);
1293- // `false` when the very same (file, track) was imported again while it
1294- // sat in the bin: it is already back, and the row it is already on is
1295- // the answer -- which the lookup below gives either way.
1296- self.add_subtitles(&track);
1297- self.subtitles
1298- .iter()
1299- .position(|t| t.path == track.path && t.track == track.track)
1300- .ok_or_else(|| format!("{} did not go back on the timeline", track.label).into())
1301- }
1302-
1303 /// What each of [`audio_segments_from`](Project::audio_segments_from)'s1255 /// What each of [`audio_segments_from`](Project::audio_segments_from)'s
1304 /// lanes is multiplied by on its way into the mix: the same lanes in the1256 /// lanes is multiplied by on its way into the mix: the same lanes in the
1305 /// same order, as *amplitudes*, so the mixer never sees a decibel. `1.0`1257 /// same order, as *amplitudes*, so the mixer never sees a decibel. `1.0`
@@ -2788,9 +2740,6 @@ impl Project {
2788 history: Vec::new(),2740 history: Vec::new(),
2789 next_link: self.next_link,2741 next_link: self.next_link,
2790 subtitles: self.subtitles.clone(),2742 subtitles: self.subtitles.clone(),
2791- // An export renders what is on the timeline: the bin is a way back
2792- // for the window, and no render reads it.
2793- removed_subs: Vec::new(),
2794 limiter: self.limiter,2743 limiter: self.limiter,
2795 tone: self.tone,2744 tone: self.tone,
2796 }2745 }
crates/engine/tests/subtitles.rsmodified+0 -76
@@ -412,82 +412,6 @@ fn a_subtitle_row_can_be_removed_and_the_survivors_round_trip() {
412 assert_eq!(session.subtitles().len(), 2, "and nothing moved");412 assert_eq!(session.subtitles().len(), 2, "and nothing moved");
413 }413 }
414 414
415-/// The removal's inverse, which is the whole complaint: a row taken off is *in
416-/// hand*, not gone, and one call puts it back with the cues it left with. The
417-/// proof that nothing is re-read is the file itself -- it is deleted from disk
418-/// before the restore, and the cues still come back whole. A re-import at that
419-/// point could only have refused.
420-#[test]
421-fn a_removed_subtitle_row_comes_back_without_a_reimport() {
422- let dir = scratch("restore");
423- let media = dir.join("test_av.mp4");
424- std::fs::copy(asset("test_av.mp4"), &media).expect("copy the media fixture");
425- for name in ["a.srt", "b.srt"] {
426- std::fs::copy(data("test_subs.srt"), dir.join(name)).expect("copy the subtitle fixture");
427- }
428-
429- let mut session = engine::PlaybackSession::open(&media).expect("open the fixture");
430- session.set_gain(0.0);
431- for name in ["a.srt", "b.srt"] {
432- session
433- .import_subtitles(&dir.join(name))
434- .expect("the .srt imports");
435- }
436- assert!(session.removed_subtitles().is_empty(), "nothing removed yet");
437-
438- session.remove_subtitles(0).expect("the first row goes");
439- assert_eq!(session.subtitles().len(), 1, "one row left on the timeline");
440- let bin: Vec<&str> = session
441- .removed_subtitles()
442- .iter()
443- .map(|t| t.label.as_str())
444- .collect();
445- assert_eq!(bin, vec!["a.srt"], "and the removed one is listed as removed");
446- assert_eq!(
447- session.removed_subtitles()[0].cues,
448- expected(),
449- "with its cues, so bringing it back costs no walk of the file"
450- );
451-
452- // The file is gone: a re-import is not even possible from here, which is
453- // exactly the state a person who removed the wrong row must not be in.
454- std::fs::remove_file(dir.join("a.srt")).expect("delete the source file");
455-
456- let track = session.restore_subtitles(0).expect("the row comes back");
457- assert_eq!(track, 1, "back on the timeline, where a re-import would land");
458- assert!(
459- session.removed_subtitles().is_empty(),
460- "and out of the removed list"
461- );
462- let names: Vec<String> = session
463- .subtitles()
464- .iter()
465- .map(|t| t.label.clone())
466- .collect();
467- assert_eq!(names, vec!["b.srt", "a.srt"]);
468- assert_eq!(
469- session.subtitles()[track].cues,
470- expected(),
471- "cues and all, off a file that is not there any more"
472- );
473-
474- // A save writes it like any other row, and a load reads it back -- the
475- // restore is a track on the timeline, not a session-only ghost. (Its file
476- // is gone, so the load lists it refused by name, which is what a missing
477- // subtitle has always been.)
478- let project = dir.join("back.edith");
479- session.save_project(&project).expect("save");
480- let text = std::fs::read_to_string(&project).expect("read the project back");
481- assert!(text.contains("\nsubtitle - a.srt\n"), "{text}");
482-
483- // A bin index nobody has says so, naming it, exactly as a bad removal does.
484- let why = session
485- .restore_subtitles(0)
486- .expect_err("the bin is empty")
487- .to_string();
488- assert!(why.contains('0') && why.contains("subtitle"), "{why}");
489-}
490-
491 /// A bitmap track survives a save the same way a text one does, and for the415 /// A bitmap track survives a save the same way a text one does, and for the
492 /// same reason: a `.edith` holds the file and the track number, never a cue, so416 /// same reason: a `.edith` holds the file and the track number, never a cue, so
493 /// what comes back is what the file still says. The pictures are read out of417 /// what comes back is what the file still says. The pictures are read out of