コード例 #1
0
ファイル: GreyscaleTest.cs プロジェクト: PSE-2012/MMWTV
        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);
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: PSE-2012/MMWTV
        public MainWindow()
        {
            InitializeComponent();

            otto = new Greyscale();
            otto.setParentControll(grid1);
        }
コード例 #3
0
ファイル: GreyscaleTest.cs プロジェクト: PSE-2012/MMWTV
 public void getMementoTest()
 {
     Greyscale target = new Greyscale();
     Memento expected = original;
     Memento actual;
     actual = target.getMemento();
     double[] expectedColor = (double[])expected.state;
     double[] actualColor = (double[])actual.state;
     for (int colorValue = 0; colorValue < expectedColor.GetLength(0); colorValue++)
     {
         Assert.AreEqual(expectedColor[colorValue], actualColor[colorValue], "");
     }
     Assert.AreEqual(expected.name, actual.name);
 }
コード例 #4
0
ファイル: GreyscaleTest.cs プロジェクト: PSE-2012/MMWTV
 public void typeTest()
 {
     Greyscale target = new Greyscale();
     PluginType expected = PluginType.IFilterOqat;
     PluginType actual;
     target.type = expected;
     actual = target.type;
     Assert.AreEqual(expected, actual);
 }
コード例 #5
0
ファイル: GreyscaleTest.cs プロジェクト: PSE-2012/MMWTV
 public void setMementoTest()
 {
     Greyscale target = new Greyscale();
     Memento memento = fullGrey;
     target.setMemento(memento);
     double[] expectedColorValues = (double[])target.getMemento().state;
     for (int colorValue = 0; colorValue < expectedColorValues.GetLength(0); colorValue++)
     {
         Assert.AreEqual(expectedColorValues[colorValue], 1, "Setting the Memento did not work. ");
     }
 }
コード例 #6
0
ファイル: GreyscaleTest.cs プロジェクト: PSE-2012/MMWTV
 public void propertyViewTest()
 {
     Greyscale target = new Greyscale();
     UserControl actual;
     actual = target.propertyView;
 }
コード例 #7
0
ファイル: GreyscaleTest.cs プロジェクト: PSE-2012/MMWTV
 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. ");
         }
     }
 }
コード例 #8
0
ファイル: GreyscaleTest.cs プロジェクト: PSE-2012/MMWTV
 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. ");
         }
     }
 }
コード例 #9
0
ファイル: GreyscaleTest.cs プロジェクト: PSE-2012/MMWTV
 public void namePluginTest()
 {
     Greyscale target = new Greyscale();
     string expected = "Greyscale";
     string actual;
     target.namePlugin = expected;
     actual = target.namePlugin;
     Assert.AreEqual(expected, actual);
 }
コード例 #10
0
ファイル: GreyscaleTest.cs プロジェクト: PSE-2012/MMWTV
 public void localTest()
 {
     Greyscale target = new Greyscale();
     string s = "test";
     target.local(s);
 }
コード例 #11
0
ファイル: GreyscaleTest.cs プロジェクト: PSE-2012/MMWTV
 public void GreyscaleConstructorTest()
 {
     Greyscale target = new Greyscale();
     Assert.IsTrue(target is Greyscale, "The returned object is not a valid Convolution instance.");
 }