From 9a898bd4a4a8095f0f6219e966fa15e718d44150 Mon Sep 17 00:00:00 2001 From: fdai7382 Date: Mon, 30 Jan 2023 11:29:50 +0100 Subject: [PATCH 01/13] refactoring: [MouseGame Class]: Auslagern der Breite des Frame-Bounds. --- .../gruppenprojekt/JavaGamelauncher/MouseGame.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java index aeacbb7..34bef8b 100644 --- a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java +++ b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java @@ -23,7 +23,7 @@ public class MouseGame extends JFrame { int resetX = 200; int resetY = 170; - + int breite = 900; /** * Launch the application. @@ -47,7 +47,7 @@ public class MouseGame extends JFrame { //Fensterrahmen Haupt Layout setTitle("Mouse Game"); - setBounds(100, 100, 900, 650); + setBounds(100, 100, breite, 650); robot.mouseMove(resetX, resetY); contentPane = new JPanel(); @@ -133,6 +133,11 @@ public class MouseGame extends JFrame { public int getResetY() { return resetY; } + + + public int getBreite() { + return breite; + } private void reset(JPanel panel) { From 95cffc204ffcaeb007c265b5851289a613a1e05c Mon Sep 17 00:00:00 2001 From: fdai7382 Date: Mon, 30 Jan 2023 11:31:04 +0100 Subject: [PATCH 02/13] refactoring: [MouseGame Class]: Auslagern der Hoehe des Frame-Bounds. --- .../de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java index 34bef8b..7d94087 100644 --- a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java +++ b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java @@ -24,6 +24,7 @@ public class MouseGame extends JFrame { int resetX = 200; int resetY = 170; int breite = 900; + int hoehe = 650; /** * Launch the application. @@ -47,7 +48,7 @@ public class MouseGame extends JFrame { //Fensterrahmen Haupt Layout setTitle("Mouse Game"); - setBounds(100, 100, breite, 650); + setBounds(100, 100, breite, hoehe); robot.mouseMove(resetX, resetY); contentPane = new JPanel(); From 34bee5e69cf9cd6ac7884585172646b6fab88a05 Mon Sep 17 00:00:00 2001 From: fdai7382 Date: Mon, 30 Jan 2023 11:33:59 +0100 Subject: [PATCH 03/13] [MouseGameTest Class]: Test: "boundsHoehePruefen" erstellt. --- .../gruppenprojekt/JavaGamelauncher/MouseGame.java | 5 +++++ .../gruppenprojekt/JavaGamelauncher/MouseGameTest.java | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java index 7d94087..70fc42b 100644 --- a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java +++ b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java @@ -140,6 +140,11 @@ public class MouseGame extends JFrame { return breite; } + + public int getHoehe() { + return hoehe; + } + private void reset(JPanel panel) { panel.addMouseListener(new MouseAdapter() { diff --git a/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java b/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java index 6c1d51a..5a36659 100644 --- a/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java +++ b/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java @@ -56,4 +56,12 @@ public class MouseGameTest { assertTrue(mg.getResetY()==170); } + @Test + public void boundsHoehePruefen() throws AWTException { + //Given + MouseGame mg = new MouseGame(); + + //Then + assertTrue(mg.getHoehe()==650); + } } From b3de6cfde85efc372cc2b6f8705fa8cbf607dc1b Mon Sep 17 00:00:00 2001 From: fdai7382 Date: Mon, 30 Jan 2023 11:34:58 +0100 Subject: [PATCH 04/13] [MouseGameTest Class]: Test: "boundsBreitePruefen" erstellt. --- .../gruppenprojekt/JavaGamelauncher/MouseGameTest.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java b/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java index 5a36659..f2a4bc2 100644 --- a/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java +++ b/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java @@ -56,6 +56,15 @@ public class MouseGameTest { assertTrue(mg.getResetY()==170); } + @Test + public void boundsBreitePruefen() throws AWTException { + //Given + MouseGame mg = new MouseGame(); + + //Then + assertTrue(mg.getBreite()==900); + } + @Test public void boundsHoehePruefen() throws AWTException { //Given From 410bf55b8d9b0bfa0185d91e01f79d244628e605 Mon Sep 17 00:00:00 2001 From: fdai7382 Date: Tue, 31 Jan 2023 09:50:20 +0100 Subject: [PATCH 05/13] refactoring: [MouseGame Class]: Auslagern der Bounds-Variablen des Panels. --- .../JavaGamelauncher/MouseGame.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java index 70fc42b..7405177 100644 --- a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java +++ b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java @@ -23,8 +23,11 @@ public class MouseGame extends JFrame { int resetX = 200; int resetY = 170; - int breite = 900; - int hoehe = 650; + int breiteFrame = 900; + int hoeheFrame = 650; + + int breitePanel = 696; + int hoehePanel = 569; /** * Launch the application. @@ -48,7 +51,7 @@ public class MouseGame extends JFrame { //Fensterrahmen Haupt Layout setTitle("Mouse Game"); - setBounds(100, 100, breite, hoehe); + setBounds(100, 100, breiteFrame, hoeheFrame); robot.mouseMove(resetX, resetY); contentPane = new JPanel(); @@ -76,7 +79,7 @@ public class MouseGame extends JFrame { JPanel panel = new JPanel(); panel.setBorder(new LineBorder(new Color(0, 0, 0), 2)); panel.setForeground(new Color(0, 0, 0)); - panel.setBounds(103, 11, 696, 569); + panel.setBounds(103, 11, breitePanel, hoehePanel); contentPane.add(panel); panel.setLayout(null); @@ -137,12 +140,12 @@ public class MouseGame extends JFrame { public int getBreite() { - return breite; + return breiteFrame; } public int getHoehe() { - return hoehe; + return hoeheFrame; } From db4eb9c44869e57b7e70ae6e877d6137a64f27f3 Mon Sep 17 00:00:00 2001 From: fdai7382 Date: Tue, 31 Jan 2023 09:53:25 +0100 Subject: [PATCH 06/13] [MouseGameTest Class]: Test: "boundsBreitePanelPruefen" erstellt. --- .../JavaGamelauncher/MouseGame.java | 15 +++++++++++++-- .../JavaGamelauncher/MouseGameTest.java | 18 ++++++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java index 7405177..15e8f66 100644 --- a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java +++ b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java @@ -23,6 +23,7 @@ public class MouseGame extends JFrame { int resetX = 200; int resetY = 170; + int breiteFrame = 900; int hoeheFrame = 650; @@ -139,16 +140,26 @@ public class MouseGame extends JFrame { } - public int getBreite() { + public int getBreiteFrame() { return breiteFrame; } - public int getHoehe() { + public int getHoeheFrame() { return hoeheFrame; } + public int getBreitePanel() { + return breitePanel; + } + + + public int getHoehePanel() { + return hoehePanel; + } + + private void reset(JPanel panel) { panel.addMouseListener(new MouseAdapter() { @Override diff --git a/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java b/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java index f2a4bc2..3844097 100644 --- a/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java +++ b/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java @@ -57,20 +57,30 @@ public class MouseGameTest { } @Test - public void boundsBreitePruefen() throws AWTException { + public void boundsBreiteFramePruefen() throws AWTException { //Given MouseGame mg = new MouseGame(); //Then - assertTrue(mg.getBreite()==900); + assertTrue(mg.getBreiteFrame()==900); } @Test - public void boundsHoehePruefen() throws AWTException { + public void boundsHoeheFramePruefen() throws AWTException { //Given MouseGame mg = new MouseGame(); //Then - assertTrue(mg.getHoehe()==650); + assertTrue(mg.getHoeheFrame()==650); } + + @Test + public void boundsBreitePanelPruefen() throws AWTException { + //Given + MouseGame mg = new MouseGame(); + + //Then + assertTrue(mg.getBreitePanel()==696); + } + } From e49fb2d6e0e56b906c376490900e7f199721ff92 Mon Sep 17 00:00:00 2001 From: fdai7382 Date: Tue, 31 Jan 2023 09:54:11 +0100 Subject: [PATCH 07/13] [MouseGameTest Class]: Test: "boundsHoehePanelPruefen" erstellt. --- .../gruppenprojekt/JavaGamelauncher/MouseGameTest.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java b/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java index 3844097..8f7add9 100644 --- a/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java +++ b/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java @@ -83,4 +83,12 @@ public class MouseGameTest { assertTrue(mg.getBreitePanel()==696); } + @Test + public void boundsHoehePanelPruefen() throws AWTException { + //Given + MouseGame mg = new MouseGame(); + + //Then + assertTrue(mg.getHoehePanel()==569); + } } From 9510d18fa765a1b8e94d79b3e4a5377aae84d2a2 Mon Sep 17 00:00:00 2001 From: fdai7382 Date: Tue, 31 Jan 2023 10:04:45 +0100 Subject: [PATCH 08/13] refactoring: [MouseGame Class]: Auslagern der Farbei Beige in ein Objekt --- .../hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java index 15e8f66..34eb65b 100644 --- a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java +++ b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java @@ -21,6 +21,8 @@ public class MouseGame extends JFrame { private JPanel contentPane; public Robot robot = new Robot(); + public Color farbeBeige = new Color(128, 128, 128); + int resetX = 200; int resetY = 170; @@ -63,7 +65,7 @@ public class MouseGame extends JFrame { setForeground(Color.GRAY); setBackground(Color.DARK_GRAY); contentPane.setForeground(new Color(0, 0, 0)); - contentPane.setBackground(new Color(128, 128, 128)); + contentPane.setBackground(farbeBeige); JLabel labelStart = new JLabel("Start"); labelStart.setHorizontalAlignment(SwingConstants.CENTER); From 4ecbe16b6fae736d39c818cf6306e70fd637812f Mon Sep 17 00:00:00 2001 From: fdai7382 Date: Tue, 31 Jan 2023 10:17:33 +0100 Subject: [PATCH 09/13] [MouseGameTest Class]: Test "contentPaneBackgroundPruefen" erstellt. --- .../gruppenprojekt/JavaGamelauncher/MouseGame.java | 10 ++++++++++ .../JavaGamelauncher/MouseGameTest.java | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java index 34eb65b..9db8538 100644 --- a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java +++ b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java @@ -132,6 +132,16 @@ public class MouseGame extends JFrame { }//end standardkonstruktor + public JPanel getContentPane() { + return contentPane; + } + + + public Color getFarbeBeige() { + return farbeBeige; + } + + public int getResetX() { return resetX; } diff --git a/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java b/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java index 8f7add9..3498c19 100644 --- a/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java +++ b/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java @@ -3,6 +3,7 @@ package de.hs_fulda.gruppenprojekt.JavaGamelauncher; import static org.junit.Assert.*; import java.awt.AWTException; +import java.awt.Color; import java.awt.MouseInfo; import java.awt.Point; import java.awt.PointerInfo; @@ -91,4 +92,15 @@ public class MouseGameTest { //Then assertTrue(mg.getHoehePanel()==569); } + + @Test + public void contentPaneBackgroundPruefen() throws AWTException { + //Given + MouseGame mg = new MouseGame(); + Color farbeBeige = new Color (128,128,128); + + //Then + assertEquals(farbeBeige, mg.getContentPane().getBackground()); + + } } From 65f5bad7ae8793fae1277b589328a6027a8ebb91 Mon Sep 17 00:00:00 2001 From: fdai7382 Date: Tue, 31 Jan 2023 11:02:36 +0100 Subject: [PATCH 10/13] [MouseGameTest Class]: Test: "contentPaneForegroundPruefen" erstellt. --- .../gruppenprojekt/JavaGamelauncher/MouseGame.java | 3 ++- .../JavaGamelauncher/MouseGameTest.java | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java index 9db8538..277fecc 100644 --- a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java +++ b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java @@ -22,6 +22,7 @@ public class MouseGame extends JFrame { public Robot robot = new Robot(); public Color farbeBeige = new Color(128, 128, 128); + public Color farbeSchwarz = new Color(0, 0, 0); int resetX = 200; int resetY = 170; @@ -64,7 +65,7 @@ public class MouseGame extends JFrame { setForeground(Color.GRAY); setBackground(Color.DARK_GRAY); - contentPane.setForeground(new Color(0, 0, 0)); + contentPane.setForeground(farbeSchwarz); contentPane.setBackground(farbeBeige); JLabel labelStart = new JLabel("Start"); diff --git a/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java b/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java index 3498c19..7befbb2 100644 --- a/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java +++ b/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java @@ -103,4 +103,15 @@ public class MouseGameTest { assertEquals(farbeBeige, mg.getContentPane().getBackground()); } + + @Test + public void contentPaneForegroundPruefen() throws AWTException { + //Given + MouseGame mg = new MouseGame(); + Color farbeSchwarz = new Color (0,0,0); + + //Then + assertEquals(farbeSchwarz, mg.getContentPane().getForeground()); + + } } From d129367c79097bfb8f80ad10c506339777af5516 Mon Sep 17 00:00:00 2001 From: fdai7382 Date: Tue, 31 Jan 2023 11:42:07 +0100 Subject: [PATCH 11/13] refactoring: [MouseGame Class]: Auslagern der Font. --- .../hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java index 277fecc..75e45e6 100644 --- a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java +++ b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java @@ -24,6 +24,8 @@ public class MouseGame extends JFrame { public Color farbeBeige = new Color(128, 128, 128); public Color farbeSchwarz = new Color(0, 0, 0); + public Font fontTahoma = new Font("Tahoma", Font.BOLD, 30); + int resetX = 200; int resetY = 170; @@ -70,13 +72,13 @@ public class MouseGame extends JFrame { JLabel labelStart = new JLabel("Start"); labelStart.setHorizontalAlignment(SwingConstants.CENTER); - labelStart.setFont(new Font("Tahoma", Font.BOLD, 30)); + labelStart.setFont(fontTahoma); labelStart.setBounds(10, 11, 83, 49); contentPane.add(labelStart); JLabel labelZiel = new JLabel("Ziel"); labelZiel.setHorizontalAlignment(SwingConstants.CENTER); - labelZiel.setFont(new Font("Tahoma", Font.BOLD, 30)); + labelZiel.setFont(fontTahoma); labelZiel.setBounds(809, 525, 67, 49); contentPane.add(labelZiel); From a96bf57e16a6995ba52426cb2a2af262b1abb907 Mon Sep 17 00:00:00 2001 From: fdai7382 Date: Tue, 31 Jan 2023 12:09:27 +0100 Subject: [PATCH 12/13] [MouseGameTest Class]: Test: "fontTahomaPruefen" erstellt. --- .../gruppenprojekt/JavaGamelauncher/MouseGame.java | 5 +++++ .../JavaGamelauncher/MouseGameTest.java | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java index 75e45e6..5cfc86e 100644 --- a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java +++ b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java @@ -145,6 +145,11 @@ public class MouseGame extends JFrame { } + public Font getFontTahoma() { + return fontTahoma; + } + + public int getResetX() { return resetX; } diff --git a/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java b/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java index 7befbb2..f8b4aa5 100644 --- a/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java +++ b/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java @@ -4,6 +4,7 @@ import static org.junit.Assert.*; import java.awt.AWTException; import java.awt.Color; +import java.awt.Font; import java.awt.MouseInfo; import java.awt.Point; import java.awt.PointerInfo; @@ -114,4 +115,15 @@ public class MouseGameTest { assertEquals(farbeSchwarz, mg.getContentPane().getForeground()); } + + @Test + public void fontTahomaPruefen() throws AWTException { + //Given + MouseGame mg = new MouseGame(); + Font fontTahoma = new Font("Tahoma", Font.BOLD, 30); + + + //Then + assertEquals(fontTahoma, mg.getFontTahoma()); + } } From 55208e52bc79d6e966f919fd0cb574d8565bbe49 Mon Sep 17 00:00:00 2001 From: fdai7382 Date: Tue, 31 Jan 2023 12:19:19 +0100 Subject: [PATCH 13/13] [MouseGameTest Class]: Test "panelRahmenBackgroundColorPruefen" erstellt --- .../JavaGamelauncher/MouseGame.java | 22 ++++++++++--------- .../JavaGamelauncher/MouseGameTest.java | 11 ++++++++++ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java index 5cfc86e..faee486 100644 --- a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java +++ b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java @@ -21,8 +21,10 @@ public class MouseGame extends JFrame { private JPanel contentPane; public Robot robot = new Robot(); - public Color farbeBeige = new Color(128, 128, 128); - public Color farbeSchwarz = new Color(0, 0, 0); + public Color paneFarbeBackground = new Color(128, 128, 128); + public Color paneFarbeForeground = new Color(0, 0, 0); + + public Color panelRahmenFarbeBackground = new Color(0, 0, 0); public Font fontTahoma = new Font("Tahoma", Font.BOLD, 30); @@ -67,8 +69,8 @@ public class MouseGame extends JFrame { setForeground(Color.GRAY); setBackground(Color.DARK_GRAY); - contentPane.setForeground(farbeSchwarz); - contentPane.setBackground(farbeBeige); + contentPane.setForeground(paneFarbeForeground); + contentPane.setBackground(paneFarbeBackground); JLabel labelStart = new JLabel("Start"); labelStart.setHorizontalAlignment(SwingConstants.CENTER); @@ -91,25 +93,25 @@ public class MouseGame extends JFrame { JPanel nordWand = new JPanel(); reset(nordWand); - nordWand.setBackground(new Color(0, 0, 0)); + nordWand.setBackground(panelRahmenFarbeBackground); nordWand.setBounds(0, 0, 696, 10); panel.add(nordWand); JPanel suedWand = new JPanel(); reset(suedWand); - suedWand.setBackground(new Color(0, 0, 0)); + suedWand.setBackground(panelRahmenFarbeBackground); suedWand.setBounds(0, 559, 696, 10); panel.add(suedWand); JPanel ostWand = new JPanel(); reset(ostWand); - ostWand.setBackground(new Color(0, 0, 0)); + ostWand.setBackground(panelRahmenFarbeBackground); ostWand.setBounds(686, 0, 10, 509); panel.add(ostWand); JPanel westWand = new JPanel(); reset(westWand); - westWand.setBackground(new Color(0, 0, 0)); + westWand.setBackground(panelRahmenFarbeBackground); westWand.setBounds(0, 60, 10, 509); panel.add(westWand); @@ -140,8 +142,8 @@ public class MouseGame extends JFrame { } - public Color getFarbeBeige() { - return farbeBeige; + public Color getPanelRahmenFarbeBackground() { + return panelRahmenFarbeBackground; } diff --git a/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java b/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java index f8b4aa5..fd3f73c 100644 --- a/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java +++ b/JavaGamelauncher/src/test/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGameTest.java @@ -126,4 +126,15 @@ public class MouseGameTest { //Then assertEquals(fontTahoma, mg.getFontTahoma()); } + + @Test + public void panelRahmenBackgroundColorPruefen() throws AWTException { + //Given + MouseGame mg = new MouseGame(); + Color farbeSchwarz = new Color (0,0,0); + + //Then + assertEquals(farbeSchwarz, mg.getPanelRahmenFarbeBackground()); + + } }