UNIT TESTINH IS HELL
This commit is contained in:
parent
107a57b710
commit
7c959b93c7
BIN
classes/artifacts/gameOfProd_jar/gameOfProd.jar
Normal file
BIN
classes/artifacts/gameOfProd_jar/gameOfProd.jar
Normal file
Binary file not shown.
@ -6,9 +6,18 @@
|
|||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.7.0-M1" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.7.0-M1" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.7.0-M1" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.7.0-M1" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.7.0-M1" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.7.0-M1" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
8
pom.xml
8
pom.xml
@ -18,4 +18,12 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter</artifactId>
|
||||||
|
<version>RELEASE</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
@ -41,7 +41,7 @@ public class Game extends JFrame {
|
|||||||
battle = new WindowOfBattle(this);
|
battle = new WindowOfBattle(this);
|
||||||
|
|
||||||
//tohle spustí na začátku menu
|
//tohle spustí na začátku menu
|
||||||
// add(menu);
|
add(menu);
|
||||||
|
|
||||||
//tohle spustí na začátku hru
|
//tohle spustí na začátku hru
|
||||||
// add(freeMove);
|
// add(freeMove);
|
||||||
@ -52,7 +52,7 @@ public class Game extends JFrame {
|
|||||||
// battle.startBattle();
|
// battle.startBattle();
|
||||||
|
|
||||||
//Tohle spustí na začátku tileset overview
|
//Tohle spustí na začátku tileset overview
|
||||||
new LevelEditor();
|
//new LevelEditor();
|
||||||
|
|
||||||
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||||
setUndecorated(true);
|
setUndecorated(true);
|
||||||
|
|||||||
@ -30,7 +30,7 @@ public class ImageCell {
|
|||||||
try {
|
try {
|
||||||
mapBackground = new int[WindowOfFreeMove.CANVAS_WIDTH][WindowOfFreeMove.CANVAS_HEIGHT];
|
mapBackground = new int[WindowOfFreeMove.CANVAS_WIDTH][WindowOfFreeMove.CANVAS_HEIGHT];
|
||||||
mapForeground = new int[WindowOfFreeMove.CANVAS_WIDTH][WindowOfFreeMove.CANVAS_HEIGHT];
|
mapForeground = new int[WindowOfFreeMove.CANVAS_WIDTH][WindowOfFreeMove.CANVAS_HEIGHT];
|
||||||
File mapFile = new File("src/main/resources/maps/" + WindowOfFreeMove.CHAPTER + "/" + name + "-tileset.txt");
|
File mapFile = new File("src/main/resources/maps/" + WindowOfFreeMove.getCHAPTER() + "/" + name + "-tileset.txt");
|
||||||
Scanner scanner = new Scanner(mapFile);
|
Scanner scanner = new Scanner(mapFile);
|
||||||
int j = 0;
|
int j = 0;
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
@ -96,7 +96,7 @@ public class ImageCell {
|
|||||||
|
|
||||||
public void imageObjectset(String file) {
|
public void imageObjectset(String file) {
|
||||||
try {
|
try {
|
||||||
File objectFile = new File("src/main/resources/maps/" + WindowOfFreeMove.CHAPTER + "/" + file + "-objectset.txt");
|
File objectFile = new File("src/main/resources/maps/" + WindowOfFreeMove.getCHAPTER() + "/" + file + "-objectset.txt");
|
||||||
Scanner scanner = new Scanner(objectFile);
|
Scanner scanner = new Scanner(objectFile);
|
||||||
int j = 0;
|
int j = 0;
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
|
|||||||
@ -58,7 +58,7 @@ public class Map {
|
|||||||
|
|
||||||
public static Map loadMapFromFile(String name, WindowOfFreeMove window) {
|
public static Map loadMapFromFile(String name, WindowOfFreeMove window) {
|
||||||
try {
|
try {
|
||||||
File file = new File("src/main/resources/maps/" + WindowOfFreeMove.CHAPTER + "/" + name + ".txt");
|
File file = new File("src/main/resources/maps/" + WindowOfFreeMove.getCHAPTER() + "/" + name + ".txt");
|
||||||
scanner = new Scanner(file);
|
scanner = new Scanner(file);
|
||||||
String firstLine = scanner.nextLine();
|
String firstLine = scanner.nextLine();
|
||||||
String[] size = firstLine.split(" ");
|
String[] size = firstLine.split(" ");
|
||||||
@ -139,7 +139,7 @@ public class Map {
|
|||||||
|
|
||||||
public void linkMaps(Map map, WindowOfFreeMove window) {
|
public void linkMaps(Map map, WindowOfFreeMove window) {
|
||||||
try {
|
try {
|
||||||
File dialogFile = new File("src/main/resources/maps/" + WindowOfFreeMove.CHAPTER + "/" + map.getName() + ".txt");
|
File dialogFile = new File("src/main/resources/maps/" + WindowOfFreeMove.getCHAPTER() + "/" + map.getName() + ".txt");
|
||||||
scanner = new Scanner(dialogFile);
|
scanner = new Scanner(dialogFile);
|
||||||
String firstLine = scanner.nextLine();
|
String firstLine = scanner.nextLine();
|
||||||
String[] size = firstLine.split(" ");
|
String[] size = firstLine.split(" ");
|
||||||
|
|||||||
@ -73,7 +73,7 @@ public class LoadManager {
|
|||||||
|
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
String[] mapName = scanner.nextLine().split(" ");
|
String[] mapName = scanner.nextLine().split(" ");
|
||||||
if (mapName[0].equals("<" + WindowOfFreeMove.CHAPTER + ">")) {
|
if (mapName[0].equals("<" + WindowOfFreeMove.getCHAPTER() + ">")) {
|
||||||
Map map = Map.loadMapFromFile(mapName[1], window);
|
Map map = Map.loadMapFromFile(mapName[1], window);
|
||||||
if (mapName[1].equals("tutorial")) map.getPerson().setImagePerson("tutorialpers", rec);
|
if (mapName[1].equals("tutorial")) map.getPerson().setImagePerson("tutorialpers", rec);
|
||||||
else map.getPerson().setImagePerson("main", rec);
|
else map.getPerson().setImagePerson("main", rec);
|
||||||
@ -96,7 +96,7 @@ public class LoadManager {
|
|||||||
Scanner scanner = new Scanner(npcsFile);
|
Scanner scanner = new Scanner(npcsFile);
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
String[] npcName = scanner.nextLine().split(" ");
|
String[] npcName = scanner.nextLine().split(" ");
|
||||||
if (npcName[0].equals("<" + WindowOfFreeMove.CHAPTER + ">")) {
|
if (npcName[0].equals("<" + WindowOfFreeMove.getCHAPTER() + ">")) {
|
||||||
File npcFile = new File("src/main/resources/characters/" + npcName[1] + ".txt");
|
File npcFile = new File("src/main/resources/characters/" + npcName[1] + ".txt");
|
||||||
Scanner sc = new Scanner(npcFile);
|
Scanner sc = new Scanner(npcFile);
|
||||||
String[] position = sc.nextLine().split(" ");
|
String[] position = sc.nextLine().split(" ");
|
||||||
|
|||||||
@ -21,7 +21,7 @@ public class SoundManager {
|
|||||||
|
|
||||||
public void loadSoundMap(String file) {
|
public void loadSoundMap(String file) {
|
||||||
try {
|
try {
|
||||||
File mapFile = new File("src/main/resources/maps/" + WindowOfFreeMove.CHAPTER + "/" + file + "-tileset.txt");
|
File mapFile = new File("src/main/resources/maps/" + WindowOfFreeMove.getCHAPTER() + "/" + file + "-tileset.txt");
|
||||||
Scanner scanner = new Scanner(mapFile);
|
Scanner scanner = new Scanner(mapFile);
|
||||||
soundMap = new HashMap<>();
|
soundMap = new HashMap<>();
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
|
|||||||
@ -35,7 +35,15 @@ public class WindowOfFreeMove extends JLayeredPane {
|
|||||||
|
|
||||||
private static final int KEY_ESCAPE = 27;
|
private static final int KEY_ESCAPE = 27;
|
||||||
|
|
||||||
public static int CHAPTER = 0;
|
public static String getCHAPTER() {
|
||||||
|
return CHAPTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setCHAPTER(String CHAPTER) {
|
||||||
|
WindowOfFreeMove.CHAPTER = CHAPTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String CHAPTER = "0";
|
||||||
|
|
||||||
private JFrame game;
|
private JFrame game;
|
||||||
private Canvas canvas;
|
private Canvas canvas;
|
||||||
@ -190,7 +198,7 @@ public class WindowOfFreeMove extends JLayeredPane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void loadNextChapter() {
|
public void loadNextChapter() {
|
||||||
CHAPTER++;
|
CHAPTER = String.valueOf(Integer.parseInt(CHAPTER) + 1);
|
||||||
isReadyToPaint = false;
|
isReadyToPaint = false;
|
||||||
mapLinkedList = new LinkedList<>();
|
mapLinkedList = new LinkedList<>();
|
||||||
mapManager = new MapManager(mapLinkedList, canvas, this);
|
mapManager = new MapManager(mapLinkedList, canvas, this);
|
||||||
|
|||||||
@ -1,65 +0,0 @@
|
|||||||
<map>
|
|
||||||
<mapName>tutorial</mapName>
|
|
||||||
<events>
|
|
||||||
<trigger>
|
|
||||||
<x>11</x>
|
|
||||||
<y>6</y>
|
|
||||||
<active>false</active>
|
|
||||||
</trigger>
|
|
||||||
</events>
|
|
||||||
</map>
|
|
||||||
<map>
|
|
||||||
<mapName>openspace</mapName>
|
|
||||||
<events>
|
|
||||||
<trigger>
|
|
||||||
<x>6</x>
|
|
||||||
<y>4</y>
|
|
||||||
<active>true</active>
|
|
||||||
</trigger>
|
|
||||||
<trigger>
|
|
||||||
<x>14</x>
|
|
||||||
<y>16</y>
|
|
||||||
<active>false</active>
|
|
||||||
</trigger>
|
|
||||||
<chest>
|
|
||||||
<x>15</x>
|
|
||||||
<y>7</y>
|
|
||||||
<active>true</active>
|
|
||||||
</chest>
|
|
||||||
</events>
|
|
||||||
</map>
|
|
||||||
<map>
|
|
||||||
<mapName>office</mapName>
|
|
||||||
<events>
|
|
||||||
<trigger>
|
|
||||||
<x>4</x>
|
|
||||||
<y>2</y>
|
|
||||||
<active>false</active>
|
|
||||||
</trigger>
|
|
||||||
<chest>
|
|
||||||
<x>1</x>
|
|
||||||
<y>9</y>
|
|
||||||
<active>true</active>
|
|
||||||
</chest>
|
|
||||||
</events>
|
|
||||||
</map>
|
|
||||||
<map>
|
|
||||||
<mapName>boss</mapName>
|
|
||||||
<events>
|
|
||||||
<trigger>
|
|
||||||
<x>4</x>
|
|
||||||
<y>18</y>
|
|
||||||
<active>true</active>
|
|
||||||
</trigger>
|
|
||||||
</events>
|
|
||||||
</map>
|
|
||||||
<map>
|
|
||||||
<mapName>treasure</mapName>
|
|
||||||
<events>
|
|
||||||
<trigger>
|
|
||||||
<x>6</x>
|
|
||||||
<y>1</y>
|
|
||||||
<active>true</active>
|
|
||||||
</trigger>
|
|
||||||
</events>
|
|
||||||
</map>
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
<location>
|
|
||||||
<map>openspace</map>
|
|
||||||
<x>8</x>
|
|
||||||
<y>16</y>
|
|
||||||
<direction>3</direction>
|
|
||||||
</location>
|
|
||||||
@ -1 +0,0 @@
|
|||||||
TODO: Village
|
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package ruscz.game.gameOfProd.Scripts;
|
||||||
|
|
||||||
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
|
import ruscz.game.gameOfProd.Map.Map;
|
||||||
|
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public class PathFinderTest {
|
||||||
|
|
||||||
|
public static Stream<Arguments> argumentsStream(){
|
||||||
|
return Stream.of(
|
||||||
|
Arguments.of(1,1,1,1)
|
||||||
|
// Arguments.of(),
|
||||||
|
// Arguments.of(),
|
||||||
|
// Arguments.of(),
|
||||||
|
// Arguments.of()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ParameterizedTest
|
||||||
|
@MethodSource("argumentsStream")
|
||||||
|
public void getWayWithCollision_usingMap6ForTestOfPathFinding_rightPositionOfNpc(int startX, int startY, int endX, int endY) {
|
||||||
|
//Arrange
|
||||||
|
WindowOfFreeMove freeMove;
|
||||||
|
|
||||||
|
//Act
|
||||||
|
freeMove = new WindowOfFreeMove(new JFrame());
|
||||||
|
freeMove.setVisible(false);
|
||||||
|
WindowOfFreeMove.setCHAPTER("999");
|
||||||
|
freeMove.start(true);
|
||||||
|
freeMove.setMapManager(Map.findMapByName("m6",freeMove));
|
||||||
|
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user