fullscreen strategy for test rendering
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-08-22 18:46:51 -04:00
parent 4ffbc87c48
commit 6dc82d0b5e
6 changed files with 16 additions and 12 deletions

View File

@ -224,6 +224,7 @@ public class Globals {
public static int WINDOW_WIDTH = 1920;
public static int WINDOW_HEIGHT = 1080;
public static boolean WINDOW_DECORATED = true; //used to control whether the window is created with decorations or not (ie for testing)
public static boolean WINDOW_FULLSCREEN = false; //used to control whether the window is created fullscreen or not (ie for testing)
//title bar dimensions
public static int WINDOW_TITLE_BAR_HEIGHT = 0;

View File

@ -243,7 +243,7 @@ public class RenderingEngine {
// glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); Allows you to make the background transparent
// glfwWindowHint(GLFW_OPACITY, 23);
//Creates the window reference object
if(Globals.userSettings.displayFullscreen()){
if(Globals.userSettings.displayFullscreen() || Globals.WINDOW_FULLSCREEN){
//below line is for fullscreen
Globals.window = glfwCreateWindow(Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT, "ORPG", glfwGetPrimaryMonitor(), NULL);
} else {

View File

@ -1,13 +1,11 @@
package electrosphere.renderer.ui.elements;
import annotations.IntegrationTest;
import electrosphere.logger.Logger;
import electrosphere.logger.LoggerInterface;
import electrosphere.logger.Logger.LogLevel;
import electrosphere.menu.WindowUtils;
import electrosphere.menu.mainmenu.MenuGeneratorsUITesting;
import template.RenderingTestTemplate;
import testutils.TestEngineUtils;
import testutils.TestRenderingUtils;
/**
* Tests for the window class
@ -23,9 +21,6 @@ public class WindowTest extends RenderingTestTemplate {
TestEngineUtils.simulateFrames(1);
WindowUtils.replaceMainMenuContents(MenuGeneratorsUITesting.createUITestMenu());
for(Logger logger : LoggerInterface.getLoggers()){
logger.setLevel(LogLevel.LOOP_DEBUG);
}
//only simulating 1 frame after updating ui contents does not trigger re-render in local dev environment, but DOES in CI env
//2 frames seems to fix this
TestEngineUtils.simulateFrames(2);

View File

@ -20,6 +20,7 @@ public abstract class RenderingTestTemplate {
@IntegrationSetup
public void initEngine(){
Globals.WINDOW_DECORATED = false;
Globals.WINDOW_FULLSCREEN = true;
Globals.WINDOW_WIDTH = 1920;
Globals.WINDOW_HEIGHT = 1080;
TestEngineUtils.initGraphicalEngine();

View File

@ -34,16 +34,23 @@ public class TestRenderingUtils {
}
BufferedImage screenshot = RenderingEngine.defaultFramebuffer.getPixels(Globals.renderingEngine.getOpenGLState());
//check basic data
//
//width
if(testData.getWidth() != screenshot.getWidth()){
onFailure.run();
}
assertEquals(screenshot.getHeight(), testData.getHeight());
if(testData.getWidth() != screenshot.getWidth()){
onFailure.run();
}
assertEquals(screenshot.getHeight(), testData.getHeight());
assertEquals(testData.getWidth(), screenshot.getWidth());
//
//height
if(testData.getHeight() != screenshot.getHeight()){
onFailure.run();
}
assertEquals(testData.getHeight(), screenshot.getHeight());
//
//pixel-by-pixel check
//
for(int x = 0; x < testData.getWidth(); x++){
for(int y = 0; y < testData.getHeight(); y++){

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB