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);
        }
 public void try_save_PixelStateTest()
 {
     ThreadHandler t = new ThreadHandler(2);
     PrivateObject param0 = new PrivateObject(t);
     ThreadHandler_Accessor target = new ThreadHandler_Accessor(param0); // TODO: Passenden Wert initialisieren
     Bitmap b = new Bitmap(10, 10);
     Image img = (Image)b;
     ImageManipulatorType.Name manipulator = ImageManipulatorType.Name.RGB_RED; // TODO: Passenden Wert initialisieren
     ImageObject imgO = new ImageObject(img, manipulator);
     target.try_save_PixelState(imgO);
     PixelState state = PixelState.getInstance();
     Assert.IsInstanceOfType(state.get_last(), typeof(ImageObject));
     Assert.IsNotNull(state.get_last());
 }
 public void save_PixelStateTest()
 {
     int threads = 0; // TODO: Passenden Wert initialisieren
     ThreadHandler target = new ThreadHandler(threads); // TODO: Passenden Wert initialisieren
     Bitmap b = new Bitmap(10, 10);
     Image img = (Image)b;
     ImageManipulatorType.Name manipulator = ImageManipulatorType.Name.RGB_RED; // TODO: Passenden Wert initialisieren
     ImageObject imgO = new ImageObject(img, manipulator);
     target.save_PixelState(imgO);
     PixelState state = PixelState.getInstance();
     Assert.IsInstanceOfType(state, typeof(PixelState));
 }
        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 get_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.add(imgObj3);
            target.add(imgObj2);
            target.add(imgObj1);

            I_ImageObject img_last = target.get_last();

            Assert.AreEqual(img_last.get_ImageManipulatorType(), imgObj1.get_ImageManipulatorType());

            target.add(imgObj3);
            img_last = target.get_last();
            Assert.AreEqual(img_last.get_ImageManipulatorType(), imgObj3.get_ImageManipulatorType());
        }
 /**
  * Funktion zum speichern von veränderten Bildern (Zwischenschritten)
  *
  */
 public void save_PixelState( ImageObject imgObj )
 {
     Thread t = new Thread(() => this.try_save_PixelState(imgObj));
     t.Name = "bg_PixelState_thread";
     t.Start();
 }
 private void try_save_PixelState(ImageObject imgObj)
 {
     // solange noch nicht alle Threads beendet wurden -> warten
     while (this.threadsAreAlive())
     {
         // bg_filter_thread
         Thread.Sleep(2);
     }
         // PixelState Objekt besorgen
     PixelState state = PixelState.getInstance();
         // ab hier Thread sicher speichern
     lock (_locker)
     {
         state.add(imgObj);
     }
 }