public void TestMultiplayerCamerasConfig() { TimelineEvent evt1; List<CameraConfig> cams1, cams2; Mock<IMultiPlayer> multiplayerMock = new Mock<IMultiPlayer> (); mtkMock.Setup (m => m.GetMultiPlayer ()).Returns (multiplayerMock.Object); player = new PlayerController (true); PreparePlayer (); /* Only called internally in the openning */ cams1 = new List<CameraConfig> { new CameraConfig (0), new CameraConfig (1) }; cams2 = new List<CameraConfig> { new CameraConfig (1), new CameraConfig (0) }; multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Never ()); Assert.AreEqual (cams1, player.CamerasConfig); player.CamerasConfig = cams2; multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Once ()); Assert.AreEqual (cams2, player.CamerasConfig); multiplayerMock.ResetCalls (); /* Now load an event */ evt1 = new TimelineEvent { Start = new Time (100), Stop = new Time (200), CamerasConfig = new List<CameraConfig> { new CameraConfig (1), new CameraConfig (1) } }; player.LoadEvent (mfs, evt1, evt1.Start, true); multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Once ()); Assert.AreEqual (evt1.CamerasConfig, player.CamerasConfig); multiplayerMock.ResetCalls (); /* Change event cams config */ player.CamerasConfig = new List<CameraConfig> { new CameraConfig (0), new CameraConfig (0) }; multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Once ()); Assert.AreEqual (new List<CameraConfig> { new CameraConfig (0), new CameraConfig (0) }, evt1.CamerasConfig); Assert.AreEqual (player.CamerasConfig, evt1.CamerasConfig); multiplayerMock.ResetCalls (); /* Unload and check the original cams config is set back*/ player.UnloadCurrentEvent (); multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Once ()); Assert.AreEqual (cams2, player.CamerasConfig); Assert.AreEqual (new List<CameraConfig> { new CameraConfig (0), new CameraConfig (0) }, evt1.CamerasConfig); multiplayerMock.ResetCalls (); /* And changing the config does not affects the unloaded event */ player.CamerasConfig = cams1; multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Once ()); Assert.AreEqual (new List<CameraConfig> { new CameraConfig (0), new CameraConfig (0) }, evt1.CamerasConfig); multiplayerMock.ResetCalls (); /* Now load a playlist video */ PlaylistVideo plv = new PlaylistVideo (mfs [0]); player.LoadPlaylistEvent (playlist, plv); multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Never ()); Assert.AreEqual (new List<CameraConfig> { new CameraConfig (0) }, player.CamerasConfig); multiplayerMock.ResetCalls (); player.UnloadCurrentEvent (); /* Called by Open internally () */ multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Never ()); Assert.AreEqual (cams2, player.CamerasConfig); multiplayerMock.ResetCalls (); /* Now load a playlist event and make sure its config is loaded * and not the event's one */ PlaylistPlayElement ple = new PlaylistPlayElement (evt, mfs); ple.CamerasConfig = cams2; player.LoadPlaylistEvent (playlist, ple); multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Once ()); Assert.AreEqual (cams2, player.CamerasConfig); multiplayerMock.ResetCalls (); }
void ProcessVideo(PlaylistVideo video) { Log.Debug ("Adding external video " + video.File.FilePath); videoEditor.AddSegment (video.File.FilePath, 0, video.File.Duration.MSeconds, 1, "", video.File.HasAudio, new Area ()); }
public void TestLoadPlaylistEvent() { int elementLoaded = 0; MediaFileSet nfs; PlaylistPlayElement el1; player.ElementLoadedEvent += (element, hasNext) => { if (element != null) { elementLoaded++; } }; PreparePlayer (); /* Load playlist timeline event element */ nfs = Cloner.Clone (mfs); el1 = playlist.Elements [0] as PlaylistPlayElement; el1.FileSet = nfs; currentTime = el1.Play.Start; player.LoadPlaylistEvent (playlist, el1); Assert.AreEqual (1, elementLoaded); elementLoaded = 0; Assert.AreEqual (el1.CamerasConfig, player.CamerasConfig); Assert.AreEqual (el1.CamerasLayout, player.CamerasLayout); playerMock.Verify (p => p.Open (nfs [0]), Times.Once ()); playerMock.Verify (p => p.Seek (el1.Play.Start, true, false), Times.Never ()); playerMock.Verify (p => p.Play (), Times.Never ()); playerMock.VerifySet (p => p.Rate = 1); playerMock.Raise (p => p.ReadyToSeek += null, this); playerMock.Verify (p => p.Seek (el1.Play.Start, true, false), Times.Once ()); playerMock.Verify (p => p.Play (), Times.Once ()); /* Load still image */ player.LoadPlaylistEvent (playlist, plImage); playerMock.ResetCalls (); player.Pause (); playerMock.Verify (p => p.Pause (), Times.Never ()); Assert.IsFalse (player.Playing); player.Play (); playerMock.Verify (p => p.Play (), Times.Never ()); Assert.IsTrue (player.Playing); /* Load drawings */ PlaylistDrawing dr = new PlaylistDrawing (new FrameDrawing ()); player.LoadPlaylistEvent (playlist, dr); playerMock.ResetCalls (); player.Pause (); playerMock.Verify (p => p.Pause (), Times.Never ()); Assert.IsFalse (player.Playing); player.Play (); playerMock.Verify (p => p.Play (), Times.Never ()); Assert.IsTrue (player.Playing); /* Load video */ PlaylistVideo vid = new PlaylistVideo (mfs [0]); player.LoadPlaylistEvent (playlist, vid); Assert.AreNotEqual (mfs, player.FileSet); Assert.IsTrue (player.Playing); Assert.AreEqual (new List<CameraConfig> { new CameraConfig (0) }, player.CamerasConfig); }
void AddVideo(Playlist playlist, IPlaylistElement element, bool prepend, TreeIter parent) { MediaFile file = LongoMatch.Gui.Helpers.Misc.OpenFile (this); if (file != null) { PlaylistVideo video = new PlaylistVideo (file); int index = playlist.Elements.IndexOf (element); if (!prepend) { index++; } playlist.Elements.Insert (index, video); (Model as TreeStore).InsertWithValues (parent, index, video); } }