示例#1
0
        public static void MyClassInitialize(TestContext testContext)
        {
            PSNR testMSE = new PSNR();
            refBitmap = new Bitmap(100, 100);
            for (int height = 0; height < refBitmap.Height; height++)
            {
                for (int width = 0; width < refBitmap.Width; width++)
                {
                    refBitmap.SetPixel(width, height, Color.White);
                    width++;
                    refBitmap.SetPixel(width, height, Color.Black);
                    width++;
                    refBitmap.SetPixel(width, height, Color.Red);
                    width++;
                    refBitmap.SetPixel(width, height, Color.Green);
                    width++;
                    refBitmap.SetPixel(width, height, Color.Blue);
                }
            }

            procBitmap = new Bitmap(100, 100);
            for (int width = 0; width < refBitmap.Width; width++)
            {
                for (int height = 0; height < procBitmap.Height; height++)
                {
                    procBitmap.SetPixel(width, height, Color.White);
                    height++;
                    procBitmap.SetPixel(width, height, Color.Black);
                    height++;
                    procBitmap.SetPixel(width, height, Color.Red);
                    height++;
                    procBitmap.SetPixel(width, height, Color.Green);
                    height++;
                    procBitmap.SetPixel(width, height, Color.Blue);
                }
            }
            analysisInfo = testMSE.analyse(refBitmap, procBitmap);
            analysedBitmap = analysisInfo.frame;
        }
示例#2
0
 public void typeTest()
 {
     PSNR target = new PSNR();
     PluginType expected = PluginType.IMetricOqat;
     PluginType actual;
     target.type = expected;
     actual = target.type;
     Assert.AreEqual(expected, actual);
 }
示例#3
0
 public void PSNRConstructorTest()
 {
     PSNR target = new PSNR();
     Assert.IsTrue(target is PSNR, "The returned object is not a valid PSNR instance.");
 }
示例#4
0
 public void propertyViewTest()
 {
     PSNR target = new PSNR();
     UserControl actual;
     actual = target.propertyView;
 }
示例#5
0
 public void namePluginTest()
 {
     PSNR target = new PSNR();
     string expected = "PSNR";
     string actual;
     target.namePlugin = expected;
     actual = target.namePlugin;
     Assert.AreEqual(expected, actual);
 }
示例#6
0
 public void getMementoTest()
 {
     PSNR target = new PSNR();
     Memento expected = new Memento("testMemento", target);
     Memento actual;
     actual = target.getMemento();
     Assert.AreEqual(expected.state, actual.state);
 }
示例#7
0
        public void analyseTest()
        {
            PSNR target = new PSNR();
            Bitmap frameRef = refBitmap;
            Bitmap frameProc = procBitmap;
            AnalysisInfo expected = analysisInfo;
            AnalysisInfo actual;
            actual = target.analyse(frameRef, frameProc);

            //Check every Pixel
            for (int height = 0; height < expected.frame.Height; height++)
            {
                for (int width = 0; width < expected.frame.Width; width++)
                {
                    Assert.AreEqual(expected.frame.GetPixel(height, width), actual.frame.GetPixel(height, width), "Analyse is working randomly");
                }
            }
            //Check Values
            for (int floats = 0; floats < expected.values.GetLength(0); floats++)
            {
                Assert.AreEqual(expected.values[floats], actual.values[floats]);
            }
        }