Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yairm210 committed Jul 27, 2024
1 parent 099a238 commit 255ba1d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/src/com/unciv/logic/files/UncivFiles.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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) }
}
Expand Down
3 changes: 2 additions & 1 deletion tests/src/com/unciv/testing/BasicTests.kt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 255ba1d

Please sign in to comment.