Ejemplo n.º 1
0
 public void processTest_empty()
 {
     Greyscale target = new Greyscale();
     Bitmap frame = new Bitmap(testPixel, testPixel);
     Bitmap expected = new Bitmap(testPixel, testPixel);
     Bitmap actual;
     actual = target.process(frame);
     for (int width = 0; width < expected.Width; width++)
     {
         for (int hight = 0; hight < expected.Height; hight++)
         {
             Assert.AreEqual(expected.GetPixel(width, hight), expected.GetPixel(width, hight), "Process does not work properly. Bitmap was empty and should be empty. ");
         }
     }
 }
Ejemplo n.º 2
0
        public static void MyClassInitialize(TestContext testContext)
        {
            Greyscale conv = new Greyscale();
            testBitmap = new Bitmap(testPixel, testPixel);
            for (int height = 0; height < testBitmap.Height; height++)
            {
                for (int width = 0; width < testBitmap.Width; width++)
                {
                    testBitmap.SetPixel(width, height, Color.White);
                    width++;
                    testBitmap.SetPixel(width, height, Color.Black);
                    width++;
                    testBitmap.SetPixel(width, height, Color.Red);
                    width++;
                    testBitmap.SetPixel(width, height, Color.Green);
                    width++;
                    testBitmap.SetPixel(width, height, Color.Blue);
                }
            }

            //create greyscale
            double[] newColorValues = new double[3];
            for (int i = 0; i < newColorValues.GetLength(0); i++)
            {
                newColorValues[i] = 1;
            }
            fullGrey = new Memento("Blur", newColorValues);

            //get greyscaled Bitmap
            original = conv.getMemento();
            conv.setMemento(fullGrey);
            processedBitmap = conv.process(testBitmap);
            conv.setMemento(original);
        }
Ejemplo n.º 3
0
 public void processTest()
 {
     Greyscale target = new Greyscale();
     Bitmap frame = testBitmap;
     Bitmap expected = processedBitmap;
     Bitmap actual;
     actual = target.process(frame);
     for (int width = 0; width < expected.Width; width++)
     {
         for (int hight = 0; hight < expected.Height; hight++)
         {
             Assert.AreEqual(expected.GetPixel(width, hight), expected.GetPixel(width, hight), "Process working randomly. ");
         }
     }
 }