package electrosphere.renderer.ui.elements;

import java.awt.image.BufferedImage;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import electrosphere.engine.Globals;
import electrosphere.engine.Main;
import electrosphere.menu.WindowUtils;
import electrosphere.menu.mainmenu.MenuGeneratorsUITesting;
import electrosphere.renderer.RenderingEngine;
import testutils.TestEngineUtils;

/**
 * Integration tests for the window class
 */
public class WindowIntegrationTest {
    
    @BeforeEach
    @Tag("integration")
    /**
     * Initializes the engine
     */
    public void initEngine(){
        TestEngineUtils.initGraphicalEngine();
    }

    @Test
    @Tag("integration")
    /**
     * Tests creating a window
     */
    public void testCreateWindow(){
        //create ui testing window
        TestEngineUtils.simulateFrames(1);
        WindowUtils.replaceMainMenuContents(MenuGeneratorsUITesting.createUITestMenu());
        TestEngineUtils.simulateFrames(1);
        BufferedImage screenshot = RenderingEngine.defaultFramebuffer.getPixels(Globals.renderingEngine.getOpenGLState());

    }

    @AfterEach
    @Tag("integration")
    /**
     * Shuts down the engine
     */
    public void closeEngine(){
        Main.shutdown();
    }



}
