public void FixtureSetup()
        {
            mfs = new MediaFileSet ();
            mfs.Add (new MediaFile { FilePath = "test1", VideoWidth = 320, VideoHeight = 240, Par = 1 });
            mfs.Add (new MediaFile { FilePath = "test2", VideoWidth = 320, VideoHeight = 240, Par = 1 });

            mockAnalysisWindow = new Mock<IAnalysisWindowBase> ();
            mockPlayerController = new Mock<IPlayerController> ();
            mockPlayerController.SetupAllProperties ();
            mockPlayerController.SetupGet (x => x.CurrentTime).Returns (new Time (1000));
            MediaFileSet mf = new MediaFileSet ();
            mf.Add (new MediaFile ("path", 34000, 25, true, true, "mp4", "h264",
                "aac", 320, 240, 1.3, null, "Test asset"));
            mockPlayerController.SetupGet (m => m.FileSet).Returns (mf);
            mockAnalysisWindow.SetupGet (m => m.Player).Returns (mockPlayerController.Object);
            mockVideoRenderer = new Mock<IJobsManager> ();
            mockDiaklogs = new Mock<IDialogs> ();

            playerMock = new Mock<IPlayer> ();
            playerMock.SetupAllProperties ();
            Mock<IMultiPlayer> multiplayerMock = new Mock<IMultiPlayer> ();

            multimediaToolkitMock = new Mock<IMultimediaToolkit> ();
            multimediaToolkitMock.Setup (m => m.GetPlayer ()).Returns (playerMock.Object);
            App.Current.MultimediaToolkit = multimediaToolkitMock.Object;

            App.Current.LowerRate = 1;
            App.Current.UpperRate = 30;
            App.Current.RatePageIncrement = 3;
            App.Current.RateList = new List<double> { 0.04, 0.08, 0.12, 0.16, 0.20, 0.24, 0.28, 0.32, 0.36, 0.40, 0.44,
                    0.48, 0.52, 0.56, 0.60, 0.64, 0.68, 0.72, 0.76, 0.80, 0.84, 0.88, 0.92, 0.96, 1, 2, 3, 4, 5
                };
            App.Current.DefaultRate = 25;
        }
Example #2
0
        public void TestSerialization()
        {
            MediaFileSet mf = new MediaFileSet();

            mf.Add(new MediaFile("path", 34000, 25, true, true, "mp4", "h264",
                                 "aac", 320, 240, 1.3, null, "Test asset"));
            mf.Add(new MediaFile("path", 34000, 25, true, true, "mp4", "h264",
                                 "aac", 320, 240, 1.3, null, "Test asset 2"));
            Utils.CheckSerialization(mf);
        }
Example #3
0
        public void TestOrderReplace()
        {
            MediaFileSet mf = new MediaFileSet();

            mf.Add(new MediaFile("path1", 34000, 25, true, true, "mp4", "h264",
                                 "aac", 320, 240, 1.3, null, "Test asset")
            {
                Offset = new Time(1)
            });
            mf.Add(new MediaFile("path2", 34000, 25, true, true, "mp4", "h264",
                                 "aac", 320, 240, 1.3, null, "Test asset 2")
            {
                Offset = new Time(2)
            });
            mf.Add(new MediaFile("path3", 34000, 25, true, true, "mp4", "h264",
                                 "aac", 320, 240, 1.3, null, "Test asset 3")
            {
                Offset = new Time(3)
            });

            Assert.AreEqual(3, mf.Count);
            Assert.AreEqual("path1", mf [0].FilePath);
            Assert.AreEqual("path2", mf [1].FilePath);
            Assert.AreEqual("path3", mf [2].FilePath);

            mf.Replace("Test asset 2", new MediaFile("path4", 34000, 25, true, true, "mp4", "h264",
                                                     "aac", 320, 240, 1.3, null, "Test asset 4")
            {
                Offset = new Time(4)
            });

            Assert.AreEqual(3, mf.Count);
            Assert.AreEqual("path1", mf [0].FilePath);
            Assert.AreEqual("path4", mf [1].FilePath);
            Assert.AreEqual("Test asset 2", mf [1].Name);
            Assert.AreEqual(new Time(2), mf [1].Offset);
            Assert.AreEqual("path3", mf [2].FilePath);

            mf.Replace(mf [1], new MediaFile("path5", 34000, 25, true, true, "mp4", "h264",
                                             "aac", 320, 240, 1.3, null, "Test asset 5")
            {
                Offset = new Time(5)
            });

            Assert.AreEqual(3, mf.Count);
            Assert.AreEqual("path1", mf [0].FilePath);
            Assert.AreEqual("path5", mf [1].FilePath);
            Assert.AreEqual("Test asset 2", mf [1].Name);
            Assert.AreEqual(new Time(2), mf [1].Offset);
            Assert.AreEqual("path3", mf [2].FilePath);
        }
Example #4
0
        void HandleSelectedCameraChanged(object sender, EventArgs args)
        {
            CameraObject camera = camerasTimeline.SelectedCamera;

            if (camera != null)
            {
                // Check if we need to reopen the player
                if (!sec_cam_playerbin.Player.Opened ||
                    sec_cam_playerbin.Player.FileSet.FirstOrDefault() != camera.MediaFile)
                {
                    MediaFileSet fileSet = new MediaFileSet();
                    fileSet.Add(camera.MediaFile);

                    sec_cam_playerbin.Player.Open(fileSet);

                    // Configure audio
                    HandleAudioToggled(sec_cam_audio_button, new EventArgs());
                }
                // And update
                HandleCameraUpdate(camera);
            }
            else
            {
                // When no camera is selected show the initial didactic message.
                ShowDidactic(DidacticMessage.Initial);
            }
        }
Example #5
0
        public void TestCheckFilesPathNotFixed()
        {
            // Arrange file with wrong path
            string path             = Path.GetTempFileName();
            string wrongDir         = "other-non-existing-path";
            string wrongFullPath    = Path.Combine(wrongDir, Path.GetFileName(path));
            string originalFullPath = Path.Combine("non-existing-path", Path.GetFileName(path));

            MediaFileSet mf = new MediaFileSet();

            mf.Add(new MediaFile {
                FilePath = originalFullPath,
                Name     = "Test asset"
            });
            try {
                // Act
                bool ret = mf.CheckFiles(wrongDir);

                // Assert path is not fixed
                Assert.IsFalse(ret);
                Assert.AreNotEqual(wrongFullPath, mf.First().FilePath);
                Assert.AreEqual(originalFullPath, mf.First().FilePath);
            } finally {
                File.Delete(path);
            }
        }
Example #6
0
        public async Task Replace_FileNotContained_Added()
        {
            dialogMock.Setup(d => d.OpenMediaFile(It.IsAny <object> ())).Returns(new MediaFile {
                FilePath = "new"
            });

            MediaFileSet   fileSet   = new MediaFileSet();
            MediaFileSetVM fileSetVM = new MediaFileSetVM {
                Model = fileSet
            };

            fileSet.Add(new MediaFile {
                FilePath = "old"
            });

            MediaFileVM newFileVM = await App.Current.EventsBroker.PublishWithReturn <ReplaceMediaFileEvent, MediaFileVM> (new ReplaceMediaFileEvent {
                OldFileSet = fileSetVM,
                OldFile    = new MediaFileVM {
                    Model = new MediaFile {
                        FilePath = "not contained"
                    }
                },
            });

            Assert.IsNotNull(newFileVM);
            Assert.IsNotNull(newFileVM.Model);
            Assert.AreEqual("new", newFileVM.FilePath);
            Assert.AreEqual("new", newFileVM.Model.FilePath);
            Assert.AreEqual(2, fileSetVM.Count());
        }
Example #7
0
        void PreparePlayer(bool readyToSeek = true)
        {
            var player = new VideoPlayerController();

            player.SetViewModel(videoPlayer);
            var mfs = new MediaFileSet();

            mfs.Add(new MediaFile {
                FilePath    = "test1",
                VideoWidth  = 320,
                VideoHeight = 240,
                Par         = 1,
                Duration    = new Time {
                    TotalSeconds = 5000
                }
            });
            player.CamerasConfig = new RangeObservableCollection <CameraConfig> {
                new CameraConfig(0),
                new CameraConfig(1)
            };
            Mock <IViewPort> viewPortMock = new Mock <IViewPort> ();

            viewPortMock.SetupAllProperties();
            player.ViewPorts = new List <IViewPort> {
                viewPortMock.Object, viewPortMock.Object
            };
            player.Ready(true);
            player.Open(mfs);
        }
Example #8
0
 public void TestDuration()
 {
     MediaFileSet mf = new MediaFileSet ();
     Assert.AreEqual (mf.Duration.MSeconds, 0);
     mf.Add (new MediaFile {Duration = new Time (2000), Name = "Test asset"});
     Assert.AreEqual (mf.Duration.MSeconds, 2000);
     mf.Replace ("Test asset", new MediaFile {Duration = new Time (2001), Name = "Test asset 2"});
     Assert.AreEqual (mf.Duration.MSeconds, 2001);
 }
Example #9
0
        public void TestPreview()
        {
            MediaFileSet mf = new MediaFileSet();

            Assert.IsNull(mf.Preview);
            mf.Add(new MediaFile {
                Preview = Utils.LoadImageFromFile(), Name = "Test asset"
            });
            Assert.IsNotNull(mf.Preview);
        }
Example #10
0
        public void TestVisibleRegionOutOfBounds()
        {
            MediaFileSet mfs = new MediaFileSet();

            mfs.Add(new MediaFile {
                FilePath = "/videos/test.mp4",
                Duration = new Time(20000),
            });
            mfs.VisibleRegion.Start = new Time(7000);
            mfs.VisibleRegion.Stop  = new Time(17000);
            mfs.Clear();
            mfs.Add(new MediaFile {
                FilePath = "/videos/test.mp4",
                Duration = new Time(5000),
            });

            Assert.IsNotNull(mfs.VisibleRegion);
            Assert.AreEqual(new Time(0), mfs.VisibleRegion.Start);
            Assert.AreEqual(new Time(5000), mfs.VisibleRegion.Stop);
        }
Example #11
0
        public void FixtureSetup()
        {
            playerMock = new Mock <IPlayer> ();
            playerMock.SetupAllProperties();
            /* Mock properties without setter */
            playerMock.Setup(p => p.CurrentTime).Returns(() => currentTime);
            playerMock.Setup(p => p.StreamLength).Returns(() => streamLength);
            playerMock.Setup(p => p.Play()).Raises(p => p.StateChange  += null, this, true);
            playerMock.Setup(p => p.Pause()).Raises(p => p.StateChange += null, this, false);

            mtkMock = new Mock <IMultimediaToolkit> ();
            mtkMock.Setup(m => m.GetPlayer()).Returns(playerMock.Object);
            mtkMock.Setup(m => m.GetMultiPlayer()).Throws(new Exception());
            Config.MultimediaToolkit = mtkMock.Object;

            var ftk = new Mock <IGUIToolkit> ();

            ftk.Setup(m => m.Invoke(It.IsAny <EventHandler> ())).Callback <EventHandler> (e => e(null, null));
            Config.GUIToolkit = ftk.Object;

            Config.EventsBroker = new EventsBroker();

            mfs = new MediaFileSet();
            mfs.Add(new MediaFile {
                FilePath = "test1", VideoWidth = 320, VideoHeight = 240, Par = 1
            });
            mfs.Add(new MediaFile {
                FilePath = "test2", VideoWidth = 320, VideoHeight = 240, Par = 1
            });

            evt = new TimelineEvent {
                Start         = new Time(100), Stop = new Time(200),
                CamerasConfig = new List <CameraConfig> {
                    new CameraConfig(0)
                }
            };
            plImage  = new PlaylistImage(Utils.LoadImageFromFile(), new Time(5));
            playlist = new Playlist();
            playlist.Elements.Add(new PlaylistPlayElement(evt));
            playlist.Elements.Add(plImage);
        }
Example #12
0
        void LoadVideo(PlaylistVideo video)
        {
            loadedPlaylistElement = video;
            MediaFileSet fileSet = new MediaFileSet();

            fileSet.Add(video.File);
            EmitLoadDrawings(null);
            UpdateCamerasConfig(new List <CameraConfig> {
                new CameraConfig(0)
            }, null);
            InternalOpen(fileSet, false, true, true);
        }
Example #13
0
 public void TestCheckFiles()
 {
     string path = Path.GetTempFileName ();
     MediaFileSet mf = new MediaFileSet ();
     Assert.IsFalse (mf.CheckFiles());
     mf.Add (new MediaFile {FilePath = path, Name = "Test asset"});
     try {
         Assert.IsTrue (mf.CheckFiles ());
     } finally {
         File.Delete (path);
     }
 }
Example #14
0
 public void Setup()
 {
     model = new MediaFileSet {
         IsStretched = false,
     };
     model.Add(new MediaFile {
         FilePath = "/videos/test.mp4",
         Duration = new Time(20000),
     });
     viewModel = new MediaFileSetVM {
         Model = model,
     };
 }
Example #15
0
        public void TestChangingStopDoesNotChangeDuration()
        {
            MediaFileSet mfs = new MediaFileSet();

            mfs.Add(new MediaFile {
                FilePath = "/videos/test.mp4",
                Duration = new Time(20000),
            });
            mfs.VisibleRegion.Stop.MSeconds += 100;

            Assert.AreEqual(new Time(20000), mfs.Duration);
            Assert.IsFalse(mfs.VisibleRegion.Stop == mfs.Duration);
        }
Example #16
0
        public void TestVisibleRegionSetAfterAddingFirstElement()
        {
            MediaFileSet mfs = new MediaFileSet();

            mfs.Add(new MediaFile {
                FilePath = "/videos/test.mp4",
                Duration = new Time(5000),
            });

            Assert.IsNotNull(mfs.VisibleRegion);
            Assert.AreEqual(new Time(0), mfs.VisibleRegion.Start);
            Assert.AreEqual(new Time(5000), mfs.VisibleRegion.Stop);
        }
Example #17
0
        public void TestMediaFileSetPathModifiedSameReferenceReturnsFalse()
        {
            MediaFileSet mfs = new MediaFileSet();

            mfs.Add(new MediaFile {
                FilePath = "/videos/test.mp4"
            });
            MediaFileSet mfs2 = mfs;

            mfs2 [0].FilePath = "/videos/test2.mp4";

            Assert.IsFalse(mfs2.CheckMediaFilesModified(mfs));
            Assert.AreEqual(mfs [0].FilePath, mfs2 [0].FilePath);
        }
Example #18
0
        public void TestDuration()
        {
            MediaFileSet mf = new MediaFileSet();

            Assert.AreEqual(mf.Duration.MSeconds, 0);
            mf.Add(new MediaFile {
                Duration = new Time(2000), Name = "Test asset"
            });
            Assert.AreEqual(mf.Duration.MSeconds, 2000);
            mf.Replace("Test asset", new MediaFile {
                Duration = new Time(2001), Name = "Test asset 2"
            });
            Assert.AreEqual(mf.Duration.MSeconds, 2001);
        }
Example #19
0
        void AddTimelineEvent(Playlist playlist, int start, int stop, string file)
        {
            MediaFileSet fileset = new MediaFileSet();

            fileset.Add(new MediaFile {
                FilePath = file
            });
            TimelineEvent evt = new TimelineEvent {
                Start   = new Time(start),
                Stop    = new Time(stop),
                FileSet = fileset,
            };

            playlist.Elements.Add(new PlaylistPlayElement(evt));
        }
Example #20
0
        public void TestCheckFiles()
        {
            string       path = Path.GetTempFileName();
            MediaFileSet mf   = new MediaFileSet();

            Assert.IsFalse(mf.CheckFiles());
            mf.Add(new MediaFile {
                FilePath = path, Name = "Test asset"
            });
            try {
                Assert.IsTrue(mf.CheckFiles());
            } finally {
                File.Delete(path);
            }
        }
Example #21
0
        public void TestMediaFileSetPathModifiedDifferentReferenceReturnsTrue()
        {
            MediaFileSet mfs = new MediaFileSet();

            mfs.Add(new MediaFile {
                FilePath = "/videos/test.mp4"
            });

            MediaFileSet mfs2 = mfs.Clone();

            mfs2 [0].FilePath = "/videos/test2.mp4";

            Assert.IsTrue(mfs2.CheckMediaFilesModified(mfs));
            Assert.AreNotEqual(mfs [0].FilePath, mfs2 [0].FilePath);
            Assert.AreEqual(mfs.ID, mfs2.ID);
        }
Example #22
0
        public void TestCheckFilesNonExisting()
        {
            // Arrange file with wrong path
            string       path = Path.GetTempFileName();
            MediaFileSet mf   = new MediaFileSet();

            mf.Add(new MediaFile {
                FilePath = Path.Combine("non-existing-path", Path.GetFileName(path)),
                Name     = "Test asset"
            });
            try {
                // Act & Assert
                Assert.IsFalse(mf.CheckFiles());
            } finally {
                File.Delete(path);
            }
        }
Example #23
0
        public override bool SelectMediaFiles(MediaFileSet fileSet)
        {
            bool ret = false;
            MediaFileSetSelection fileselector = new MediaFileSetSelection(false);

            Gtk.Dialog d = new Gtk.Dialog(Catalog.GetString("Select video files"),
                                          MainWindow.Toplevel as Gtk.Window,
                                          DialogFlags.Modal | DialogFlags.DestroyWithParent,
                                          Gtk.Stock.Cancel, ResponseType.Cancel,
                                          Gtk.Stock.Ok, ResponseType.Ok);
            fileselector.Show();
            fileselector.FileSet = fileSet.Clone();
            d.VBox.Add(fileselector);
            App.Current.Dialogs.WarningMessage(Catalog.GetString("Some video files are missing for this project"));
            while (d.Run() == (int)ResponseType.Ok)
            {
                if (!fileselector.FileSet.CheckFiles())
                {
                    App.Current.Dialogs.WarningMessage(Catalog.GetString("Some video files are still missing for this project."), d);
                    continue;
                }
                if (fileselector.FileSet.Count == 0)
                {
                    App.Current.Dialogs.WarningMessage(Catalog.GetString("You need at least 1 video file for the main angle"));
                    continue;
                }
                ret = true;
                break;
            }
            if (ret)
            {
                // We need to update the fileset as it might have changed. Indeed if multi camera is not supported
                // widget will propose only one media file selector and will return a smaller fileset than the
                // one provided originally.
                fileSet.Clear();
                for (int i = 0; i < fileselector.FileSet.Count; i++)
                {
                    fileSet.Add(fileselector.FileSet [i]);
                }
            }
            d.Destroy();
            return(ret);
        }
Example #24
0
        /// <summary>
        /// Editable FileSet will just clear the set and recreate from the choosers. It will also figure out
        /// if some choosers should be removed or added to allow more files to come in.
        /// </summary>
        void UpdateEditableFileSet()
        {
            bool have_empty_chooser           = false;
            List <MediaFileChooser> to_remove = new List <MediaFileChooser> ();

            fileSet.Clear();

            foreach (MediaFileChooser chooser in fileChoosers)
            {
                if (chooser.MediaFile != null)
                {
                    fileSet.Add(chooser.MediaFile);
                }
                else
                {
                    // Mark for removal as we only want one empty file chooser at most
                    if (fileChoosers.Count > 1)
                    {
                        to_remove.Add(chooser);
                    }
                    else
                    {
                        have_empty_chooser = true;
                    }
                }
            }

            foreach (MediaFileChooser chooser in to_remove)
            {
                chooser.ChangedEvent -= HandleFileChangedEvent;
                fileChoosers.Remove(chooser);
                mfss_vbox.Remove(chooser);
            }

            to_remove.Clear();

            if (!have_empty_chooser && Config.SupportsMultiCamera)
            {
                AddMediaFileChooser(null);
            }
        }
Example #25
0
        public void TestCheckFilesFixPath()
        {
            // Arrange file with wrong path
            string       path         = Path.GetTempFileName();
            string       originalPath = Path.Combine("non-existing-path", Path.GetFileName(path));
            MediaFileSet mf           = new MediaFileSet();

            mf.Add(new MediaFile {
                FilePath = originalPath,
                Name     = "Test asset"
            });
            try {
                // Act
                bool ret = mf.CheckFiles(Path.GetDirectoryName(path));

                // Assert its path is fixed
                Assert.IsTrue(ret);
                Assert.AreEqual(path, mf.First().FilePath);
                Assert.AreNotEqual(originalPath, mf.First().FilePath);
            } finally {
                File.Delete(path);
            }
        }
Example #26
0
        public async Task Replace_FileNotSelected_NothingChanged()
        {
            dialogMock.Setup(d => d.OpenMediaFile(It.IsAny <object> ())).Returns <MediaFile> (null);

            MediaFileSet   fileSet   = new MediaFileSet();
            MediaFileSetVM fileSetVM = new MediaFileSetVM {
                Model = fileSet
            };

            fileSet.Add(new MediaFile {
                FilePath = "old"
            });

            MediaFileVM newFileVM = await App.Current.EventsBroker.PublishWithReturn <ReplaceMediaFileEvent, MediaFileVM> (new ReplaceMediaFileEvent {
                OldFileSet = fileSetVM,
                OldFile    = fileSetVM.ViewModels.First(),
            });

            Assert.IsNotNull(newFileVM);
            Assert.IsNotNull(newFileVM.Model);
            Assert.AreSame(fileSetVM.ViewModels.First(), newFileVM);
            Assert.AreEqual(fileSetVM.ViewModels.First().Model, newFileVM.Model);
            Assert.AreEqual(1, fileSetVM.Count());
        }
        public void TestLoadCameraPlay_WithCameraTlEvent()
        {
            // Arrange
            MediaFileSet mfs2 = new MediaFileSet ();
            mfs2.Add (new MediaFile {
                FilePath = "test1",
                VideoWidth = 320,
                VideoHeight = 240,
                Par = 1,
                Duration = new Time (100)
            });
            LoadCameraEvent lce = new LoadCameraEvent () {
                CameraTlEvent = new TimelineEvent () {
                    FileSet = mfs2,
                    Start = new Time (0),
                    Stop = mfs2.FirstOrDefault ().Duration
                }
            };

            // Action
            App.Current.EventsBroker.Publish<LoadCameraEvent> (lce);

            // Assert
            mockPlayerController.Verify (player => player.UnloadCurrentEvent (), Times.Never ());
            mockPlayerController.Verify (player => player.Seek (It.IsAny<double> ()), Times.Never ());
        }
Example #28
0
 public void TestSerialization()
 {
     MediaFileSet mf = new MediaFileSet ();
     mf.Add (new MediaFile ("path", 34000, 25, true, true, "mp4", "h264",
         "aac", 320, 240, 1.3, null, "Test asset"));
     mf.Add (new MediaFile ("path", 34000, 25, true, true, "mp4", "h264",
         "aac", 320, 240, 1.3, null, "Test asset 2"));
     Utils.CheckSerialization (mf);
 }
Example #29
0
 public void TestPreview()
 {
     MediaFileSet mf = new MediaFileSet ();
     Assert.IsNull (mf.Preview);
     mf.Add (new MediaFile {Preview = Utils.LoadImageFromFile (), Name = "Test asset"});
     Assert.IsNotNull (mf.Preview);
 }
Example #30
0
        public void TestOrderReplace()
        {
            MediaFileSet mf = new MediaFileSet ();

            mf.Add (new MediaFile ("path1", 34000, 25, true, true, "mp4", "h264",
                "aac", 320, 240, 1.3, null, "Test asset") { Offset = new Time (1) });
            mf.Add (new MediaFile ("path2", 34000, 25, true, true, "mp4", "h264",
                "aac", 320, 240, 1.3, null, "Test asset 2") { Offset = new Time (2) });
            mf.Add (new MediaFile ("path3", 34000, 25, true, true, "mp4", "h264",
                "aac", 320, 240, 1.3, null, "Test asset 3") { Offset = new Time (3) });

            Assert.AreEqual (3, mf.Count);
            Assert.AreEqual ("path1", mf [0].FilePath);
            Assert.AreEqual ("path2", mf [1].FilePath);
            Assert.AreEqual ("path3", mf [2].FilePath);

            mf.Replace ("Test asset 2", new MediaFile ("path4", 34000, 25, true, true, "mp4", "h264",
                "aac", 320, 240, 1.3, null, "Test asset 4")  { Offset = new Time (4) });

            Assert.AreEqual (3, mf.Count);
            Assert.AreEqual ("path1", mf [0].FilePath);
            Assert.AreEqual ("path4", mf [1].FilePath);
            Assert.AreEqual ("Test asset 2", mf [1].Name);
            Assert.AreEqual (new Time (2), mf [1].Offset);
            Assert.AreEqual ("path3", mf [2].FilePath);

            mf.Replace (mf [1], new MediaFile ("path5", 34000, 25, true, true, "mp4", "h264",
                "aac", 320, 240, 1.3, null, "Test asset 5") { Offset = new Time (5) });

            Assert.AreEqual (3, mf.Count);
            Assert.AreEqual ("path1", mf [0].FilePath);
            Assert.AreEqual ("path5", mf [1].FilePath);
            Assert.AreEqual ("Test asset 2", mf [1].Name);
            Assert.AreEqual (new Time (2), mf [1].Offset);
            Assert.AreEqual ("path3", mf [2].FilePath);
        }
        void HandleSelectedCameraChanged(object sender, EventArgs args)
        {
            CameraObject camera = camerasTimeline.SelectedCamera;
            if (camera != null) {
                // Check if we need to reopen the player
                if (!secCamPlayerVM.Opened ||
                    secCamPlayerVM.FileSet.FirstOrDefault () != camera.MediaFile) {
                    MediaFileSet fileSet = new MediaFileSet ();
                    fileSet.Add (camera.MediaFile);

                    secCamPlayerVM.OpenFileSet (fileSet);

                    // Configure audio
                    HandleAudioToggled (sec_cam_audio_button, new EventArgs ());
                }
                // And update
                HandleCameraUpdate (camera);
            } else {
                // When no camera is selected show the initial didactic message.
                ShowDidactic (DidacticMessage.Initial);
            }
        }
Example #32
0
        public void FixtureSetup()
        {
            playerMock = new Mock<IPlayer> ();
            playerMock.SetupAllProperties ();
            /* Mock properties without setter */
            playerMock.Setup (p => p.CurrentTime).Returns (() => currentTime);
            playerMock.Setup (p => p.StreamLength).Returns (() => streamLength);
            playerMock.Setup (p => p.Play ()).Raises (p => p.StateChange += null, this, true);
            playerMock.Setup (p => p.Pause ()).Raises (p => p.StateChange += null, this, false);

            mtkMock = new Mock<IMultimediaToolkit> ();
            mtkMock.Setup (m => m.GetPlayer ()).Returns (playerMock.Object);
            mtkMock.Setup (m => m.GetMultiPlayer ()).Throws (new Exception ());
            Config.MultimediaToolkit = mtkMock.Object;

            var ftk = new Mock<IGUIToolkit> ();
            ftk.Setup (m => m.Invoke (It.IsAny<EventHandler> ())).Callback<EventHandler> (e => e (null, null));
            Config.GUIToolkit = ftk.Object;

            Config.EventsBroker = new EventsBroker ();

            mfs = new MediaFileSet ();
            mfs.Add (new MediaFile { FilePath = "test1", VideoWidth = 320, VideoHeight = 240, Par = 1 });
            mfs.Add (new MediaFile { FilePath = "test2", VideoWidth = 320, VideoHeight = 240, Par = 1 });

            evt = new TimelineEvent { Start = new Time (100), Stop = new Time (200),
                CamerasConfig = new List<CameraConfig> { new CameraConfig (0) }
            };
            plImage = new PlaylistImage (Utils.LoadImageFromFile (), new Time (5));
            playlist = new Playlist ();
            playlist.Elements.Add (new PlaylistPlayElement (evt));
            playlist.Elements.Add (plImage);
        }