mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-10 15:59:33 +07:00
Fixed tile improvement tests
This commit is contained in:
@ -1,6 +1,8 @@
|
|||||||
// Taken from https://github.com/TomGrill/gdx-testing
|
// Taken from https://github.com/TomGrill/gdx-testing
|
||||||
package com.unciv.logic.map
|
package com.unciv.logic.map
|
||||||
|
|
||||||
|
import com.badlogic.gdx.math.Vector2
|
||||||
|
import com.unciv.logic.city.CityInfo
|
||||||
import com.unciv.logic.civilization.CivilizationInfo
|
import com.unciv.logic.civilization.CivilizationInfo
|
||||||
import com.unciv.models.ruleset.Ruleset
|
import com.unciv.models.ruleset.Ruleset
|
||||||
import com.unciv.models.ruleset.RulesetCache
|
import com.unciv.models.ruleset.RulesetCache
|
||||||
@ -11,10 +13,11 @@ import org.junit.Test
|
|||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
@RunWith(GdxTestRunner::class)
|
@RunWith(GdxTestRunner::class)
|
||||||
class TileInfoTests {
|
class TileImprovementConstructionTests {
|
||||||
|
|
||||||
private var tile = TileInfo()
|
private var tile = TileInfo()
|
||||||
private var civInfo = CivilizationInfo()
|
private var civInfo = CivilizationInfo()
|
||||||
|
private var city = CityInfo()
|
||||||
private var ruleSet = Ruleset()
|
private var ruleSet = Ruleset()
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@ -24,6 +27,11 @@ class TileInfoTests {
|
|||||||
tile.ruleset = ruleSet
|
tile.ruleset = ruleSet
|
||||||
civInfo.tech.researchedTechnologies.addAll(ruleSet.technologies.values)
|
civInfo.tech.researchedTechnologies.addAll(ruleSet.technologies.values)
|
||||||
civInfo.tech.techsResearched.addAll(ruleSet.technologies.keys)
|
civInfo.tech.techsResearched.addAll(ruleSet.technologies.keys)
|
||||||
|
|
||||||
|
// This is so all improvements can be built
|
||||||
|
tile.owningCity = city
|
||||||
|
tile.position = Vector2(1f, 1f) // so that it's not on the same position as the city
|
||||||
|
city.civInfo = civInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -42,7 +50,8 @@ class TileInfoTests {
|
|||||||
@Test
|
@Test
|
||||||
fun allResourceImprovementsCanBeBuilt() {
|
fun allResourceImprovementsCanBeBuilt() {
|
||||||
for (improvement in ruleSet.tileImprovements.values) {
|
for (improvement in ruleSet.tileImprovements.values) {
|
||||||
tile.resource = ruleSet.tileResources.values.firstOrNull { it.improvement == improvement.name}?.name
|
tile.resource = ruleSet.tileResources.values
|
||||||
|
.firstOrNull { it.improvement == improvement.name}?.name
|
||||||
if (tile.resource == null) continue
|
if (tile.resource == null) continue
|
||||||
tile.baseTerrain = "Plains"
|
tile.baseTerrain = "Plains"
|
||||||
tile.setTransients()
|
tile.setTransients()
|
Reference in New Issue
Block a user