public void remove_lastTest() { PixelState target = PixelState.getInstance(); Bitmap b = new Bitmap(10, 10); Image img = (Image)b; ImageObject imgObj1 = new ImageObject(img, ImageManipulatorType.Name.INVERT); ImageObject imgObj2 = new ImageObject(img, ImageManipulatorType.Name.GRAYSCALE); ImageObject imgObj3 = new ImageObject(img, ImageManipulatorType.Name.RGB_RED); target.reset(); target.add(imgObj3); target.add(imgObj2); target.add(imgObj1); I_ImageObject img_last = target.remove_last(); Assert.AreEqual(img_last.get_ImageManipulatorType(), imgObj1.get_ImageManipulatorType()); img_last = target.remove_last(); Assert.AreEqual(img_last.get_ImageManipulatorType(), imgObj2.get_ImageManipulatorType()); img_last = target.remove_last(); Assert.AreEqual(img_last.get_ImageManipulatorType(), imgObj3.get_ImageManipulatorType()); img_last = target.remove_last(); Assert.IsNotNull(img_last); }
public void undoTest() { ManipulationController t = ManipulationController.getInstance(); PrivateObject param0 = new PrivateObject(t); Controller_Accessor target = new Controller_Accessor(param0); PixelState p = PixelState.getInstance(); Bitmap b = new Bitmap(10, 10); Image img = (Image)b; ImageObject imgObj = new ImageObject(img, ImageManipulatorType.Name.GRAYSCALE); PictureBox pictureBox1 = new PictureBox(); pictureBox1.Image = img; target.setPictureBox(pictureBox1); Bitmap c = new Bitmap(13, 14); Image img2 = (Image)c; ImageObject imgObj2 = new ImageObject(img, ImageManipulatorType.Name.GRAYSCALE); p.add(imgObj2); target.undo(); Image i1 = imgObj2.get_Image(); Image i2 = Controller_Accessor.pic.Image; // Erwartet:<System.Drawing.Bitmap>. Tatsächlich:<System.Drawing.Bitmap> . Assert.AreEqual(i1, i2, "Das System wirft einen Fehler weil er bekommt was er erwartet. ALLES KLAAR!!! :("); }
public void addTest() { PixelState target = PixelState.getInstance(); Bitmap b = new Bitmap(10, 10); Image img = (Image)b; ImageObject imgObj = new ImageObject(img, ImageManipulatorType.Name.GRAYSCALE); I_ImageObject imgObj2 = target.get_last(); Assert.IsNotNull(imgObj2); target.add(imgObj); imgObj2 = target.get_last(); Assert.IsInstanceOfType(imgObj2, typeof(I_ImageObject)); Assert.IsNotNull(imgObj2); }