Fix tests

This commit is contained in:
yairm210
2024-07-27 23:45:34 +03:00
parent 099a2385c0
commit 255ba1d9c6
3 changed files with 5 additions and 3 deletions

View File

@ -42,7 +42,7 @@ class UncivFiles(
private val files: Files,
/** If not null, this is the path to the directory in which to store the local files - mods, saves, maps, etc */
val customDataDirectory: String?
val customDataDirectory: String? = null
) {
init {
debug("Creating UncivFiles, localStoragePath: %s, externalStoragePath: %s",

View File

@ -1,5 +1,6 @@
package com.unciv.models.translations
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.files.FileHandle
import com.unciv.UncivGame
import com.unciv.json.fromJsonFile
@ -259,7 +260,7 @@ object TranslationFileWriter {
// used for unit test only
fun getGeneratedStringsSize(): Int {
return GenerateStringsFromJSONs(UncivGame.Current.files.getLocalFile("jsons/Civ V - Vanilla")).values.sumOf {
return GenerateStringsFromJSONs(Gdx.files.local("jsons/Civ V - Vanilla")).values.sumOf {
// exclude empty lines
it.count { line: String -> !line.startsWith(specialNewLineCode) }
}

View File

@ -1,6 +1,7 @@
// Taken from https://github.com/TomGrill/gdx-testing
package com.unciv.testing
import com.badlogic.gdx.Gdx
import com.unciv.Constants
import com.unciv.UncivGame
import com.unciv.models.metadata.BaseRuleset
@ -39,7 +40,7 @@ class BasicTests {
@Test
fun gamePngExists() {
Assert.assertTrue("This test will only pass when the game.png exists",
UncivGame.Current.files.getDataFolder().list().any { it.name().endsWith(".png") })
Gdx.files.local("").list().any { it.name().endsWith(".png") })
}
@Test