OpenGL: Restructure tests similar to D3D12 layout
- Move old test files to new unit/integration structure - Add OpenGL Test Fixture - Update CMakeLists.txt for new layout - Add OpenGL_Test_Restructuring_Plan.md
This commit is contained in:
41
tests/RHI/OpenGL/unit/test_swap_chain.cpp
Normal file
41
tests/RHI/OpenGL/unit/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