コード例 #1
0
        public void AddAndRemoveHandler()
        {
            bool eventTriggered = false;

            using (ITimeline timeline = new DefaultTimeline())
            {
                IGroup audioGroup = timeline.AddAudioGroup();
                ITrack track      = audioGroup.AddTrack();
                track.AddClip("testinput.mp3", GroupMediaType.Audio, InsertPosition.Absoloute, 0, 0, -1);

                using (NullRenderer renderer = new NullRenderer(timeline))
                {
                    EventHandler handler = new EventHandler(delegate
                    {
                        eventTriggered = true;
                    });

                    renderer.RenderCompleted += handler;
                    renderer.RenderCompleted -= handler;

                    renderer.BeginRender(null, null);
                    renderer.Cancel();

                    Assert.IsFalse(eventTriggered);
                }
            }
        }
コード例 #2
0
        public void CancelBeforeStart()
        {
            using (ITimeline timeline = new DefaultTimeline())
            {
                IGroup audioGroup = timeline.AddAudioGroup();
                ITrack track = audioGroup.AddTrack();
                track.AddClip("testinput.mp3", GroupMediaType.Audio, InsertPosition.Absolute, 0, 0, -1);

                using (var renderer = new NullRenderer(timeline))
                {
                    renderer.Cancel();
                }
            }
        }
コード例 #3
0
        public void CancelBeforeStart()
        {
            using (ITimeline timeline = new DefaultTimeline())
            {
                IGroup audioGroup = timeline.AddAudioGroup();
                ITrack track      = audioGroup.AddTrack();
                track.AddClip("..\\..\\testinput.mp3", GroupMediaType.Audio, InsertPosition.Absolute, 0, 0, -1);

                using (var renderer = new NullRenderer(timeline))
                {
                    renderer.Cancel();
                }
            }
        }
コード例 #4
0
        public void CancelRender()
        {
            bool eventTriggered = false;

            using (ITimeline timeline = new DefaultTimeline())
            {
                IGroup audioGroup = timeline.AddAudioGroup();
                ITrack track      = audioGroup.AddTrack();
                track.AddClip("..\\..\\testinput.mp3", GroupMediaType.Audio, InsertPosition.Absolute, 0, 0, -1);

                using (var renderer = new NullRenderer(timeline))
                {
                    renderer.RenderCompleted += delegate { eventTriggered = true; };

                    renderer.BeginRender(null, null);
                    renderer.Cancel();

                    Assert.AreEqual(RendererState.Canceled, renderer.State);
                    Assert.IsTrue(eventTriggered);
                }
            }
        }
コード例 #5
0
        public void AddAndRemoveHandler()
        {
            bool eventTriggered = false;

            using (ITimeline timeline = new DefaultTimeline())
            {
                IGroup audioGroup = timeline.AddAudioGroup();
                ITrack track = audioGroup.AddTrack();
                track.AddClip("testinput.mp3", GroupMediaType.Audio, InsertPosition.Absolute, 0, 0, -1);

                using (var renderer = new NullRenderer(timeline))
                {
                    EventHandler handler = delegate { eventTriggered = true; };

                    renderer.RenderCompleted += handler;
                    renderer.RenderCompleted -= handler;

                    renderer.BeginRender(null, null);
                    renderer.Cancel();

                    Assert.IsFalse(eventTriggered);
                }
            }
        }
コード例 #6
0
        public void CancelRender()
        {
            bool eventTriggered = false;

            using (ITimeline timeline = new DefaultTimeline())
            {
                IGroup audioGroup = timeline.AddAudioGroup();
                ITrack track = audioGroup.AddTrack();
                track.AddClip("testinput.mp3", GroupMediaType.Audio, InsertPosition.Absolute, 0, 0, -1);

                using (var renderer = new NullRenderer(timeline))
                {
                    renderer.RenderCompleted += delegate { eventTriggered = true; };

                    renderer.BeginRender(null, null);
                    renderer.Cancel();

                    Assert.AreEqual(RendererState.Canceled, renderer.State);
                    Assert.IsTrue(eventTriggered);
                }
            }
        }