stuff-from-scratch/test/graphics/TestDirectXRendering.cpp

37 lines
909 B
C++
Raw Normal View History

2023-01-05 13:16:52 +00:00
#include "TestCase.h"
#include "TestCaseRunner.h"
2023-01-05 16:40:27 +00:00
#include "TestUiApplication.h"
2023-01-05 13:16:52 +00:00
#include "TestFramework.h"
2023-01-05 16:40:27 +00:00
#include "DesktopManager.h"
#include "MeshPrimitives.h"
#include "MeshNode.h"
2023-01-05 16:57:46 +00:00
#include "TextNode.h"
2023-01-05 16:40:27 +00:00
#include "Scene.h"
#include "Widget.h"
2023-01-05 13:16:52 +00:00
#include <memory>
#include <string>
#include <iostream>
TEST_CASE(TestDirectXRendering, "graphics")
{
auto gui_app = TestCaseRunner::getInstance().getTestApplication();
2023-01-05 16:40:27 +00:00
auto drawing_context = gui_app->getDesktopManager()->getWindowManager()->getMainWindow();
auto scene = drawing_context->getScene();
auto mesh = MeshPrimitives::buildRectangleAsTriMesh();
auto mesh_node = std::make_unique<MeshNode>(DiscretePoint(0, 0));
mesh_node->setMesh(mesh.get());
scene->addNode(mesh_node.get());
2023-01-05 16:57:46 +00:00
auto text_node = std::make_unique<TextNode>("Test", DiscretePoint(100, 100));
scene->addNode(text_node.get());
2023-01-05 16:40:27 +00:00
scene->update(nullptr);
2023-01-05 13:16:52 +00:00
gui_app->run();
};