private void DoExportSubtitleDialog(string fileNameSuffix, TimeTier timeTier, TextTier textTeir) { textTeir.AddTimeRangeData(timeTier); var action = new Action <string>(path => SRTFormatSubTitleExporter.Export(path, textTeir)); DoSimpleExportDialog(".srt", "SRT Subtitle File", fileNameSuffix, string.Empty, action); }
public void Export_NoSegments_MakesEmptyFile() { using (var temp = TempFile.CreateAndGetPathButDontMakeTheFile()) { SRTFormatSubTitleExporter.Export(temp.Path, new TextTier(TextTier.ElanTranscriptionTierId)); Assert.IsTrue(File.Exists(temp.Path)); Assert.AreEqual(0, File.ReadAllText(temp.Path).Length); } }
private void DoExportSubtitleDialog(string fileNameSuffix, TimeTier timeTier, TextTier textTeir) { textTeir.AddTimeRangeData(timeTier); var action = new Action <string>(path => SRTFormatSubTitleExporter.Export(path, textTeir)); DoSimpleExportDialog(".srt", LocalizationManager.GetString("SessionsView.Transcription.TextAnnotation.ExportMenu.srtSubtitlesTranscriptionExport.TranscriptionFileDescriptor", "SRT Subtitle File ({0})"), fileNameSuffix, string.Empty, action); }
public void Export_FileLocked_Throws() { using (var temp = TempFile.CreateAndGetPathButDontMakeTheFile()) using (File.OpenWrite(temp.Path)) { Assert.Throws <IOException>(() => { SRTFormatSubTitleExporter.Export(temp.Path, CreateTier()); }); } }
public void Export_Nominal_WritesExpectedContents() { using (var temp = TempFile.CreateAndGetPathButDontMakeTheFile()) { SRTFormatSubTitleExporter.Export(temp.Path, CreateTier()); Debug.WriteLine(File.ReadAllText(temp.Path)); var lines = GetLines(temp).ToArray(); Assert.AreEqual((3 * 4) - 1, lines.Count()); Assert.AreEqual("1", lines[0]); Assert.AreEqual("00:00:00,00 --> 00:00:01,00", lines[1]); Assert.AreEqual("one", lines[2]); Assert.AreEqual("", lines[3]); //blank line Assert.AreEqual("2", lines[4]); Assert.AreEqual("00:00:01,45 --> 00:00:02,67", lines[5]); Assert.AreEqual("two", lines[6]); Assert.AreEqual("", lines[7]); //blank line } }