refactor: RHI抽象层测试支持参数化

- 将RHITestFixture改为TestWithParam<RHIType>,支持D3D12和OpenGL双后端
- 重构RHIFactory.cpp的include结构,修复OpenGL设备创建
- 在CMakeLists.txt中添加XCENGINE_SUPPORT_OPENGL宏定义
- 更新engine/CMakeLists.txt和tests/RHI/unit/CMakeLists.txt
- 将所有TEST_F改为TEST_P以支持参数化测试

测试结果: 138 tests (D3D12: 58 passed / OpenGL: 48 passed)
This commit is contained in:
2026-03-23 19:17:32 +08:00
parent bf44438934
commit 067c82c3a9
14 changed files with 85 additions and 85 deletions

View File

@@ -19,7 +19,7 @@
namespace XCEngine {
namespace RHI {
class RHITestFixture : public ::testing::Test {
class RHITestFixture : public ::testing::TestWithParam<RHIType> {
protected:
void SetUp() override;
void TearDown() override;
@@ -28,10 +28,9 @@ protected:
static void TearDownTestSuite();
RHIDevice* GetDevice() { return mDevice; }
RHIType GetBackendType() const { return mBackendType; }
RHIType GetBackendType() const { return GetParam(); }
private:
static RHIType mBackendType;
RHIDevice* mDevice = nullptr;
};