Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assets not found when run test using main methods #138

Open
fabiitch opened this issue Nov 19, 2024 · 2 comments
Open

Assets not found when run test using main methods #138

fabiitch opened this issue Nov 19, 2024 · 2 comments

Comments

@fabiitch
Copy link

fabiitch commented Nov 19, 2024

Hello when i launch main methods in tests folder

like using com.badlogic.gdx.ai.tests.BehaviorTreeTests#main

public static void main (String[] argv) {
	GdxAiTestUtils.launch(new BehaviorTreeTests());
}

i got error when he try to load a file.

		skin = new Skin(Gdx.files.internal("data/uiskin.json"));

		Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: data\uiskin.json (Internal)

For fix i have to add tests/ before asset path

skin = new Skin(Gdx.files.internal("tests/data/uiskin.json"));

im the only with this issues ?
Should i PR with all modifications ?

@voidvvv
Copy link

voidvvv commented Dec 9, 2024

yes, it's could be an issue.
to fix this, you should try this code in build.gradle under tests:

// add below setting for gdx-ai
sourceSets.main.resources.srcDirs = ["./"]
project.ext.assetsDir = new File(".")

and the complete config like this:

apply plugin: "java"

sourceCompatibility = 1.7

sourceSets.main.java.srcDirs = [ "src/" ]

// add below setting for gdx-ai
sourceSets.main.resources.srcDirs = ["./"]
project.ext.assetsDir = new File(".")


dependencies {
    implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
    implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
    implementation "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
    implementation "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-desktop"
    implementation "com.esotericsoftware:kryo:3.0.3"
}

eclipse.project {
    name =  projectGroup + "-tests"
}

@voidvvv
Copy link

voidvvv commented Dec 9, 2024

and I have the same issue at the begining, and I think it might be a mistake, not a feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants