예제 #1
0
 public void Export_NoSegments_MakesEmptyFile()
 {
     using (var temp = TempFile.CreateAndGetPathButDontMakeTheFile())
     {
         AudacityExporter.Export(temp.Path, new TextTier(TextTier.ElanTranscriptionTierId));
         Assert.IsTrue(File.Exists(temp.Path));
         Assert.AreEqual(0, File.ReadAllText(temp.Path).Length);
     }
 }
예제 #2
0
 public void Export_FileLocked_Throws()
 {
     using (var temp = TempFile.CreateAndGetPathButDontMakeTheFile())
         using (File.OpenWrite(temp.Path))
         {
             Assert.Throws <IOException>(() =>
             {
                 AudacityExporter.Export(temp.Path, CreateTier());
             });
         }
 }
예제 #3
0
        private void OnAudacityExportFreeTranslation(object sender, EventArgs e)
        {
            Analytics.Track("Export Free Translation to Audacity");

            var timeTier = (((AnnotationComponentFile)_file).Tiers.GetTimeTier());
            var textTeir = ((AnnotationComponentFile)_file).Tiers.GetFreeTranslationTier();

            textTeir.AddTimeRangeData(timeTier);
            var suffix = LocalizationManager.GetString("SessionsView.Transcription.TextAnnotation.ExportMenu.AudacityFreeTranslationFilenameSuffix",
                                                       "audacity_freeTranslation", "Probably does not need to be localized");
            var action = new Action <string>(path => AudacityExporter.Export(path, textTeir));

            DoSimpleExportDialog(".txt", "Text File", suffix, "Audacity", action);
        }
예제 #4
0
 public void Export_Nominal_WritesExpectedContents()
 {
     using (var temp = TempFile.CreateAndGetPathButDontMakeTheFile())
     {
         AudacityExporter.Export(temp.Path, CreateTier());
         Debug.WriteLine(File.ReadAllText(temp.Path));
         var lines = GetLines(temp).ToArray();
         //Assert.AreEqual(3/*segments*/+1/*blank*/, lines.Count());
         Assert.AreEqual(3, lines.Count());
         Assert.AreEqual("0.000000\t1.000000\tone", lines[0]);
         Assert.AreEqual("1.456000\t2.679000\ttwo", lines[1]);                //2.6790 instead of 2.6789 because somewhere else in saymore, the value gets rounded. Not and export issue.
         Assert.AreEqual("2.000000\t3.000000\tthree", lines[2]);
     }
 }