Add Phase 5: SwapChain tests (3 tests)
- Add SwapChain tests: Initialize, Present, Resize === OpenGL Test Suite Complete === Total: 49 tests across all phases: - Phase 1: Device, Buffer, Fence (17 tests) - Phase 2: Texture, Sampler (9 tests) - Phase 3: Shader, PipelineState, VertexArray (11 tests) - Phase 4: CommandList, RTV, DSV (9 tests) - Phase 5: SwapChain (3 tests)
This commit is contained in:
@@ -31,6 +31,7 @@ set(TEST_SOURCES
|
||||
test_command_list.cpp
|
||||
test_render_target_view.cpp
|
||||
test_depth_stencil_view.cpp
|
||||
test_swap_chain.cpp
|
||||
)
|
||||
|
||||
add_executable(opengl_engine_tests ${TEST_SOURCES})
|
||||
|
||||
41
tests/RHI/OpenGL/test_swap_chain.cpp
Normal file
41
tests/RHI/OpenGL/test_swap_chain.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "fixtures/OpenGLTestFixture.h"
|
||||
#include "XCEngine/RHI/OpenGL/OpenGLSwapChain.h"
|
||||
|
||||
using namespace XCEngine::RHI;
|
||||
|
||||
TEST_F(OpenGLTestFixture, SwapChain_Initialize_Window) {
|
||||
OpenGLSwapChain swapChain;
|
||||
GLFWwindow* window = GetWindow();
|
||||
|
||||
bool result = swapChain.Initialize(window, 800, 600);
|
||||
|
||||
ASSERT_TRUE(result);
|
||||
|
||||
swapChain.Shutdown();
|
||||
}
|
||||
|
||||
TEST_F(OpenGLTestFixture, SwapChain_Present) {
|
||||
OpenGLSwapChain swapChain;
|
||||
GLFWwindow* window = GetWindow();
|
||||
swapChain.Initialize(window, 800, 600);
|
||||
|
||||
swapChain.Present();
|
||||
|
||||
GLenum error = glGetError();
|
||||
EXPECT_EQ(error, GL_NO_ERROR);
|
||||
|
||||
swapChain.Shutdown();
|
||||
}
|
||||
|
||||
TEST_F(OpenGLTestFixture, SwapChain_Resize_ChangesSize) {
|
||||
OpenGLSwapChain swapChain;
|
||||
GLFWwindow* window = GetWindow();
|
||||
swapChain.Initialize(window, 800, 600);
|
||||
|
||||
swapChain.Resize(1024, 768);
|
||||
|
||||
EXPECT_EQ(swapChain.GetWidth(), 1024);
|
||||
EXPECT_EQ(swapChain.GetHeight(), 768);
|
||||
|
||||
swapChain.Shutdown();
|
||||
}
|
||||
Reference in New Issue
Block a user