stuff-from-scratch/test/graphics/TestOpenGlRendering.cpp
2021-09-26 13:40:52 +01:00

42 lines
1.1 KiB
C++

#include "DesktopManager.h"
#include "XcbInterface.h"
#include "TestCase.h"
#include "TestCaseRunner.h"
#include <memory>
#include <string>
#include <iostream>
class TestOpenGlRendering : public TestCase
{
public:
bool Run() override
{
auto desktopManager = DesktopManager::Create();
auto mainWindow = desktopManager->GetWindowManager()->GetMainWindow();
mainWindow->SetSize(800, 600);
bool useOpenGl = true;
XcbInterface window_interface;
window_interface.SetUseOpenGl(true);
window_interface.Initialize(desktopManager.get());
window_interface.AddWindow(mainWindow, desktopManager.get());
window_interface.ShowWindow(mainWindow);
window_interface.CreateOpenGlDrawable(mainWindow);
window_interface.Loop(desktopManager.get());
window_interface.ShutDown();
return true;
}
};
int main()
{
TestCaseRunner runner;
runner.AddTestCase("TestOpenGlRendering", std::make_unique<TestOpenGlRendering>());
const auto testsPassed = runner.Run();
return testsPassed ? 0 : -1;
}