예제 #1
0
 public void flushWriterTest()
 {
     YuvVideoHandler yvh = new YuvVideoHandler();
     YuvVideoInfo info = new YuvVideoInfo(readPath);
     info.width = 352;
     info.height = 240;
     info.yuvFormat = YuvFormat.YUV420_IYUV;
     yvh.setReadContext(readPath, info); // write context cannot be set without a valid read context
     writePath = sampleVideosPath + "\\americanFootball_352x240_125_Copy.yuv";
     YuvVideoInfo writeinfo = new YuvVideoInfo();
     writeinfo.path = writePath;
     writeinfo.width = 352;
     writeinfo.height = 240;
     writeinfo.yuvFormat = YuvFormat.YUV420_IYUV;
     yvh.setWriteContext(writePath, writeinfo);
     int oldFrameByteSize = yvh.frameByteSize;
     yvh.flushWriter();
     Assert.AreEqual(oldFrameByteSize, yvh.frameByteSize);
     Assert.AreEqual(0, yvh.positionReader);
     System.Drawing.Bitmap testframe = yvh.getFrame();
     System.Drawing.Bitmap[] frames = new System.Drawing.Bitmap[1];
     frames[0] = testframe;
     yvh.writeFrames(4, frames);
     yvh.flushWriter();
     yvh.writeFrames(4, frames);
 }
예제 #2
0
        public void readContextTest()
        {
            YuvVideoHandler yvh = new YuvVideoHandler();
            Assert.AreEqual("yuvVideoHandler", yvh.namePlugin);
            Assert.AreEqual(PluginType.IVideoHandler, yvh.type);
            YuvVideoInfo info = new YuvVideoInfo(readPath);
            info.width = 352;
            info.height = 240;
            info.yuvFormat = YuvFormat.YUV420_IYUV;
            yvh.setReadContext(readPath, info);
            Assert.AreEqual(info, yvh.readVidInfo);
            Assert.IsNotNull(yvh.frameByteSize);
            //Assert.IsTrue(yvh.consistent);
            string falsePath = "\\bla_cif.yuv";
            YuvVideoInfo falseInfo = new YuvVideoInfo();
            falseInfo.path = falsePath;
            try
            {
                yvh.setReadContext(falsePath, falseInfo);
                Assert.Fail("no exception thrown");
            }
            catch (Exception)
            {

            }
            try
            {
                yvh.setReadContext(falsePath, info);
                Assert.Fail("no exception thrown");
            }
            catch (Exception)
            {

            }
            try
            {
                yvh.setReadContext(readPath, falseInfo);
                Assert.Fail("no exception thrown");
            }
            catch (Exception)
            {

            }
        }
예제 #3
0
        public void writeContextTest()
        {
            YuvVideoHandler yvh = new YuvVideoHandler();
            YuvVideoInfo info = new YuvVideoInfo(readPath);
            info.width = 352;
            info.height = 240;
            info.yuvFormat = YuvFormat.YUV420_IYUV;

            yvh.setWriteContext(readPath, info);

            yvh.setReadContext(readPath, info);
            yvh.setWriteContext(readPath, info);
            Assert.AreEqual(info, yvh.writeVidInfo);
            Assert.IsTrue(yvh.consistent);
            string falsePath = "\\bla_cif.yuv";
            YuvVideoInfo falseInfo = new YuvVideoInfo();
            falseInfo.path = falsePath;
            try
            {
                yvh.setWriteContext(falsePath, falseInfo);
                Assert.Fail("no exception thrown");
            }
            catch (Exception )
            {

            }
            try
            {
                yvh.setWriteContext(falsePath, info);
                Assert.Fail("no exception thrown");
            }
            catch (Exception )
            {

            }
            try
            {
                yvh.setWriteContext(readPath, falseInfo);
                Assert.Fail("no exception thrown");
            }
            catch (Exception)
            {

            }
        }
예제 #4
0
파일: VideoTest.cs 프로젝트: PSE-2012/MMWTV
        public void getVideoHandlerTest()
        {
            Thread.Sleep(30000); // pluginmanager needs time for consistency check
            YuvVideoInfo info = new YuvVideoInfo(sampleVideos[2]);
            Video target = new Video(false, sampleVideos[2], info, null);
            IVideoHandler expected = new YuvVideoHandler();
            expected.setReadContext(sampleVideos[2], info);
            IVideoHandler actual = target.handler;
            Assert.AreEqual(expected.readPath, actual.readPath);
            Assert.AreEqual(expected.readVidInfo, actual.readVidInfo);
            IVideoHandler extra = target.getExtraHandler();
            Assert.AreEqual(extra.readPath, actual.readPath);
            Assert.AreEqual(extra.readVidInfo, actual.readVidInfo);
            Video target2 = new Video(false, sampleVideos[2], null, null);
            IVideoHandler actual2 = target2.handler;
            string falsePath
                = "D:\\Documents and Settings\\fenix1\\OQAT\\Implementierung\\OQAT_Tests\\TestData\\sampleVideos\\about.txt";
            Video fakeVideo = new Video(false, falsePath, null, null);
            try
            {
                IVideoHandler noHandler = fakeVideo.handler;
                Assert.Fail("no exception thrown");
            }
            catch (Exception)
            {

            }
        }