コード例 #1
0
        public void VideoSourceTest()
        {
            var vst = new TestVideoSource();

            Assert.IsFalse(vst.IsStarted);
            vst.StartInternalReturnValue = false;
            vst.IsStartInternalCalled    = false;
            vst.Start();
            Assert.IsFalse(vst.IsStarted);
            Assert.IsTrue(vst.IsStartInternalCalled);

            vst.StartInternalReturnValue = true;
            vst.IsStartInternalCalled    = false;
            vst.Start();
            Assert.IsTrue(vst.IsStarted);
            Assert.IsTrue(vst.IsStartInternalCalled);

            vst.IsStopInternalCalled = false;
            vst.Stop();
            Assert.IsFalse(vst.IsStarted);
            Assert.IsTrue(vst.IsStopInternalCalled);

            Assert.AreNotEqual(vst.SupportedResolution[1], vst.VideoResolution);
            vst.VideoResolution = vst.SupportedResolution[1];
            Assert.AreEqual(vst.SupportedResolution[1], vst.VideoResolution);

            Assert.AreNotEqual(vst.SupportedFps[1], vst.FramesPerSecond);
            vst.FramesPerSecond = vst.SupportedFps[1];
            Assert.AreEqual(vst.SupportedFps[1], vst.FramesPerSecond);

            var name = "name123";

            Assert.AreNotEqual(name, vst.Name);
            vst.Name = name;
            Assert.AreEqual(name, vst.Name);

            vst.NewFrame  += Vst_NewFrame;
            FrameEventArgs = null;
            Assert.IsNull(FrameEventArgs);
            var frame = new VideoFrame(DateTime.Now, new byte[] { 1, 2, 3 }, Resolution.Resolution1MP, FrameFormat.Argb32);

            vst.SendNewFrame(frame);
            Assert.AreEqual(frame, FrameEventArgs?.Frame);
            frame.Dispose();

            Assert.IsFalse(vst.IsDisposed);
            vst.Dispose();
            Assert.IsTrue(vst.IsDisposed);
        }
コード例 #2
0
        public void FpsExceptionTest()
        {
            var vst = new TestVideoSource();

            vst.FramesPerSecond = 1000;
        }
コード例 #3
0
        public void NewResolutionNullExceptionTest()
        {
            var vst = new TestVideoSource();

            vst.VideoResolution = null;
        }
コード例 #4
0
        public void ResolutionExceptionTest()
        {
            var vst = new TestVideoSource();

            vst.VideoResolution = Resolution.Resolution1080p;
        }