Beispiel #1
0
        public static void MyClassInitialize(TestContext testContext)
        {
            MSE testMSE = new MSE();
            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;
        }
Beispiel #2
0
 public void analyseTest_empty()
 {
     MSE target = new MSE();
     Bitmap frameRef = new Bitmap(15, 15);
     Bitmap frameProc = new Bitmap(15, 15);
     AnalysisInfo actual;
     actual = target.analyse(frameRef, frameProc);
     Assert.IsTrue(actual is AnalysisInfo, "analyse can not handle empty Bitmaps.");
 }
Beispiel #3
0
 public void analyseTest_null()
 {
     MSE target = new MSE();
     Bitmap frameRef = null;
     Bitmap frameProc = null;
     AnalysisInfo actual;
     actual = target.analyse(frameRef, frameProc);
     Assert.IsNull(actual, "analyse can not handle null.");
 }
Beispiel #4
0
        public void analyseTest()
        {
            MSE target = new MSE();
            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]);
            }
        }