Clean up fontsmanager

This commit is contained in:
jmsgrogan 2023-01-12 11:54:08 +00:00
parent 076e32b1d6
commit 64f0b3e77a
26 changed files with 111 additions and 89 deletions

View file

@ -67,23 +67,23 @@ void MainApplication::initialize(CommandLineArgsUPtr commandLineArgs, std::uniqu
void MainApplication::run() void MainApplication::run()
{ {
std::string program_type; std::string program_type;
if(mCommandLineArgs->getNumberOfArgs() > 1) if(mCommandLineArgs->getArgs().size() > 1)
{ {
program_type = mCommandLineArgs->getArg(1); program_type = mCommandLineArgs->getArgs()[1];
} }
std::string input_path; std::string input_path;
std::string output_path; std::string output_path;
for(unsigned idx=1; idx<mCommandLineArgs->getNumberOfArgs(); idx++) for(unsigned idx=1; idx< mCommandLineArgs->getArgs().size(); idx++)
{ {
auto arg = mCommandLineArgs->getArg(idx); auto arg = mCommandLineArgs->getArgs()[idx];
if(arg == "-input" && mCommandLineArgs->getNumberOfArgs() > idx+1) if(arg == "-input" && mCommandLineArgs->getArgs().size() > idx+1)
{ {
input_path = mCommandLineArgs->getArg(idx + 1); input_path = mCommandLineArgs->getArgs()[idx + 1];
} }
else if(arg == "-output" && mCommandLineArgs->getNumberOfArgs() > idx+1) else if(arg == "-output" && mCommandLineArgs->getArgs().size() > idx+1)
{ {
output_path = mCommandLineArgs->getArg(idx + 1); output_path = mCommandLineArgs->getArgs()[idx + 1];
} }
} }

View file

@ -61,20 +61,6 @@ void CommandLineArgs::process(const std::vector<std::string>& args)
mArugments = args; mArugments = args;
} }
std::size_t CommandLineArgs::getNumberOfArgs() const
{
return mArugments.size();
}
std::string CommandLineArgs::getArg(std::size_t index) const
{
if(index<mArugments.size())
{
return mArugments[index];
}
return "";
}
std::vector<std::string> CommandLineArgs::getUserArgs() const std::vector<std::string> CommandLineArgs::getUserArgs() const
{ {
std::vector<std::string> user_args; std::vector<std::string> user_args;
@ -84,3 +70,8 @@ std::vector<std::string> CommandLineArgs::getUserArgs() const
} }
return user_args; return user_args;
} }
const std::vector<std::string> CommandLineArgs::getArgs() const
{
return mArugments;
}

View file

@ -7,16 +7,13 @@
class CommandLineArgs class CommandLineArgs
{ {
public: public:
CommandLineArgs(); CommandLineArgs();
static std::unique_ptr<CommandLineArgs> Create(); static std::unique_ptr<CommandLineArgs> Create();
std::filesystem::path getLaunchPath(); std::filesystem::path getLaunchPath();
std::size_t getNumberOfArgs() const; const std::vector<std::string> getArgs() const;
std::string getArg(std::size_t index) const;
void process(int argc, char *argv[]); void process(int argc, char *argv[]);

View file

@ -8,11 +8,11 @@
#include "FontGlyph.h" #include "FontGlyph.h"
FontsManager::FontsManager() FontsManager::FontsManager()
{ {
#ifdef HAS_FREETYPE #ifdef HAS_FREETYPE
mFontEngine = std::make_unique<FreeTypeFontEngine>(); mFontEngine = std::make_unique<FreeTypeFontEngine>();
mUsesGlyphs = true;
#else #else
mFontEngine = std::make_unique<BasicFontEngine>(); mFontEngine = std::make_unique<BasicFontEngine>();
#endif #endif
@ -24,6 +24,11 @@ std::unique_ptr<FontsManager> FontsManager::Create()
return std::make_unique<FontsManager>(); return std::make_unique<FontsManager>();
} }
bool FontsManager::usesGlyphs() const
{
return mUsesGlyphs;
}
IFontEngine* FontsManager::getFontEngine() const IFontEngine* FontsManager::getFontEngine() const
{ {
return mFontEngine.get(); return mFontEngine.get();

View file

@ -1,12 +1,12 @@
#pragma once #pragma once
#include "IFontEngine.h"
#include "FontGlyph.h"
#include <memory> #include <memory>
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
class IFontEngine;
class FontGlyph;
class FontsManager class FontsManager
{ {
public: public:
@ -15,11 +15,13 @@ public:
IFontEngine* getFontEngine() const; IFontEngine* getFontEngine() const;
bool usesGlyphs() const;
FontGlyph* getGlyph(const std::string& fontFace, int size, uint32_t c); FontGlyph* getGlyph(const std::string& fontFace, int size, uint32_t c);
private: private:
bool mUsesGlyphs{ false };
std::unique_ptr<IFontEngine> mFontEngine; std::unique_ptr<IFontEngine> mFontEngine;
std::unordered_map<uint32_t, std::unique_ptr<FontGlyph> > mGlyphs; std::unordered_map<uint32_t, std::unique_ptr<FontGlyph> > mGlyphs;
}; };

View file

@ -108,9 +108,19 @@ void DirectXMeshPainter::updateBuffers(DrawingContext* context)
auto scene = context->getSurface()->getScene(); auto scene = context->getSurface()->getScene();
for (const auto item : scene->getItems()) for (const auto item : scene->getItems())
{ {
if (item->getType() == SceneItem::Type::MODEL && item->isVisible()) if (!item->isVisible())
{
continue;
}
if (item->getType() == SceneItem::Type::MODEL)
{ {
auto model = dynamic_cast<SceneModel*>(item); auto model = dynamic_cast<SceneModel*>(item);
if (model->getGeometry())
{
continue;
}
auto dx_mesh = std::make_unique<DirectXMesh>(model); auto dx_mesh = std::make_unique<DirectXMesh>(model);
dx_mesh->update(context, mDxInterface->getD3dDevice()); dx_mesh->update(context, mDxInterface->getD3dDevice());
mDxMeshes.push_back(std::move(dx_mesh)); mDxMeshes.push_back(std::move(dx_mesh));

View file

@ -84,14 +84,14 @@ void DirectXPainter::initializeDxInterface()
void DirectXPainter::resetPainters() void DirectXPainter::resetPainters()
{ {
m2dPainter->setD2dInterface(mDxInterface->getD2dInterface()); m2dPainter->setD2dInterface(getDxInterface()->getD2dInterface());
mTextPainter->setD2dInterface(mDxInterface->getD2dInterface()); mTextPainter->setD2dInterface(getDxInterface()->getD2dInterface());
mMeshPainter->setDxInterface(getDxInterface()); mMeshPainter->setDxInterface(getDxInterface());
} }
void DirectXPainter::paint() void DirectXPainter::paint()
{ {
if (!mDxInterface) if (!getDxInterface())
{ {
initializeDxInterface(); initializeDxInterface();
} }

View file

@ -6,8 +6,6 @@
#include "FontsManager.h" #include "FontsManager.h"
#include "FontGlyph.h" #include "FontGlyph.h"
#include "DirectXShaderProgram.h"
#include "TextData.h" #include "TextData.h"
#include "SceneText.h" #include "SceneText.h"
#include "DirectX2dInterface.h" #include "DirectX2dInterface.h"

View file

@ -23,7 +23,7 @@
namespace mt namespace mt
{ {
Window::Window() Window::Window(DrawingMode drawingMode, FontsManager* fontsManager)
: DrawingSurface(), : DrawingSurface(),
mWidget(Widget::Create()) mWidget(Widget::Create())
{ {
@ -31,6 +31,8 @@ Window::Window()
mHeight = 600; mHeight = 600;
mWidget->setBounds(mWidth, mHeight); mWidget->setBounds(mWidth, mHeight);
mWidget->setWindow(this); mWidget->setWindow(this);
mDrawingContext = std::make_unique<DrawingContext>(this, fontsManager, drawingMode);
} }
Window::~Window() Window::~Window()
@ -38,9 +40,9 @@ Window::~Window()
} }
std::unique_ptr<Window> Window::Create() std::unique_ptr<Window> Window::Create(DrawingMode drawingMode, FontsManager* fontsManager)
{ {
return std::make_unique<Window>(); return std::make_unique<Window>(drawingMode, fontsManager);
} }
void Window::setIsSizingOnGoing(bool sizingOngoing) void Window::setIsSizingOnGoing(bool sizingOngoing)
@ -117,10 +119,9 @@ IPlatformWindow* Window::getPlatformWindow() const
return nullptr; return nullptr;
} }
void Window::setPlatformWindow(IPlatformWindowPtr window, FontsManager* fontsManager, DrawingMode drawingMode) void Window::setPlatformWindow(IPlatformWindowPtr window)
{ {
mPlatformWindow = std::move(window); mPlatformWindow = std::move(window);
mDrawingContext = std::make_unique<DrawingContext>(this, fontsManager, drawingMode);
} }
void Window::map() void Window::map()

View file

@ -2,6 +2,8 @@
#include "DrawingSurface.h" #include "DrawingSurface.h"
#include "DisplayState.h" #include "DisplayState.h"
#include "DrawingContext.h"
#include "Widget.h"
#include <memory> #include <memory>
#include <vector> #include <vector>
@ -17,7 +19,6 @@ class DrawingContext;
class FontsManager; class FontsManager;
enum class DrawingMode; enum class DrawingMode;
class Widget;
using WidgetPtr = std::unique_ptr<Widget>; using WidgetPtr = std::unique_ptr<Widget>;
class IPlatformWindow; class IPlatformWindow;
using IPlatformWindowPtr = std::unique_ptr<IPlatformWindow>; using IPlatformWindowPtr = std::unique_ptr<IPlatformWindow>;
@ -33,11 +34,11 @@ class Window : public DrawingSurface
public: public:
using onPopupFunc = std::function<void(mt::Window* parent, std::unique_ptr<Widget> popup)>; using onPopupFunc = std::function<void(mt::Window* parent, std::unique_ptr<Widget> popup)>;
Window(); Window(DrawingMode drawingMode = DrawingMode::GRAPH, FontsManager* fontsManager = nullptr);
~Window(); ~Window();
static std::unique_ptr<Window> Create(); static std::unique_ptr<Window> Create(DrawingMode drawingMode = DrawingMode::GRAPH, FontsManager* fontsManager = nullptr);
void addPopup(std::unique_ptr<Widget> popupWidget); void addPopup(std::unique_ptr<Widget> popupWidget);
@ -71,7 +72,7 @@ public:
void onKeyboardEvent(const KeyboardEvent* event); void onKeyboardEvent(const KeyboardEvent* event);
void setPlatformWindow(IPlatformWindowPtr window, FontsManager* fontsManager, DrawingMode drawingMode); void setPlatformWindow(IPlatformWindowPtr window);
void setPopupHandler(onPopupFunc func); void setPopupHandler(onPopupFunc func);

View file

@ -107,7 +107,7 @@ std::size_t TextNode::getNumSceneItems() const
void TextNode::updateLines(FontsManager* fontsManager) void TextNode::updateLines(FontsManager* fontsManager)
{ {
if (!fontsManager) if (!fontsManager || !fontsManager->usesGlyphs())
{ {
return; return;
} }

View file

@ -79,9 +79,13 @@ endif()
list(APPEND windows_LIB_INCLUDES list(APPEND windows_LIB_INCLUDES
ui_interfaces/AbstractUiInterface.h ui_interfaces/AbstractUiInterface.h
ui_interfaces/UiInterfaceFactory.cpp ui_interfaces/UiInterfaceFactory.cpp
managers/WindowManager.h
managers/DesktopManager.h
managers/EventManager.h
managers/WindowManager.cpp managers/WindowManager.cpp
managers/DesktopManager.cpp managers/DesktopManager.cpp
managers/EventManager.cpp) managers/EventManager.cpp
)
# add the library # add the library
add_library(windows SHARED ${windows_LIB_INCLUDES} ${platform_INCLUDES}) add_library(windows SHARED ${windows_LIB_INCLUDES} ${platform_INCLUDES})

View file

@ -12,7 +12,8 @@ DesktopManager::DesktopManager(AbstractDesktopApp* application)
: mScreens(), : mScreens(),
mKeyboard(Keyboard::Create()), mKeyboard(Keyboard::Create()),
mUiApplication(application), mUiApplication(application),
mEventManager(EventManager::Create()) mEventManager(EventManager::Create()),
mFontsManager(FontsManager::Create())
{ {
mWindowManager = WindowManager::Create(this); mWindowManager = WindowManager::Create(this);
} }
@ -32,6 +33,11 @@ void DesktopManager::clearEvents()
mEventManager->ClearEvents(); mEventManager->ClearEvents();
} }
FontsManager* DesktopManager::getFontsManager() const
{
return mFontsManager.get();
}
void DesktopManager::onKeyboardEvent(const KeyboardEvent* event) void DesktopManager::onKeyboardEvent(const KeyboardEvent* event)
{ {
mWindowManager->onKeyboardEvent(event); mWindowManager->onKeyboardEvent(event);

View file

@ -12,13 +12,13 @@
#include "UiEvent.h" #include "UiEvent.h"
#include "AbstractApp.h" #include "AbstractApp.h"
#include "EventManager.h" #include "EventManager.h"
#include "FontsManager.h"
class AbstractDesktopApp; class AbstractDesktopApp;
class DesktopManager class DesktopManager
{ {
public: public:
DesktopManager(AbstractDesktopApp* application); DesktopManager(AbstractDesktopApp* application);
~DesktopManager(); ~DesktopManager();
@ -33,6 +33,8 @@ public:
Keyboard* getKeyboard() const; Keyboard* getKeyboard() const;
FontsManager* getFontsManager() const;
void addScreen(ScreenPtr screen); void addScreen(ScreenPtr screen);
mt::Screen* getDefaultScreen() const; mt::Screen* getDefaultScreen() const;
@ -55,6 +57,8 @@ public:
private: private:
std::vector<ScreenPtr> mScreens; std::vector<ScreenPtr> mScreens;
FontsManagerPtr mFontsManager;
WindowManagerUPtr mWindowManager; WindowManagerUPtr mWindowManager;
KeyboardUPtr mKeyboard; KeyboardUPtr mKeyboard;
EventManagerUPtr mEventManager; EventManagerUPtr mEventManager;

View file

@ -1,15 +1,12 @@
#include "WindowManager.h" #include "WindowManager.h"
#include "DesktopManager.h" #include "DesktopManager.h"
#include "Widget.h"
#include <iostream>
WindowManager::WindowManager(DesktopManager* desktopManager) WindowManager::WindowManager(DesktopManager* desktopManager)
: mWindows(), : mWindows(),
mDesktopManager(desktopManager) mDesktopManager(desktopManager)
{ {
addWindow(mt::Window::Create()); addWindow(mt::Window::Create(mDrawMode, desktopManager->getFontsManager()));
} }
WindowManager::~WindowManager() WindowManager::~WindowManager()
@ -53,7 +50,7 @@ void WindowManager::addWindow(WindowUPtr window)
void WindowManager::onAddPopupWindow(mt::Window* parent, std::unique_ptr<Widget> widget) void WindowManager::onAddPopupWindow(mt::Window* parent, std::unique_ptr<Widget> widget)
{ {
auto popup = mt::Window::Create(); auto popup = mt::Window::Create(mDrawMode, mDesktopManager->getFontsManager());
popup->setWidget(std::move(widget)); popup->setWidget(std::move(widget));
popup->setParent(parent); popup->setParent(parent);

View file

@ -4,6 +4,8 @@
#include <memory> #include <memory>
#include "Window.h" #include "Window.h"
#include "DrawingContext.h"
#include "PaintEvent.h" #include "PaintEvent.h"
#include "MouseEvent.h" #include "MouseEvent.h"
#include "ResizeEvent.h" #include "ResizeEvent.h"
@ -51,6 +53,7 @@ public:
private: private:
std::vector<WindowUPtr> mWindows; std::vector<WindowUPtr> mWindows;
DrawingMode mDrawMode{ DrawingMode::GRAPH };
DesktopManager* mDesktopManager{nullptr}; DesktopManager* mDesktopManager{nullptr};
}; };

View file

@ -1,9 +1,6 @@
#pragma once #pragma once
#include <memory> #include <memory>
#include "IFontEngine.h"
#include "FontsManager.h"
#include "FontGlyph.h"
namespace mt namespace mt
{ {
@ -11,16 +8,14 @@ namespace mt
} }
class DesktopManager; class DesktopManager;
class FontsManager;
class AbstractUIInterface class AbstractUIInterface
{ {
public: public:
AbstractUIInterface(DesktopManager* desktopManager, std::unique_ptr<FontsManager> fontsManager, bool useHardware = false) AbstractUIInterface(DesktopManager* desktopManager, bool useHardware = false)
: mDesktopManager(desktopManager), : mDesktopManager(desktopManager),
mUseHardwareRendering(useHardware), mUseHardwareRendering(useHardware)
mFontsManager(std::move(fontsManager))
{ {
} }
@ -39,7 +34,5 @@ protected:
virtual void initializeHardwareRendering() {}; virtual void initializeHardwareRendering() {};
DesktopManager* mDesktopManager{nullptr}; DesktopManager* mDesktopManager{nullptr};
std::unique_ptr<FontsManager> mFontsManager;
bool mUseHardwareRendering{false}; bool mUseHardwareRendering{false};
}; };

View file

@ -8,8 +8,8 @@ class NullUIInterface : public AbstractUIInterface
{ {
public: public:
NullUIInterface(DesktopManager* desktopManager, std::unique_ptr<FontsManager> fontsManager, bool useHardware = false) NullUIInterface(DesktopManager* desktopManager, bool useHardware = false)
: AbstractUIInterface(desktopManager, std::move(fontsManager), useHardware) : AbstractUIInterface(desktopManager, useHardware)
{ {
}; };

View file

@ -13,38 +13,36 @@
#include "NullUiInterface.h" #include "NullUiInterface.h"
#include "FontsManager.h"
#include "Widget.h" #include "Widget.h"
std::unique_ptr<AbstractUIInterface> UiInterfaceFactory::create(DesktopManager* desktopManager, Backend backend) std::unique_ptr<AbstractUIInterface> UiInterfaceFactory::create(DesktopManager* desktopManager, Backend backend)
{ {
auto fonts_manager = std::make_unique<FontsManager>();
#ifdef __linux__ #ifdef __linux__
if (backend == Backend::UNSET || backend == Backend::X11 || backend == Backend::X11_RASTER) if (backend == Backend::UNSET || backend == Backend::X11 || backend == Backend::X11_RASTER)
{ {
#ifdef HAS_X11 #ifdef HAS_X11
const bool use_hardware = (backend != Backend::X11_RASTER); const bool use_hardware = (backend != Backend::X11_RASTER);
return std::make_unique<XcbInterface>(desktopManager, std::move(fonts_manager), use_hardware); return std::make_unique<XcbInterface>(desktopManager, use_hardware);
#else #else
return std::make_unique<NullUIInterface>(desktopManager, std::move(fonts_manager)); return std::make_unique<NullUIInterface>(desktopManager);
#endif #endif
} }
else else
{ {
#ifdef HAS_WAYLAND #ifdef HAS_WAYLAND
const bool use_hardware = (backend != Backend::WAYLAND_RASTER); const bool use_hardware = (backend != Backend::WAYLAND_RASTER);
return std::make_unique<WaylandInterface>(desktopManager, std::move(fonts_manager), use_hardware); return std::make_unique<WaylandInterface>(desktopManager, use_hardware);
#else #else
#ifdef HAS_X11 #ifdef HAS_X11
const bool use_hardware = (backend != Backend::X11_RASTER); const bool use_hardware = (backend != Backend::X11_RASTER);
return std::make_unique<XcbInterface>(desktopManager, std::move(fonts_manager), use_hardware); return std::make_unique<XcbInterface>(desktopManager, use_hardware);
#else #else
return std::make_unique<NullUIInterface>(desktopManager, std::move(fonts_manager)); return std::make_unique<NullUIInterface>(desktopManager);
#endif #endif
#endif #endif
} }
#else #else
return std::make_unique<Win32UIInterface>(desktopManager, std::move(fonts_manager), true); return std::make_unique<Win32UIInterface>(desktopManager, true);
#endif #endif
} }

View file

@ -1,6 +1,5 @@
#include "Win32UIInterface.h" #include "Win32UIInterface.h"
#include "Widget.h"
#include "DesktopManager.h" #include "DesktopManager.h"
#include "DirectXInterface.h" #include "DirectXInterface.h"
#include "DirectX2dInterface.h" #include "DirectX2dInterface.h"
@ -10,8 +9,8 @@
#include <dxgi1_6.h> #include <dxgi1_6.h>
#include <Windows.h> #include <Windows.h>
Win32UIInterface::Win32UIInterface(DesktopManager* desktopManager, std::unique_ptr<FontsManager> fontsManager, bool useHardware) Win32UIInterface::Win32UIInterface(DesktopManager* desktopManager, bool useHardware)
: AbstractUIInterface(desktopManager, std::move(fontsManager), useHardware), : AbstractUIInterface(desktopManager, useHardware),
mWindowInterface(std::make_unique<Win32WindowInterface>()) mWindowInterface(std::make_unique<Win32WindowInterface>())
{ {

View file

@ -13,7 +13,7 @@ using DirectXInterfacePtr = std::unique_ptr<DirectXInterface>;
class Win32UIInterface : public AbstractUIInterface class Win32UIInterface : public AbstractUIInterface
{ {
public: public:
Win32UIInterface(DesktopManager* desktopManager, std::unique_ptr<FontsManager> fontsManager, bool useHardware = false); Win32UIInterface(DesktopManager* desktopManager, bool useHardware = false);
~Win32UIInterface() = default; ~Win32UIInterface() = default;

View file

@ -29,7 +29,7 @@ void Win32WindowInterface::add(mt::Window* window, DesktopManager* desktopManage
auto win32_window = Win32Window::Create(window, dxInterface); auto win32_window = Win32Window::Create(window, dxInterface);
win32_window->createNative(context, desktopManager); win32_window->createNative(context, desktopManager);
win32_window->setCmdShow(context->nCmdShow); win32_window->setCmdShow(context->nCmdShow);
window->setPlatformWindow(std::move(win32_window), nullptr, DrawingMode::GRAPH); window->setPlatformWindow(std::move(win32_window));
window->getPlatformWindow()->beforePaint(nullptr); window->getPlatformWindow()->beforePaint(nullptr);
} }

View file

@ -1,16 +1,8 @@
#include "TestCase.h"
#include "TestCaseRunner.h"
#include "TestUiApplication.h" #include "TestUiApplication.h"
#include "TestFramework.h" #include "TestFramework.h"
#include "DesktopManager.h" #include "RectangleNode.h"
#include "MeshPrimitives.h"
#include "MeshNode.h"
#include "TextNode.h" #include "TextNode.h"
#include "Scene.h"
#include "Widget.h"
#include <memory> #include <memory>
#include <string> #include <string>
@ -18,5 +10,15 @@
TEST_CASE(TestD2dRendering, "graphics") TEST_CASE(TestD2dRendering, "graphics")
{ {
auto gui_app = TestCaseRunner::getInstance().getTestApplication();
auto scene = gui_app->getMainWindowScene();
auto rect = std::make_unique<RectangleNode>(Point(10, 10), 200.0, 200.0);
scene->addNode(rect.get());
auto text_node = std::make_unique<TextNode>("Test2", Point(100, 100));
scene->addNode(text_node.get());
scene->update();
gui_app->run();
}; };

View file

@ -1,6 +1,7 @@
#include "TestUiApplication.h" #include "TestUiApplication.h"
#include "MainApplication.h" #include "MainApplication.h"
#include "DesktopManager.h"
TestUiApplication::TestUiApplication(std::unique_ptr<CommandLineArgs> args, std::unique_ptr<MainApplication> mainApp) TestUiApplication::TestUiApplication(std::unique_ptr<CommandLineArgs> args, std::unique_ptr<MainApplication> mainApp)
: GuiApplication(std::move(args), std::move(mainApp)) : GuiApplication(std::move(args), std::move(mainApp))
@ -11,4 +12,9 @@ TestUiApplication::TestUiApplication(std::unique_ptr<CommandLineArgs> args, std:
DesktopManager* TestUiApplication::getDesktopManager() const DesktopManager* TestUiApplication::getDesktopManager() const
{ {
return mDesktopManager.get(); return mDesktopManager.get();
}
Scene* TestUiApplication::getMainWindowScene() const
{
return mDesktopManager->getWindowManager()->getMainWindow()->getScene();
} }

View file

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "GuiApplication.h" #include "GuiApplication.h"
#include "Scene.h"
#include <memory> #include <memory>
@ -10,4 +11,6 @@ public:
TestUiApplication(std::unique_ptr<CommandLineArgs> args = nullptr, std::unique_ptr<MainApplication> mainApp = nullptr); TestUiApplication(std::unique_ptr<CommandLineArgs> args = nullptr, std::unique_ptr<MainApplication> mainApp = nullptr);
DesktopManager* getDesktopManager() const; DesktopManager* getDesktopManager() const;
Scene* getMainWindowScene() const;
}; };

View file

@ -23,6 +23,8 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
auto args = CommandLineArgs::Create(); auto args = CommandLineArgs::Create();
CommandLineArgs::initialize(args.get()); CommandLineArgs::initialize(args.get());
const auto user_args = args->getUserArgs();
auto main_app = MainApplication::Create(); auto main_app = MainApplication::Create();
auto applicationContext = std::make_unique<Win32ApplicationContext>(); auto applicationContext = std::make_unique<Win32ApplicationContext>();
@ -41,7 +43,7 @@ int main(int argc, char *argv[])
#endif #endif
TestCaseRunner::getInstance().setTestApplication(gui_app.get()); TestCaseRunner::getInstance().setTestApplication(gui_app.get());
auto result = TestCaseRunner::getInstance().run({}); auto result = TestCaseRunner::getInstance().run(user_args);
#ifdef _WIN32 #ifdef _WIN32
CoUninitialize(); CoUninitialize();