Add option for testing
This commit is contained in:
parent
597c60b035
commit
69b8f86647
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
@ -17,6 +17,14 @@
|
||||
"mainClass": "electrosphere.main.Main",
|
||||
"projectName": "Renderer"
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Launch Main (macos)",
|
||||
"request": "launch",
|
||||
"mainClass": "electrosphere.main.Main",
|
||||
"projectName": "Renderer",
|
||||
"vmArgs": "-XstartOnFirstThread"
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Launch Main (Headless)",
|
||||
|
||||
7
pom.xml
7
pom.xml
@ -152,6 +152,12 @@
|
||||
<version>3.36.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
@ -175,6 +181,7 @@
|
||||
</os>
|
||||
</activation>
|
||||
<properties>
|
||||
<!-- <maven.compiler.target>17</maven.compiler.target> -->
|
||||
<lwjgl.natives>natives-macos</lwjgl.natives>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
33
src/test/java/LoadingTest.java
Normal file
33
src/test/java/LoadingTest.java
Normal file
@ -0,0 +1,33 @@
|
||||
import electrosphere.controls.ControlHandler;
|
||||
import electrosphere.game.config.UserSettings;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
import electrosphere.main.Globals;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class LoadingTest extends TestCase {
|
||||
// @BeforeClass
|
||||
|
||||
public void testABC(){
|
||||
//initialize logging interfaces
|
||||
LoggerInterface.initLoggers();
|
||||
|
||||
//load user settings
|
||||
UserSettings.loadUserSettings();
|
||||
|
||||
//controls
|
||||
if(Globals.RUN_CLIENT){
|
||||
initControlHandler();
|
||||
}
|
||||
|
||||
//init global variables
|
||||
Globals.initGlobals();
|
||||
}
|
||||
|
||||
public static void initControlHandler(){
|
||||
LoggerInterface.loggerStartup.INFO("Initialize control handler");
|
||||
Globals.controlHandler = ControlHandler.generateExampleControlsMap();
|
||||
Globals.controlHandler.setCallbacks();
|
||||
// Globals.controlHandler = FileLoadingUtils.loadModelObjectFromBakedJsonFile("/Config/keybinds.json",ControlHandler.class);
|
||||
}
|
||||
|
||||
}
|
||||
13
src/test/java/TestRunner.java
Normal file
13
src/test/java/TestRunner.java
Normal file
@ -0,0 +1,13 @@
|
||||
import org.junit.runner.JUnitCore;
|
||||
import org.junit.runner.Result;
|
||||
import org.junit.runner.notification.Failure;
|
||||
|
||||
public class TestRunner {
|
||||
public static void main(String[] args){
|
||||
Result result = JUnitCore.runClasses(LoadingTest.class);
|
||||
for(Failure failure : result.getFailures()){
|
||||
System.out.println(failure);
|
||||
}
|
||||
System.out.println("Testing was successful: " + result.wasSuccessful());
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user