Tests are back to Java, because they didn't really run via Gradle when in Kotlin

This commit is contained in:
Yair Morgenstern 2019-12-02 22:33:48 +02:00
parent e3ac6f4e53
commit 0ca3d91994
6 changed files with 53 additions and 51 deletions

View file

@ -24,10 +24,7 @@ cache:
- $HOME/.android/build-cache
script:
- "./gradlew test"
#curl https://github.com/ojdkbuild/ojdkbuild/releases/download/java-1.8.0-openjdk-1.8.0.232-1.b09/java-1.8.0-openjdk-1.8.0.232-1.b09.ojdkbuild.windows.x86_64.zip -o jdk-windows.zip
- ./gradlew test
- if [ -n "$TRAVIS_TAG" ]; then
wget -O jdk-windows.zip https://github.com/ojdkbuild/ojdkbuild/releases/download/java-1.8.0-openjdk-1.8.0.232-1.b09/java-1.8.0-openjdk-1.8.0.232-1.b09.ojdkbuild.windows.x86_64.zip;
./gradlew desktop:packrWindows32;

View file

@ -1641,7 +1641,7 @@
French:"Panzer"
Czech:"Panzer"
Polish:"Panzer"
Portuguese:"Tanque-Panzer' // to differ from 'Tanque'
Portuguese:"Tanque-Panzer" // to differ from 'Tanque'
}
"Bomber":{

View file

@ -16,21 +16,21 @@
package de.tomgrill.gdxtesting;
import java.util.HashMap;
import java.util.Map;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.headless.HeadlessApplication;
import com.badlogic.gdx.backends.headless.HeadlessApplicationConfiguration;
import com.badlogic.gdx.graphics.GL20;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.InitializationError;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import static org.mockito.Mockito.mock;
import java.util.HashMap;
import java.util.Map;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.headless.HeadlessApplication;
import com.badlogic.gdx.backends.headless.HeadlessApplicationConfiguration;
import static org.mockito.Mockito.mock;
public class GdxTestRunner extends BlockJUnit4ClassRunner implements ApplicationListener {

View file

@ -0,0 +1,40 @@
// Taken from https://github.com/TomGrill/gdx-testing
package de.tomgrill.gdxtesting.examples;
import com.badlogic.gdx.Gdx;
import com.unciv.models.gamebasics.GameBasics;
import org.junit.Test;
import org.junit.runner.RunWith;
import de.tomgrill.gdxtesting.GdxTestRunner;
import static org.junit.Assert.assertTrue;
// DO NOT attempt to Kotlinize until you're sure that running gradle tests:test actually checks stuff!
@RunWith(GdxTestRunner.class)
public class BasicTests {
@Test
public void gamePngExists() {
assertTrue("This test will only pass when the game.png exists",
Gdx.files.local("game.png").exists());
}
@Test
public void gameBasicsLoad() {
assertTrue("This test will only pass when the game.png exists",
GameBasics.INSTANCE.getBuildings().size() > 0);
}
// @Test
// public void setMapEditorScreen() {
// new UncivGame("").create(); // sets the current
// UncivGame.Current.setScreen(new MapEditorScreen(UncivGame.Current.getGameInfo().getTileMap()));
// assertTrue("This test will only pass when we can open the map editor screen",
// GameBasics.INSTANCE.getBuildings().size() > 0);
// }
}

View file

@ -1,36 +0,0 @@
// Taken from https://github.com/TomGrill/gdx-testing
package de.tomgrill.gdxtesting.examples
import com.badlogic.gdx.Gdx
import com.unciv.UncivGame
import com.unciv.models.gamebasics.GameBasics
import com.unciv.ui.mapeditor.MapEditorScreen
import de.tomgrill.gdxtesting.GdxTestRunner
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(GdxTestRunner::class)
class BasicTests {
@Test
fun gamePngExists() {
assertTrue("This test will only pass when the game.png exists",
Gdx.files.local("game.png").exists())
}
@Test
fun gameBasicsLoad() {
assertTrue("This test will only pass when the GameBasics can initialize, and there are buildings",
GameBasics.Buildings.size > 0)
}
@Test
fun canOpenMapEditorScreen() {
UncivGame.Current.setScreen(MapEditorScreen(UncivGame.Current.gameInfo.tileMap))
assertTrue("This test will only pass when we can open the map editor screen",
GameBasics.Buildings.size > 0)
}
}

View file

@ -16,10 +16,10 @@
package de.tomgrill.gdxtesting.examples;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class UnitTestExample {
@Test
@ -28,3 +28,4 @@ public class UnitTestExample {
}
}