Esempio n. 1
0
        public void Save_CanReadSavedFile()
        {
            var mediafile       = MediaFileInfoTests.GetShortTestAudioFile();
            var expectedEafFile = AnnotationFileHelper.ComputeEafFileNameFromOralAnnotationFile(mediafile);

            try
            {
                var savedEafFile = _collection.Save(mediafile);
                Assert.AreEqual(expectedEafFile, savedEafFile);
                var tiers = AnnotationFileHelper.Load(savedEafFile).GetTierCollection();

                // We expect only 3 tiers in the saved file, because the AnnotationFileHelper only saves
                // the Transcription and Free Translation tiers. The "otherTextTier" is discarded.
                Assert.AreEqual(3, tiers.Count);

                for (var i = 0; i < tiers.Count; i++)
                {
                    CheckTier(_collection[i], tiers[i]);
                }
            }
            finally
            {
                try { File.Delete(mediafile); } catch { }
                try { File.Delete(expectedEafFile); } catch { }
            }
        }
Esempio n. 2
0
        private ComponentFile CreateVideoComponentFile(string filename)
        {
            var file = new ComponentFile(null, _parentFolder.Combine(filename),
                                         new FileType[] { new VideoFileType(null, null, null), new UnknownFileType(null, null) },
                                         new ComponentRole[] { }, new XmlFileSerializer(null), null, null, null);

            var annotationPath = Path.Combine(_parentFolder.Path,
                                              AnnotationFileHelper.ComputeEafFileNameFromOralAnnotationFile(filename));

            AnnotationFileHelperTests.CreateTestEaf(annotationPath);
            var annotationFile = new AnnotationComponentFile(null, annotationPath,
                                                             file, _fileTypes, null);

            file.SetAnnotationFile(annotationFile);
            return(file);
        }
Esempio n. 3
0
        public void Save_CanReadSavedFile()
        {
            var mediafile       = MediaFileInfoTests.GetShortTestAudioFile();
            var expectedEafFile = AnnotationFileHelper.ComputeEafFileNameFromOralAnnotationFile(mediafile);

            try
            {
                var savedEafFile = _collection.Save(mediafile);
                Assert.AreEqual(expectedEafFile, savedEafFile);
                var tiers = AnnotationFileHelper.Load(savedEafFile).GetTierCollection();
                Assert.AreEqual(4, tiers.Count);

                for (int i = 0; i < tiers.Count; i++)
                {
                    CheckTier(_collection[i], tiers[i]);
                }
            }
            catch { }
            finally
            {
                try { File.Delete(mediafile); } catch { }
                try { File.Delete(expectedEafFile); } catch { }
            }
        }