CancelAllJobs() public method

public CancelAllJobs ( ) : void
return void
コード例 #1
0
        public void TestRenderedCamera()
        {
            Project p = Utils.CreateProject ();

            try {
                TimelineEvent evt = p.Timeline [0];
                evt.CamerasConfig = new List<CameraConfig> { new CameraConfig (0) };
                PlaylistPlayElement element = new PlaylistPlayElement (evt, p.Description.FileSet);

                // Playlist with one event
                var playlist = new Playlist ();
                playlist.Elements.Add (element);

                // Create a job
                const string outputFile = "path";
                EncodingSettings settings = new EncodingSettings (VideoStandards.P720, EncodingProfiles.MP4, EncodingQualities.Medium,
                                                25, 1, outputFile, true, true, 20);
                EditionJob job = new EditionJob (playlist, settings);

                // Mock IMultimediaToolkit and video editor
                var mtk = Mock.Of<IMultimediaToolkit> (m => m.GetVideoEditor () == Mock.Of<IVideoEditor> ());
                // and guitoolkit
                var gtk = Mock.Of<IGUIToolkit> (g => g.RenderingStateBar == Mock.Of<IRenderingStateBar> ());
                // and a video editor
                Mock<IVideoEditor> mock = Mock.Get<IVideoEditor> (mtk.GetVideoEditor ());
                // And eventbroker
                Config.EventsBroker = Mock.Of<EventsBroker> ();

                // Create a rendering object with mocked interfaces
                RenderingJobsManager renderer = new RenderingJobsManager (mtk, gtk);
                // Start service
                renderer.Start ();

                renderer.AddJob (job);

                // Check that AddSegment is called with the right video file.
                mock.Verify (m => m.AddSegment (p.Description.FileSet [0].FilePath,
                    evt.Start.MSeconds, evt.Stop.MSeconds, evt.Rate, evt.Name, true, new Area ()), Times.Once ());

                /* Test with a camera index bigger than the total cameras */
                renderer.CancelAllJobs ();
                mock.ResetCalls ();
                evt = p.Timeline [1];
                evt.CamerasConfig = new List<CameraConfig> { new CameraConfig (1) };
                element = new PlaylistPlayElement (evt, p.Description.FileSet);
                playlist.Elements [0] = element;
                job = new EditionJob (playlist, settings);
                renderer.AddJob (job);
                mock.Verify (m => m.AddSegment (p.Description.FileSet [1].FilePath,
                    evt.Start.MSeconds, evt.Stop.MSeconds, evt.Rate, evt.Name, true, new Area ()), Times.Once ());

                /* Test with the secondary camera */
                renderer.CancelAllJobs ();
                mock.ResetCalls ();
                evt = p.Timeline [1];
                evt.CamerasConfig = new List<CameraConfig> { new CameraConfig (2) };
                element = new PlaylistPlayElement (evt, p.Description.FileSet);
                playlist.Elements [0] = element;
                job = new EditionJob (playlist, settings);
                renderer.AddJob (job);
                mock.Verify (m => m.AddSegment (p.Description.FileSet [0].FilePath,
                    evt.Start.MSeconds, evt.Stop.MSeconds, evt.Rate, evt.Name, true, new Area ()), Times.Once ());
            } finally {
                Utils.DeleteProject (p);
            }
        }