fullscreen strategy for test rendering
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
4ffbc87c48
commit
6dc82d0b5e
@ -224,6 +224,7 @@ public class Globals {
|
|||||||
public static int WINDOW_WIDTH = 1920;
|
public static int WINDOW_WIDTH = 1920;
|
||||||
public static int WINDOW_HEIGHT = 1080;
|
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_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
|
//title bar dimensions
|
||||||
public static int WINDOW_TITLE_BAR_HEIGHT = 0;
|
public static int WINDOW_TITLE_BAR_HEIGHT = 0;
|
||||||
|
|||||||
@ -243,7 +243,7 @@ public class RenderingEngine {
|
|||||||
// glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); Allows you to make the background transparent
|
// glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); Allows you to make the background transparent
|
||||||
// glfwWindowHint(GLFW_OPACITY, 23);
|
// glfwWindowHint(GLFW_OPACITY, 23);
|
||||||
//Creates the window reference object
|
//Creates the window reference object
|
||||||
if(Globals.userSettings.displayFullscreen()){
|
if(Globals.userSettings.displayFullscreen() || Globals.WINDOW_FULLSCREEN){
|
||||||
//below line is for fullscreen
|
//below line is for fullscreen
|
||||||
Globals.window = glfwCreateWindow(Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT, "ORPG", glfwGetPrimaryMonitor(), NULL);
|
Globals.window = glfwCreateWindow(Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT, "ORPG", glfwGetPrimaryMonitor(), NULL);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
package electrosphere.renderer.ui.elements;
|
package electrosphere.renderer.ui.elements;
|
||||||
|
|
||||||
import annotations.IntegrationTest;
|
import annotations.IntegrationTest;
|
||||||
import electrosphere.logger.Logger;
|
|
||||||
import electrosphere.logger.LoggerInterface;
|
|
||||||
import electrosphere.logger.Logger.LogLevel;
|
|
||||||
import electrosphere.menu.WindowUtils;
|
import electrosphere.menu.WindowUtils;
|
||||||
import electrosphere.menu.mainmenu.MenuGeneratorsUITesting;
|
import electrosphere.menu.mainmenu.MenuGeneratorsUITesting;
|
||||||
import template.RenderingTestTemplate;
|
import template.RenderingTestTemplate;
|
||||||
import testutils.TestEngineUtils;
|
import testutils.TestEngineUtils;
|
||||||
|
import testutils.TestRenderingUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the window class
|
* Tests for the window class
|
||||||
@ -23,9 +21,6 @@ public class WindowTest extends RenderingTestTemplate {
|
|||||||
TestEngineUtils.simulateFrames(1);
|
TestEngineUtils.simulateFrames(1);
|
||||||
WindowUtils.replaceMainMenuContents(MenuGeneratorsUITesting.createUITestMenu());
|
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
|
//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
|
//2 frames seems to fix this
|
||||||
TestEngineUtils.simulateFrames(2);
|
TestEngineUtils.simulateFrames(2);
|
||||||
|
|||||||
@ -20,6 +20,7 @@ public abstract class RenderingTestTemplate {
|
|||||||
@IntegrationSetup
|
@IntegrationSetup
|
||||||
public void initEngine(){
|
public void initEngine(){
|
||||||
Globals.WINDOW_DECORATED = false;
|
Globals.WINDOW_DECORATED = false;
|
||||||
|
Globals.WINDOW_FULLSCREEN = true;
|
||||||
Globals.WINDOW_WIDTH = 1920;
|
Globals.WINDOW_WIDTH = 1920;
|
||||||
Globals.WINDOW_HEIGHT = 1080;
|
Globals.WINDOW_HEIGHT = 1080;
|
||||||
TestEngineUtils.initGraphicalEngine();
|
TestEngineUtils.initGraphicalEngine();
|
||||||
|
|||||||
@ -34,16 +34,23 @@ public class TestRenderingUtils {
|
|||||||
}
|
}
|
||||||
BufferedImage screenshot = RenderingEngine.defaultFramebuffer.getPixels(Globals.renderingEngine.getOpenGLState());
|
BufferedImage screenshot = RenderingEngine.defaultFramebuffer.getPixels(Globals.renderingEngine.getOpenGLState());
|
||||||
//check basic data
|
//check basic data
|
||||||
|
//
|
||||||
|
//width
|
||||||
if(testData.getWidth() != screenshot.getWidth()){
|
if(testData.getWidth() != screenshot.getWidth()){
|
||||||
onFailure.run();
|
onFailure.run();
|
||||||
}
|
}
|
||||||
assertEquals(screenshot.getHeight(), testData.getHeight());
|
assertEquals(testData.getWidth(), screenshot.getWidth());
|
||||||
if(testData.getWidth() != screenshot.getWidth()){
|
|
||||||
onFailure.run();
|
|
||||||
}
|
|
||||||
assertEquals(screenshot.getHeight(), testData.getHeight());
|
|
||||||
|
|
||||||
|
//
|
||||||
|
//height
|
||||||
|
if(testData.getHeight() != screenshot.getHeight()){
|
||||||
|
onFailure.run();
|
||||||
|
}
|
||||||
|
assertEquals(testData.getHeight(), screenshot.getHeight());
|
||||||
|
|
||||||
|
//
|
||||||
//pixel-by-pixel check
|
//pixel-by-pixel check
|
||||||
|
//
|
||||||
for(int x = 0; x < testData.getWidth(); x++){
|
for(int x = 0; x < testData.getWidth(); x++){
|
||||||
for(int y = 0; y < testData.getHeight(); y++){
|
for(int y = 0; y < testData.getHeight(); y++){
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Loading…
Reference in New Issue
Block a user