package template.extensions;

import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;

import electrosphere.engine.Globals;
import electrosphere.engine.Main;
import testutils.TestEngineUtils;

/**
 * Spins up an tears down generic rendering environment
 */
public class RenderingExtension implements BeforeEachCallback, AfterEachCallback {

    @Override
    public void beforeEach(ExtensionContext context) throws Exception {
        Globals.WINDOW_DECORATED = false;
        Globals.WINDOW_FULLSCREEN = true;
        Globals.RUN_AUDIO = false;
        Globals.WINDOW_WIDTH = 1920;
        Globals.WINDOW_HEIGHT = 1080;
        TestEngineUtils.initGraphicalEngine();
    }

    @Override
    public void afterEach(ExtensionContext context) throws Exception {
        Main.shutdown();
    }

}