Example #1
0
        public void LoadAndPlayFile_FolderHasNonAsciiCharacter_Plays()
        {
            var source = MediaFileInfoTests.GetShortTestAudioFile();

            using (var folder = new TemporaryFolder("Ń„Ń„SayMoreMediaModelTest"))
            {
                var pathname = Path.Combine(folder.Path, "normal.wav");

                if (File.Exists(pathname))
                {
                    File.Delete(pathname);
                }
                File.Move(source, pathname);
                _model.LoadFile(pathname);
                _model.SetVolume(0.01f);
                var logger = new DebugLogger();
                ReflectionHelper.SetProperty(_model, "DebugOutput", logger);
                _model.PlaybackEnded += delegate
                {
                    _model = null;
                    File.Delete(pathname);
                };
                _model.Play();
                while (_model != null)
                {
                    Thread.Sleep(10);
                }
                Assert.IsTrue(logger.GetText().Contains("Starting playback..."));
            }
        }
Example #2
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 { }
            }
        }
Example #3
0
        public void LoadAndPlayFile_FileNameHasAsciiCharacter_Plays()
        {
            var pathname = MediaFileInfoTests.GetShortTestAudioFile();

            _model.LoadFile(pathname);
            _model.SetVolume(0.01f);
            var logger = new DebugLogger();

            ReflectionHelper.SetProperty(_model, "DebugOutput", logger);
            _model.PlaybackEnded += delegate
            {
                _model = null;
                File.Delete(pathname);
            };
            _model.Play();
            while (_model != null)
            {
                Thread.Sleep(10);
            }
            Assert.IsTrue(logger.GetText().Contains("Starting playback..."));
        }
Example #4
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 { }
            }
        }