Add some graphics tests.
This commit is contained in:
parent
8b5f485d1e
commit
32ace0fcac
3 changed files with 49 additions and 6 deletions
|
@ -40,9 +40,8 @@ std::unique_ptr<GlxInterface> GlxInterface::Create()
|
|||
void GlxInterface::SetupContext(Display* display, int default_screen)
|
||||
{
|
||||
/* Query framebuffer configurations that match visual_attribs */
|
||||
GLXFBConfig* fb_configs = nullptr;
|
||||
int num_fb_configs = 0;
|
||||
fb_configs = glXChooseFBConfig(display, default_screen, visual_attribs, &num_fb_configs);
|
||||
GLXFBConfig* fb_configs = glXChooseFBConfig(display, default_screen, visual_attribs, &num_fb_configs);
|
||||
if (!fb_configs || num_fb_configs == 0)
|
||||
{
|
||||
MLOG_ERROR("glXGetFBConfigs failed");
|
||||
|
|
|
@ -9,17 +9,19 @@ target_include_directories(test_utils PUBLIC
|
|||
|
||||
list(APPEND TestFiles
|
||||
audio/TestAudioWriter.cpp
|
||||
audio/TestMidiReader.cpp)
|
||||
audio/TestMidiReader.cpp
|
||||
graphics/TestOpenGlRendering.cpp)
|
||||
|
||||
list(APPEND TestNames
|
||||
TestAudioWriter
|
||||
TestMidiReader)
|
||||
TestMidiReader
|
||||
TestOpenGlRendering)
|
||||
|
||||
foreach(TestFile TestName IN ZIP_LISTS TestFiles TestNames)
|
||||
add_executable(${TestName} ${TestFile})
|
||||
target_link_libraries(${TestName} PUBLIC core network database geometry audio graphics web test_utils)
|
||||
target_link_libraries(${TestName} PUBLIC core network database geometry audio graphics web client test_utils)
|
||||
endforeach()
|
||||
|
||||
|
||||
add_executable(test_runner test_runner.cpp)
|
||||
target_link_libraries(test_runner PUBLIC core network database geometry audio graphics web)
|
||||
target_link_libraries(test_runner PUBLIC core network database geometry audio graphics web client)
|
42
test/graphics/TestOpenGlRendering.cpp
Normal file
42
test/graphics/TestOpenGlRendering.cpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
#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;
|
||||
}
|
Loading…
Reference in a new issue