// Path: src/main/java/jigspuzzle/JigSPuzzle.java
// public class JigSPuzzle {
// 
//     private static JigSPuzzle instance;
// 
//     public static JigSPuzzle getInstance() {
//         if (instance == null) {
//             instance = new JigSPuzzle();
//         }
//         return instance;
//     }
// 
//     /**
//      * @param args the command line arguments
//      */
//     public static void main(String[] args) {
//         getInstance().startGame();
//     }
// 
//     /**
//      * The main window, in which the user can play
//      */
//     IPuzzleWindow puzzleWindow;
// 
//     /**
//      * The sound player, that can play sounds in the UI.
//      */
//     ISoundPlayer soundPlayer;
// 
//     private JigSPuzzle() {
//         puzzleWindow = new PuzzleWindow();
//         soundPlayer = new SoundPlayer();
//     }
// 
//     /**
//      * Exits the complete program
//      */
//     public void exitProgram() {
//         try {
//             System.exit(0);
//         } catch (Exception ex) {
//             // in the assertJ - tests it is not possible to exit...
//             // instead, we 'reset' this class and the controller.
//             resetInstances();
//         }
//     }
// 
//     /**
//      * Returns the window on that the user can puzzle.
//      *
//      * @return
//      */
//     public IPuzzleWindow getPuzzleWindow() {
//         return puzzleWindow;
//     }
// 
//     /**
//      * Returns the player, that is used for playing sounds on the UI.
//      *
//      * @return
//      */
//     public ISoundPlayer getSoundPlayer() {
//         return soundPlayer;
//     }
// 
//     /**
//      * A methods that resets all instances to null. With this is is simulated,
//      * that the programm has exited. However, opened windows are still there.
//      * Terefore: Use only for tests.
//      *
//      * @deprecated Use only in tests.
//      */
//     public void resetInstances() {
//         instance = null;
//         PuzzleController.getInstance().resetInstance();
//         SettingsController.getInstance().resetInstance();
//         VersionController.getInstance().resetInstance();
//     }
// 
//     /**
//      * Sets the window on that the user can puzzle.
//      *
//      * @param puzzleWindow
//      * @deprecated Use only, in special cases, e.g. tests.
//      */
//     public void setPuzzleWindow(IPuzzleWindow puzzleWindow) {
//         this.puzzleWindow = puzzleWindow;
//     }
// 
//     /**
//      * Starts the game and shows the user the UI.
//      */
//     private void startGame() {
//         puzzleWindow.showPuzzleWindow();
//     }
// }
// 
// Path: src/test/java/jigspuzzle/testutils/mockups/DummyMultiMonitorPuzzleWindow.java
// public class DummyMultiMonitorPuzzleWindow implements IPuzzleWindow {
// 
//     Rectangle[] screens;
// 
//     public DummyMultiMonitorPuzzleWindow(Rectangle[] screens) {
//         this.screens = screens;
//     }
// 
//     @Override
//     public void bringToFront(PuzzlepieceGroup puzzlepieceGroup) {
//     }
// 
//     @Override
//     public void displayFatalError(String message) {
//     }
// 
//     @Override
//     public Rectangle[] getPuzzleareaBounds() {
//         return screens;
//     }
// 
//     @Override
//     public void showPuzzleWindow() {
//     }
// 
//     @Override
//     public void setNewPuzzle(Puzzle puzzle) {
//     }
// 
// }
// 
// Path: src/test/java/jigspuzzle/testutils/mockups/DummyPuzzleWindow.java
// public class DummyPuzzleWindow implements IPuzzleWindow {
// 
//     int puzzleareaWidth;
//     int puzzleareaHeight;
// 
//     public DummyPuzzleWindow() {
//         this(1680, 1050);
//     }
// 
//     public DummyPuzzleWindow(int puzzleareaWidth, int puzzleareaHeight) {
//         this.puzzleareaWidth = puzzleareaWidth;
//         this.puzzleareaHeight = puzzleareaHeight;
//     }
// 
//     @Override
//     public void bringToFront(PuzzlepieceGroup puzzlepieceGroup) {
//     }
// 
//     @Override
//     public void displayFatalError(String message) {
//     }
// 
//     @Override
//     public Rectangle[] getPuzzleareaBounds() {
//         return new Rectangle[]{new Rectangle(0, 0, puzzleareaWidth, puzzleareaHeight)};
//     }
// 
//     @Override
//     public void showPuzzleWindow() {
//     }
// 
//     @Override
//     public void setNewPuzzle(Puzzle puzzle) {
//     }
// 
// }


import java.awt.Color;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.io.File;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import jigspuzzle.JigSPuzzle;
import jigspuzzle.testutils.mockups.DummyMultiMonitorPuzzleWindow;
import jigspuzzle.testutils.mockups.DummyPuzzleWindow;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
        instance.setEnlargePuzzleAutomatically(false);
        instance.setUsedSizeOfPuzzlearea(1);
        int puzzleareaHeight = 1500;
        int puzzleareaWidth = 2000;
        int puzzleHeight = 500;
        int puzzleWidth = 1000;
        int puzzleRows = 2;
        int puzzleColumns = 4;

        JigSPuzzle.getInstance().setPuzzleWindow(new DummyPuzzleWindow(puzzleareaWidth, puzzleareaHeight));
        Dimension result = instance.getPuzzlepieceSize(puzzleHeight, puzzleWidth, puzzleRows, puzzleColumns);
        assertEquals(250, result.height);
        assertEquals(250, result.width);
    }

    @Test
    public void testGetPuzzlepieceSize15() {
        Rectangle[] screens = new Rectangle[3];
        SettingsController instance = SettingsController.getInstance();
        instance.setEnlargePuzzleAutomatically(true);
        instance.setUsedSizeOfPuzzlearea(1);

        int puzzleHeight = 500;
        int puzzleWidth = 1000;
        int puzzleRows = 2;
        int puzzleColumns = 4;
        screens[0] = new Rectangle(-1680, 0, 1680, 1050);
        screens[1] = new Rectangle(0, 0, 2000, 1500);
        screens[2] = new Rectangle(2000, 10, 1680, 1050);

// Path: src/main/java/jigspuzzle/JigSPuzzle.java
// public class JigSPuzzle {
// 
//     private static JigSPuzzle instance;
// 
//     public static JigSPuzzle getInstance() {
//         if (instance == null) {
//             instance = new JigSPuzzle();
//         }
//         return instance;
//     }
// 
//     /**
//      * @param args the command line arguments
//      */
//     public static void main(String[] args) {
//         getInstance().startGame();
//     }
// 
//     /**
//      * The main window, in which the user can play
//      */
//     IPuzzleWindow puzzleWindow;
// 
//     /**
//      * The sound player, that can play sounds in the UI.
//      */
//     ISoundPlayer soundPlayer;
// 
//     private JigSPuzzle() {
//         puzzleWindow = new PuzzleWindow();
//         soundPlayer = new SoundPlayer();
//     }
// 
//     /**
//      * Exits the complete program
//      */
//     public void exitProgram() {
//         try {
//             System.exit(0);
//         } catch (Exception ex) {
//             // in the assertJ - tests it is not possible to exit...
//             // instead, we 'reset' this class and the controller.
//             resetInstances();
//         }
//     }
// 
//     /**
//      * Returns the window on that the user can puzzle.
//      *
//      * @return
//      */
//     public IPuzzleWindow getPuzzleWindow() {
//         return puzzleWindow;
//     }
// 
//     /**
//      * Returns the player, that is used for playing sounds on the UI.
//      *
//      * @return
//      */
//     public ISoundPlayer getSoundPlayer() {
//         return soundPlayer;
//     }
// 
//     /**
//      * A methods that resets all instances to null. With this is is simulated,
//      * that the programm has exited. However, opened windows are still there.
//      * Terefore: Use only for tests.
//      *
//      * @deprecated Use only in tests.
//      */
//     public void resetInstances() {
//         instance = null;
//         PuzzleController.getInstance().resetInstance();
//         SettingsController.getInstance().resetInstance();
//         VersionController.getInstance().resetInstance();
//     }
// 
//     /**
//      * Sets the window on that the user can puzzle.
//      *
//      * @param puzzleWindow
//      * @deprecated Use only, in special cases, e.g. tests.
//      */
//     public void setPuzzleWindow(IPuzzleWindow puzzleWindow) {
//         this.puzzleWindow = puzzleWindow;
//     }
// 
//     /**
//      * Starts the game and shows the user the UI.
//      */
//     private void startGame() {
//         puzzleWindow.showPuzzleWindow();
//     }
// }
// 
// Path: src/test/java/jigspuzzle/testutils/mockups/DummyMultiMonitorPuzzleWindow.java
// public class DummyMultiMonitorPuzzleWindow implements IPuzzleWindow {
// 
//     Rectangle[] screens;
// 
//     public DummyMultiMonitorPuzzleWindow(Rectangle[] screens) {
//         this.screens = screens;
//     }
// 
//     @Override
//     public void bringToFront(PuzzlepieceGroup puzzlepieceGroup) {
//     }
// 
//     @Override
//     public void displayFatalError(String message) {
//     }
// 
//     @Override
//     public Rectangle[] getPuzzleareaBounds() {
//         return screens;
//     }
// 
//     @Override
//     public void showPuzzleWindow() {
//     }
// 
//     @Override
//     public void setNewPuzzle(Puzzle puzzle) {
//     }
// 
// }
// 
// Path: src/test/java/jigspuzzle/testutils/mockups/DummyPuzzleWindow.java
// public class DummyPuzzleWindow implements IPuzzleWindow {
// 
//     int puzzleareaWidth;
//     int puzzleareaHeight;
// 
//     public DummyPuzzleWindow() {
//         this(1680, 1050);
//     }
// 
//     public DummyPuzzleWindow(int puzzleareaWidth, int puzzleareaHeight) {
//         this.puzzleareaWidth = puzzleareaWidth;
//         this.puzzleareaHeight = puzzleareaHeight;
//     }
// 
//     @Override
//     public void bringToFront(PuzzlepieceGroup puzzlepieceGroup) {
//     }
// 
//     @Override
//     public void displayFatalError(String message) {
//     }
// 
//     @Override
//     public Rectangle[] getPuzzleareaBounds() {
//         return new Rectangle[]{new Rectangle(0, 0, puzzleareaWidth, puzzleareaHeight)};
//     }
// 
//     @Override
//     public void showPuzzleWindow() {
//     }
// 
//     @Override
//     public void setNewPuzzle(Puzzle puzzle) {
//     }
// 
// }


// Path: src/test/java/jigspuzzle/controller/SettingsControllerIT.java
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.io.File;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import jigspuzzle.JigSPuzzle;
import jigspuzzle.testutils.mockups.DummyMultiMonitorPuzzleWindow;
import jigspuzzle.testutils.mockups.DummyPuzzleWindow;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

        instance.setEnlargePuzzleAutomatically(false);
        instance.setUsedSizeOfPuzzlearea(1);
        int puzzleareaHeight = 1500;
        int puzzleareaWidth = 2000;
        int puzzleHeight = 500;
        int puzzleWidth = 1000;
        int puzzleRows = 2;
        int puzzleColumns = 4;

        JigSPuzzle.getInstance().setPuzzleWindow(new DummyPuzzleWindow(puzzleareaWidth, puzzleareaHeight));
        Dimension result = instance.getPuzzlepieceSize(puzzleHeight, puzzleWidth, puzzleRows, puzzleColumns);
        assertEquals(250, result.height);
        assertEquals(250, result.width);
    }

    @Test
    public void testGetPuzzlepieceSize15() {
        Rectangle[] screens = new Rectangle[3];
        SettingsController instance = SettingsController.getInstance();
        instance.setEnlargePuzzleAutomatically(true);
        instance.setUsedSizeOfPuzzlearea(1);

        int puzzleHeight = 500;
        int puzzleWidth = 1000;
        int puzzleRows = 2;
        int puzzleColumns = 4;
        screens[0] = new Rectangle(-1680, 0, 1680, 1050);
        screens[1] = new Rectangle(0, 0, 2000, 1500);
        screens[2] = new Rectangle(2000, 10, 1680, 1050);

        JigSPuzzle.getInstance().setPuzzleWindow(new DummyMultiMonitorPuzzleWindow(screens));