public static void MyClassInitialize(TestContext testContext) { RelativeColor relCol = new RelativeColor(); 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] = 2; } doubleColor = new Memento("2xColor", newColorValues); //get greyscaled Bitmap original = relCol.getMemento(); relCol.setMemento(doubleColor); processedBitmap = relCol.process(testBitmap); relCol.setMemento(original); }
public MainWindow() { InitializeComponent(); otto = new RelativeColor(); otto.setParentControll(grid1); }
public void getMementoTest() { RelativeColor target = new RelativeColor(); Memento expected = original; Memento actual; actual = target.getMemento(); double[] expectedColorValues = (double[])expected.state; double[] actualColorValues = (double[])actual.state; for (int color = 0; color < actualColorValues.GetLength(0); color++) { Assert.AreEqual(expectedColorValues[color], actualColorValues[color]); } }
public void setMementoTest() { RelativeColor target = new RelativeColor(); Memento memento = doubleColor; target.setMemento(memento); double[] expectedColorValues = (double[])target.getMemento().state; for (int colorValue = 0; colorValue < expectedColorValues.GetLength(0); colorValue++) { Assert.AreEqual(expectedColorValues[colorValue], 2, "Setting the Memento did not work. "); } }
public void typeTest() { RelativeColor target = new RelativeColor(); PluginType expected = PluginType.IFilterOqat; PluginType actual; target.type = expected; actual = target.type; Assert.AreEqual(expected, actual); }
public void RelativeColorConstructorTest() { RelativeColor target = new RelativeColor(); Assert.IsTrue(target is RelativeColor, "The returned object is not a valid Invert instance."); }
public void propertyViewTest() { RelativeColor target = new RelativeColor(); UserControl actual; actual = target.propertyView; }
public void processTest_empty() { RelativeColor target = new RelativeColor(); 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. "); } } }
public void processTest() { RelativeColor target = new RelativeColor(); 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. "); } } }
public void namePluginTest() { RelativeColor target = new RelativeColor(); string expected = "RelativeColor"; string actual; target.namePlugin = expected; actual = target.namePlugin; Assert.AreEqual(expected, actual); }