使用libgdx和自己的GameText类进行单元测试

时间:2018-10-28 12:41:10

标签: libgdx

我创建了一个GameTest类来扩展我的Testclass,但是当我使用它们时,出现以下错误:

com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'gdx64.dll' for target: Windows 8.1, 64-bit

我的课:

public class GameTest {
    // This is our "test" application
    private static Application application;

    // Before running any tests, initialize the application with the headless backend
    @BeforeClass
    public static void init() {
        // Note that we don't need to implement any of the listener's methods
        application = new HeadlessApplication(new ApplicationListener() {
            @Override public void create() {}
            @Override public void resize(int width, int height) {}
            @Override public void render() {}
            @Override public void pause() {}
            @Override public void resume() {}
            @Override public void dispose() {}
        });

        // Use Mockito to mock the OpenGL methods since we are running headlessly
        Gdx.gl20 = Mockito.mock(GL20.class);
        Gdx.gl = Gdx.gl20;
    }

    // After we are done, clean up the application
    @AfterClass
    public static void cleanUp() {
        // Exit the application first
        application.exit();
        application = null;
    }
}

有人可以帮助我解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

您可能没有将libgdx测试依赖项添加到“ build.gradle”文件中。 尝试将这些依赖项添加到“核心”部分:

regex