Testing out JmonkeyEngine to make a game in Scala with Akka Actors within a pure FP layer
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package wow.doge.mygame
import org.scalatest.funsuite.AnyFunSuite import monix.execution.Scheduler.Implicits.global import cats.syntax.eq._ import com.jme3.{asset => jmea} import com.jme3.asset.DesktopAssetManager import wow.doge.mygame.utils.wrappers.jme.AssetManager import wow.doge.mygame.utils.wrappers.jme.AssetManager.AssetNotFound import com.jme3.scene.Geometry import wow.doge.mygame.utils.wrappers.jme.AssetManager.CouldNotCastError import com.jme3.scene.Node import com.jme3.material.MaterialDef import com.jme3.material.Material
class AssetManagerTest extends AnyFunSuite {
val _assetManager: jmea.AssetManager = new DesktopAssetManager(true) val assetManager = new AssetManager(_assetManager)
test("Test for AssetNotFound error") { val res = assetManager.loadModel(os.rel / "doesnotexist").attempt.runSyncUnsafe() assert(res === Left(AssetNotFound("doesnotexist"))) }
test("Test for Model CouldNotCastError") { val modelPath = os.rel / "Models" / "Jaime" / "Jaime.j3o" val res1 = assetManager .loadModelAs[Geometry](modelPath) .attempt .runSyncUnsafe()
assert(res1 === Left(CouldNotCastError))
val res2 = assetManager .loadModelAs[Node](modelPath) .attempt .runSyncUnsafe() assert(res2.map(_.getName) === Right("JaimeGeom-ogremesh")) }
test("Test for Asset CouldNotCastError") { val assetPath = os.rel / "Common" / "MatDefs" / "Misc" / "Unshaded.j3md"
val res1 = assetManager .loadAssetAs[Material](assetPath) .attempt .runSyncUnsafe()
assert(res1 === Left(CouldNotCastError))
val res2 = assetManager .loadAssetAs[MaterialDef](assetPath) .attempt .runSyncUnsafe() assert(res2.map(_.getName) === Right("Unshaded")) } }
|