-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVideoCard_UnitTest.cpp
More file actions
42 lines (35 loc) · 1.45 KB
/
VideoCard_UnitTest.cpp
File metadata and controls
42 lines (35 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "pch.h"
#include "VideoCard_UnitTest.h"
#include "CppUnitTest.h"
#include <dxgi.h>
#include <wrl/client.h>
#include <string>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using Microsoft::WRL::ComPtr;
namespace BasicGameEngine_UnitTests
{
TEST_CLASS(VideoCardTests)
{
public:
TEST_METHOD(TestEnumerateVideoCards)
{
// Create a DXGI factory
ComPtr<IDXGIFactory> factory;
HRESULT hr = CreateDXGIFactory(__uuidof(IDXGIFactory), reinterpret_cast<void**>(factory.GetAddressOf()));
Assert::IsTrue(SUCCEEDED(hr), L"Failed to create DXGIFactory.");
// Enumerate the first adapter (video card)
ComPtr<IDXGIAdapter> adapter;
hr = factory->EnumAdapters(0, &adapter);
Assert::IsTrue(SUCCEEDED(hr), L"No video adapter found.");
// Retrieve the adapter description
DXGI_ADAPTER_DESC adapterDesc = {};
hr = adapter->GetDesc(&adapterDesc);
Assert::IsTrue(SUCCEEDED(hr), L"Failed to get adapter description.");
// Convert the wide string description to a wstring
std::wstring adapterDescription(adapterDesc.Description);
Logger::WriteMessage((L"Video Card: " + adapterDescription).c_str());
// Assert that the description is not empty
Assert::IsFalse(adapterDescription.empty(), L"Adapter description is empty.");
}
};
}