- triangle/quad/sphere tests: Update to use new Initialize signature with OpenGLDevice* - triangle/quad/sphere tests: Use GetGLContext() for RenderDoc SetDevice - triangle/quad/sphere tests: Add wglMakeCurrent in render loop - triangle/quad/sphere tests: Update capture timing to frame 25-35 - unit test fixture: Add GetDevice() method - unit test swap_chain: Update to use new Initialize signature
42 lines
1023 B
C++
42 lines
1023 B
C++
#include "fixtures/OpenGLTestFixture.h"
|
|
#include "XCEngine/RHI/OpenGL/OpenGLSwapChain.h"
|
|
|
|
using namespace XCEngine::RHI;
|
|
|
|
TEST_F(OpenGLTestFixture, SwapChain_Initialize_Window) {
|
|
OpenGLSwapChain swapChain;
|
|
HWND window = GetWindow();
|
|
|
|
bool result = swapChain.Initialize(GetDevice(), window, 800, 600);
|
|
|
|
ASSERT_TRUE(result);
|
|
|
|
swapChain.Shutdown();
|
|
}
|
|
|
|
TEST_F(OpenGLTestFixture, SwapChain_Present) {
|
|
OpenGLSwapChain swapChain;
|
|
HWND window = GetWindow();
|
|
swapChain.Initialize(GetDevice(), window, 800, 600);
|
|
|
|
swapChain.Present();
|
|
|
|
GLenum error = glGetError();
|
|
EXPECT_EQ(error, GL_NO_ERROR);
|
|
|
|
swapChain.Shutdown();
|
|
}
|
|
|
|
TEST_F(OpenGLTestFixture, SwapChain_Resize_ChangesSize) {
|
|
OpenGLSwapChain swapChain;
|
|
HWND window = GetWindow();
|
|
swapChain.Initialize(GetDevice(), window, 800, 600);
|
|
|
|
swapChain.Resize(1024, 768);
|
|
|
|
EXPECT_EQ(swapChain.GetWidth(), 1024);
|
|
EXPECT_EQ(swapChain.GetHeight(), 768);
|
|
|
|
swapChain.Shutdown();
|
|
}
|