From 64f0b3e77a609c640a1b9e2cad1ecc0c3273c37f Mon Sep 17 00:00:00 2001 From: jmsgrogan Date: Thu, 12 Jan 2023 11:54:08 +0000 Subject: [PATCH] Clean up fontsmanager --- src/console/MainApplication.cpp | 16 +++++++-------- src/core/CommandLineArgs.cpp | 19 +++++------------- src/core/CommandLineArgs.h | 5 +---- src/fonts/FontsManager.cpp | 7 ++++++- src/fonts/FontsManager.h | 10 ++++++---- src/graphics/directx/DirectXMeshPainter.cpp | 12 ++++++++++- src/graphics/directx/DirectXPainter.cpp | 6 +++--- src/graphics/directx/DirectXTextPainter.cpp | 2 -- src/ui_elements/desktop_elements/Window.cpp | 11 +++++----- src/ui_elements/desktop_elements/Window.h | 9 +++++---- src/visual_elements/nodes/TextNode.cpp | 2 +- src/windows/CMakeLists.txt | 6 +++++- src/windows/managers/DesktopManager.cpp | 8 +++++++- src/windows/managers/DesktopManager.h | 6 +++++- src/windows/managers/WindowManager.cpp | 7 ++----- src/windows/managers/WindowManager.h | 3 +++ .../ui_interfaces/AbstractUiInterface.h | 11 ++-------- src/windows/ui_interfaces/NullUiInterface.h | 4 ++-- .../ui_interfaces/UiInterfaceFactory.cpp | 14 ++++++------- .../ui_interfaces/win32/Win32UIInterface.cpp | 5 ++--- .../ui_interfaces/win32/Win32UIInterface.h | 2 +- .../win32/Win32WindowInterface.cpp | 2 +- test/graphics/TestD2dRendering.cpp | 20 ++++++++++--------- test/test_utils/TestUiApplication.cpp | 6 ++++++ test/test_utils/TestUiApplication.h | 3 +++ test/ui_test_runner.cpp | 4 +++- 26 files changed, 111 insertions(+), 89 deletions(-) diff --git a/src/console/MainApplication.cpp b/src/console/MainApplication.cpp index c5673c8..e3cfb40 100644 --- a/src/console/MainApplication.cpp +++ b/src/console/MainApplication.cpp @@ -67,23 +67,23 @@ void MainApplication::initialize(CommandLineArgsUPtr commandLineArgs, std::uniqu void MainApplication::run() { 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 output_path; - for(unsigned idx=1; idxgetNumberOfArgs(); idx++) + for(unsigned idx=1; idx< mCommandLineArgs->getArgs().size(); idx++) { - auto arg = mCommandLineArgs->getArg(idx); - if(arg == "-input" && mCommandLineArgs->getNumberOfArgs() > idx+1) + auto arg = mCommandLineArgs->getArgs()[idx]; + 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]; } } diff --git a/src/core/CommandLineArgs.cpp b/src/core/CommandLineArgs.cpp index ed83f7f..de4392f 100644 --- a/src/core/CommandLineArgs.cpp +++ b/src/core/CommandLineArgs.cpp @@ -61,20 +61,6 @@ void CommandLineArgs::process(const std::vector& args) mArugments = args; } -std::size_t CommandLineArgs::getNumberOfArgs() const -{ - return mArugments.size(); -} - -std::string CommandLineArgs::getArg(std::size_t index) const -{ - if(index CommandLineArgs::getUserArgs() const { std::vector user_args; @@ -84,3 +70,8 @@ std::vector CommandLineArgs::getUserArgs() const } return user_args; } + +const std::vector CommandLineArgs::getArgs() const +{ + return mArugments; +} diff --git a/src/core/CommandLineArgs.h b/src/core/CommandLineArgs.h index 8bf15a0..618789f 100644 --- a/src/core/CommandLineArgs.h +++ b/src/core/CommandLineArgs.h @@ -7,16 +7,13 @@ class CommandLineArgs { public: - CommandLineArgs(); static std::unique_ptr Create(); std::filesystem::path getLaunchPath(); - std::size_t getNumberOfArgs() const; - - std::string getArg(std::size_t index) const; + const std::vector getArgs() const; void process(int argc, char *argv[]); diff --git a/src/fonts/FontsManager.cpp b/src/fonts/FontsManager.cpp index 0414b1a..7e87c7b 100644 --- a/src/fonts/FontsManager.cpp +++ b/src/fonts/FontsManager.cpp @@ -8,11 +8,11 @@ #include "FontGlyph.h" - FontsManager::FontsManager() { #ifdef HAS_FREETYPE mFontEngine = std::make_unique(); + mUsesGlyphs = true; #else mFontEngine = std::make_unique(); #endif @@ -24,6 +24,11 @@ std::unique_ptr FontsManager::Create() return std::make_unique(); } +bool FontsManager::usesGlyphs() const +{ + return mUsesGlyphs; +} + IFontEngine* FontsManager::getFontEngine() const { return mFontEngine.get(); diff --git a/src/fonts/FontsManager.h b/src/fonts/FontsManager.h index ddeb874..2bbdc13 100644 --- a/src/fonts/FontsManager.h +++ b/src/fonts/FontsManager.h @@ -1,12 +1,12 @@ #pragma once +#include "IFontEngine.h" +#include "FontGlyph.h" + #include #include #include -class IFontEngine; -class FontGlyph; - class FontsManager { public: @@ -15,11 +15,13 @@ public: IFontEngine* getFontEngine() const; + bool usesGlyphs() const; + FontGlyph* getGlyph(const std::string& fontFace, int size, uint32_t c); private: + bool mUsesGlyphs{ false }; std::unique_ptr mFontEngine; - std::unordered_map > mGlyphs; }; diff --git a/src/graphics/directx/DirectXMeshPainter.cpp b/src/graphics/directx/DirectXMeshPainter.cpp index 4d42cd5..de1863a 100644 --- a/src/graphics/directx/DirectXMeshPainter.cpp +++ b/src/graphics/directx/DirectXMeshPainter.cpp @@ -108,9 +108,19 @@ void DirectXMeshPainter::updateBuffers(DrawingContext* context) auto scene = context->getSurface()->getScene(); 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(item); + if (model->getGeometry()) + { + continue; + } + auto dx_mesh = std::make_unique(model); dx_mesh->update(context, mDxInterface->getD3dDevice()); mDxMeshes.push_back(std::move(dx_mesh)); diff --git a/src/graphics/directx/DirectXPainter.cpp b/src/graphics/directx/DirectXPainter.cpp index b59fbd3..b47ae5f 100644 --- a/src/graphics/directx/DirectXPainter.cpp +++ b/src/graphics/directx/DirectXPainter.cpp @@ -84,14 +84,14 @@ void DirectXPainter::initializeDxInterface() void DirectXPainter::resetPainters() { - m2dPainter->setD2dInterface(mDxInterface->getD2dInterface()); - mTextPainter->setD2dInterface(mDxInterface->getD2dInterface()); + m2dPainter->setD2dInterface(getDxInterface()->getD2dInterface()); + mTextPainter->setD2dInterface(getDxInterface()->getD2dInterface()); mMeshPainter->setDxInterface(getDxInterface()); } void DirectXPainter::paint() { - if (!mDxInterface) + if (!getDxInterface()) { initializeDxInterface(); } diff --git a/src/graphics/directx/DirectXTextPainter.cpp b/src/graphics/directx/DirectXTextPainter.cpp index 100815a..9355219 100644 --- a/src/graphics/directx/DirectXTextPainter.cpp +++ b/src/graphics/directx/DirectXTextPainter.cpp @@ -6,8 +6,6 @@ #include "FontsManager.h" #include "FontGlyph.h" -#include "DirectXShaderProgram.h" - #include "TextData.h" #include "SceneText.h" #include "DirectX2dInterface.h" diff --git a/src/ui_elements/desktop_elements/Window.cpp b/src/ui_elements/desktop_elements/Window.cpp index a6874cf..87664bf 100644 --- a/src/ui_elements/desktop_elements/Window.cpp +++ b/src/ui_elements/desktop_elements/Window.cpp @@ -23,7 +23,7 @@ namespace mt { -Window::Window() +Window::Window(DrawingMode drawingMode, FontsManager* fontsManager) : DrawingSurface(), mWidget(Widget::Create()) { @@ -31,6 +31,8 @@ Window::Window() mHeight = 600; mWidget->setBounds(mWidth, mHeight); mWidget->setWindow(this); + + mDrawingContext = std::make_unique(this, fontsManager, drawingMode); } Window::~Window() @@ -38,9 +40,9 @@ Window::~Window() } -std::unique_ptr Window::Create() +std::unique_ptr Window::Create(DrawingMode drawingMode, FontsManager* fontsManager) { - return std::make_unique(); + return std::make_unique(drawingMode, fontsManager); } void Window::setIsSizingOnGoing(bool sizingOngoing) @@ -117,10 +119,9 @@ IPlatformWindow* Window::getPlatformWindow() const return nullptr; } -void Window::setPlatformWindow(IPlatformWindowPtr window, FontsManager* fontsManager, DrawingMode drawingMode) +void Window::setPlatformWindow(IPlatformWindowPtr window) { mPlatformWindow = std::move(window); - mDrawingContext = std::make_unique(this, fontsManager, drawingMode); } void Window::map() diff --git a/src/ui_elements/desktop_elements/Window.h b/src/ui_elements/desktop_elements/Window.h index 38c9c66..b283540 100644 --- a/src/ui_elements/desktop_elements/Window.h +++ b/src/ui_elements/desktop_elements/Window.h @@ -2,6 +2,8 @@ #include "DrawingSurface.h" #include "DisplayState.h" +#include "DrawingContext.h" +#include "Widget.h" #include #include @@ -17,7 +19,6 @@ class DrawingContext; class FontsManager; enum class DrawingMode; -class Widget; using WidgetPtr = std::unique_ptr; class IPlatformWindow; using IPlatformWindowPtr = std::unique_ptr; @@ -33,11 +34,11 @@ class Window : public DrawingSurface public: using onPopupFunc = std::function popup)>; - Window(); + Window(DrawingMode drawingMode = DrawingMode::GRAPH, FontsManager* fontsManager = nullptr); ~Window(); - static std::unique_ptr Create(); + static std::unique_ptr Create(DrawingMode drawingMode = DrawingMode::GRAPH, FontsManager* fontsManager = nullptr); void addPopup(std::unique_ptr popupWidget); @@ -71,7 +72,7 @@ public: void onKeyboardEvent(const KeyboardEvent* event); - void setPlatformWindow(IPlatformWindowPtr window, FontsManager* fontsManager, DrawingMode drawingMode); + void setPlatformWindow(IPlatformWindowPtr window); void setPopupHandler(onPopupFunc func); diff --git a/src/visual_elements/nodes/TextNode.cpp b/src/visual_elements/nodes/TextNode.cpp index 7f3e660..362e286 100644 --- a/src/visual_elements/nodes/TextNode.cpp +++ b/src/visual_elements/nodes/TextNode.cpp @@ -107,7 +107,7 @@ std::size_t TextNode::getNumSceneItems() const void TextNode::updateLines(FontsManager* fontsManager) { - if (!fontsManager) + if (!fontsManager || !fontsManager->usesGlyphs()) { return; } diff --git a/src/windows/CMakeLists.txt b/src/windows/CMakeLists.txt index e5c1668..c063a79 100644 --- a/src/windows/CMakeLists.txt +++ b/src/windows/CMakeLists.txt @@ -79,9 +79,13 @@ endif() list(APPEND windows_LIB_INCLUDES ui_interfaces/AbstractUiInterface.h ui_interfaces/UiInterfaceFactory.cpp + managers/WindowManager.h + managers/DesktopManager.h + managers/EventManager.h managers/WindowManager.cpp managers/DesktopManager.cpp - managers/EventManager.cpp) + managers/EventManager.cpp +) # add the library add_library(windows SHARED ${windows_LIB_INCLUDES} ${platform_INCLUDES}) diff --git a/src/windows/managers/DesktopManager.cpp b/src/windows/managers/DesktopManager.cpp index 92725c9..4ba3909 100644 --- a/src/windows/managers/DesktopManager.cpp +++ b/src/windows/managers/DesktopManager.cpp @@ -12,7 +12,8 @@ DesktopManager::DesktopManager(AbstractDesktopApp* application) : mScreens(), mKeyboard(Keyboard::Create()), mUiApplication(application), - mEventManager(EventManager::Create()) + mEventManager(EventManager::Create()), + mFontsManager(FontsManager::Create()) { mWindowManager = WindowManager::Create(this); } @@ -32,6 +33,11 @@ void DesktopManager::clearEvents() mEventManager->ClearEvents(); } +FontsManager* DesktopManager::getFontsManager() const +{ + return mFontsManager.get(); +} + void DesktopManager::onKeyboardEvent(const KeyboardEvent* event) { mWindowManager->onKeyboardEvent(event); diff --git a/src/windows/managers/DesktopManager.h b/src/windows/managers/DesktopManager.h index fd1f439..8045a3c 100644 --- a/src/windows/managers/DesktopManager.h +++ b/src/windows/managers/DesktopManager.h @@ -12,13 +12,13 @@ #include "UiEvent.h" #include "AbstractApp.h" #include "EventManager.h" +#include "FontsManager.h" class AbstractDesktopApp; class DesktopManager { public: - DesktopManager(AbstractDesktopApp* application); ~DesktopManager(); @@ -33,6 +33,8 @@ public: Keyboard* getKeyboard() const; + FontsManager* getFontsManager() const; + void addScreen(ScreenPtr screen); mt::Screen* getDefaultScreen() const; @@ -55,6 +57,8 @@ public: private: std::vector mScreens; + + FontsManagerPtr mFontsManager; WindowManagerUPtr mWindowManager; KeyboardUPtr mKeyboard; EventManagerUPtr mEventManager; diff --git a/src/windows/managers/WindowManager.cpp b/src/windows/managers/WindowManager.cpp index 81eff17..59a3074 100644 --- a/src/windows/managers/WindowManager.cpp +++ b/src/windows/managers/WindowManager.cpp @@ -1,15 +1,12 @@ #include "WindowManager.h" #include "DesktopManager.h" -#include "Widget.h" - -#include WindowManager::WindowManager(DesktopManager* desktopManager) : mWindows(), mDesktopManager(desktopManager) { - addWindow(mt::Window::Create()); + addWindow(mt::Window::Create(mDrawMode, desktopManager->getFontsManager())); } WindowManager::~WindowManager() @@ -53,7 +50,7 @@ void WindowManager::addWindow(WindowUPtr window) void WindowManager::onAddPopupWindow(mt::Window* parent, std::unique_ptr widget) { - auto popup = mt::Window::Create(); + auto popup = mt::Window::Create(mDrawMode, mDesktopManager->getFontsManager()); popup->setWidget(std::move(widget)); popup->setParent(parent); diff --git a/src/windows/managers/WindowManager.h b/src/windows/managers/WindowManager.h index 18b2c6c..387c77c 100644 --- a/src/windows/managers/WindowManager.h +++ b/src/windows/managers/WindowManager.h @@ -4,6 +4,8 @@ #include #include "Window.h" +#include "DrawingContext.h" + #include "PaintEvent.h" #include "MouseEvent.h" #include "ResizeEvent.h" @@ -51,6 +53,7 @@ public: private: std::vector mWindows; + DrawingMode mDrawMode{ DrawingMode::GRAPH }; DesktopManager* mDesktopManager{nullptr}; }; diff --git a/src/windows/ui_interfaces/AbstractUiInterface.h b/src/windows/ui_interfaces/AbstractUiInterface.h index 91219df..78c918f 100644 --- a/src/windows/ui_interfaces/AbstractUiInterface.h +++ b/src/windows/ui_interfaces/AbstractUiInterface.h @@ -1,9 +1,6 @@ #pragma once #include -#include "IFontEngine.h" -#include "FontsManager.h" -#include "FontGlyph.h" namespace mt { @@ -11,16 +8,14 @@ namespace mt } class DesktopManager; -class FontsManager; class AbstractUIInterface { public: - AbstractUIInterface(DesktopManager* desktopManager, std::unique_ptr fontsManager, bool useHardware = false) + AbstractUIInterface(DesktopManager* desktopManager, bool useHardware = false) : mDesktopManager(desktopManager), - mUseHardwareRendering(useHardware), - mFontsManager(std::move(fontsManager)) + mUseHardwareRendering(useHardware) { } @@ -39,7 +34,5 @@ protected: virtual void initializeHardwareRendering() {}; DesktopManager* mDesktopManager{nullptr}; - std::unique_ptr mFontsManager; - bool mUseHardwareRendering{false}; }; diff --git a/src/windows/ui_interfaces/NullUiInterface.h b/src/windows/ui_interfaces/NullUiInterface.h index b8e1492..8550641 100644 --- a/src/windows/ui_interfaces/NullUiInterface.h +++ b/src/windows/ui_interfaces/NullUiInterface.h @@ -8,8 +8,8 @@ class NullUIInterface : public AbstractUIInterface { public: - NullUIInterface(DesktopManager* desktopManager, std::unique_ptr fontsManager, bool useHardware = false) - : AbstractUIInterface(desktopManager, std::move(fontsManager), useHardware) + NullUIInterface(DesktopManager* desktopManager, bool useHardware = false) + : AbstractUIInterface(desktopManager, useHardware) { }; diff --git a/src/windows/ui_interfaces/UiInterfaceFactory.cpp b/src/windows/ui_interfaces/UiInterfaceFactory.cpp index 3369499..6f9d567 100644 --- a/src/windows/ui_interfaces/UiInterfaceFactory.cpp +++ b/src/windows/ui_interfaces/UiInterfaceFactory.cpp @@ -13,38 +13,36 @@ #include "NullUiInterface.h" -#include "FontsManager.h" #include "Widget.h" std::unique_ptr UiInterfaceFactory::create(DesktopManager* desktopManager, Backend backend) { - auto fonts_manager = std::make_unique(); #ifdef __linux__ if (backend == Backend::UNSET || backend == Backend::X11 || backend == Backend::X11_RASTER) { #ifdef HAS_X11 const bool use_hardware = (backend != Backend::X11_RASTER); - return std::make_unique(desktopManager, std::move(fonts_manager), use_hardware); + return std::make_unique(desktopManager, use_hardware); #else - return std::make_unique(desktopManager, std::move(fonts_manager)); + return std::make_unique(desktopManager); #endif } else { #ifdef HAS_WAYLAND const bool use_hardware = (backend != Backend::WAYLAND_RASTER); - return std::make_unique(desktopManager, std::move(fonts_manager), use_hardware); + return std::make_unique(desktopManager, use_hardware); #else #ifdef HAS_X11 const bool use_hardware = (backend != Backend::X11_RASTER); - return std::make_unique(desktopManager, std::move(fonts_manager), use_hardware); + return std::make_unique(desktopManager, use_hardware); #else - return std::make_unique(desktopManager, std::move(fonts_manager)); + return std::make_unique(desktopManager); #endif #endif } #else - return std::make_unique(desktopManager, std::move(fonts_manager), true); + return std::make_unique(desktopManager, true); #endif } diff --git a/src/windows/ui_interfaces/win32/Win32UIInterface.cpp b/src/windows/ui_interfaces/win32/Win32UIInterface.cpp index f0b1fe7..0604fe4 100644 --- a/src/windows/ui_interfaces/win32/Win32UIInterface.cpp +++ b/src/windows/ui_interfaces/win32/Win32UIInterface.cpp @@ -1,6 +1,5 @@ #include "Win32UIInterface.h" -#include "Widget.h" #include "DesktopManager.h" #include "DirectXInterface.h" #include "DirectX2dInterface.h" @@ -10,8 +9,8 @@ #include #include -Win32UIInterface::Win32UIInterface(DesktopManager* desktopManager, std::unique_ptr fontsManager, bool useHardware) - : AbstractUIInterface(desktopManager, std::move(fontsManager), useHardware), +Win32UIInterface::Win32UIInterface(DesktopManager* desktopManager, bool useHardware) + : AbstractUIInterface(desktopManager, useHardware), mWindowInterface(std::make_unique()) { diff --git a/src/windows/ui_interfaces/win32/Win32UIInterface.h b/src/windows/ui_interfaces/win32/Win32UIInterface.h index f3df696..9984456 100644 --- a/src/windows/ui_interfaces/win32/Win32UIInterface.h +++ b/src/windows/ui_interfaces/win32/Win32UIInterface.h @@ -13,7 +13,7 @@ using DirectXInterfacePtr = std::unique_ptr; class Win32UIInterface : public AbstractUIInterface { public: - Win32UIInterface(DesktopManager* desktopManager, std::unique_ptr fontsManager, bool useHardware = false); + Win32UIInterface(DesktopManager* desktopManager, bool useHardware = false); ~Win32UIInterface() = default; diff --git a/src/windows/ui_interfaces/win32/Win32WindowInterface.cpp b/src/windows/ui_interfaces/win32/Win32WindowInterface.cpp index 859c8e2..12783da 100644 --- a/src/windows/ui_interfaces/win32/Win32WindowInterface.cpp +++ b/src/windows/ui_interfaces/win32/Win32WindowInterface.cpp @@ -29,7 +29,7 @@ void Win32WindowInterface::add(mt::Window* window, DesktopManager* desktopManage auto win32_window = Win32Window::Create(window, dxInterface); win32_window->createNative(context, desktopManager); win32_window->setCmdShow(context->nCmdShow); - window->setPlatformWindow(std::move(win32_window), nullptr, DrawingMode::GRAPH); + window->setPlatformWindow(std::move(win32_window)); window->getPlatformWindow()->beforePaint(nullptr); } diff --git a/test/graphics/TestD2dRendering.cpp b/test/graphics/TestD2dRendering.cpp index f340561..2407d04 100644 --- a/test/graphics/TestD2dRendering.cpp +++ b/test/graphics/TestD2dRendering.cpp @@ -1,16 +1,8 @@ -#include "TestCase.h" -#include "TestCaseRunner.h" - #include "TestUiApplication.h" - #include "TestFramework.h" -#include "DesktopManager.h" -#include "MeshPrimitives.h" -#include "MeshNode.h" +#include "RectangleNode.h" #include "TextNode.h" -#include "Scene.h" -#include "Widget.h" #include #include @@ -18,5 +10,15 @@ TEST_CASE(TestD2dRendering, "graphics") { + auto gui_app = TestCaseRunner::getInstance().getTestApplication(); + auto scene = gui_app->getMainWindowScene(); + auto rect = std::make_unique(Point(10, 10), 200.0, 200.0); + scene->addNode(rect.get()); + + auto text_node = std::make_unique("Test2", Point(100, 100)); + scene->addNode(text_node.get()); + + scene->update(); + gui_app->run(); }; \ No newline at end of file diff --git a/test/test_utils/TestUiApplication.cpp b/test/test_utils/TestUiApplication.cpp index e00a339..49ca40d 100644 --- a/test/test_utils/TestUiApplication.cpp +++ b/test/test_utils/TestUiApplication.cpp @@ -1,6 +1,7 @@ #include "TestUiApplication.h" #include "MainApplication.h" +#include "DesktopManager.h" TestUiApplication::TestUiApplication(std::unique_ptr args, std::unique_ptr mainApp) : GuiApplication(std::move(args), std::move(mainApp)) @@ -11,4 +12,9 @@ TestUiApplication::TestUiApplication(std::unique_ptr args, std: DesktopManager* TestUiApplication::getDesktopManager() const { return mDesktopManager.get(); +} + +Scene* TestUiApplication::getMainWindowScene() const +{ + return mDesktopManager->getWindowManager()->getMainWindow()->getScene(); } \ No newline at end of file diff --git a/test/test_utils/TestUiApplication.h b/test/test_utils/TestUiApplication.h index d75a587..cb832e1 100644 --- a/test/test_utils/TestUiApplication.h +++ b/test/test_utils/TestUiApplication.h @@ -1,6 +1,7 @@ #pragma once #include "GuiApplication.h" +#include "Scene.h" #include @@ -10,4 +11,6 @@ public: TestUiApplication(std::unique_ptr args = nullptr, std::unique_ptr mainApp = nullptr); DesktopManager* getDesktopManager() const; + + Scene* getMainWindowScene() const; }; \ No newline at end of file diff --git a/test/ui_test_runner.cpp b/test/ui_test_runner.cpp index 0f3e06e..6f6f5f7 100644 --- a/test/ui_test_runner.cpp +++ b/test/ui_test_runner.cpp @@ -23,6 +23,8 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine auto args = CommandLineArgs::Create(); CommandLineArgs::initialize(args.get()); + const auto user_args = args->getUserArgs(); + auto main_app = MainApplication::Create(); auto applicationContext = std::make_unique(); @@ -41,7 +43,7 @@ int main(int argc, char *argv[]) #endif TestCaseRunner::getInstance().setTestApplication(gui_app.get()); - auto result = TestCaseRunner::getInstance().run({}); + auto result = TestCaseRunner::getInstance().run(user_args); #ifdef _WIN32 CoUninitialize();