12#include "kddockwidgets/KDDockWidgets.h"
14#include "views/View.h"
15#include "kddockwidgets/qtquick/views/MainWindow.h"
16#include "kddockwidgets/core/MainWindow.h"
18#include "core/View_p.h"
19#include "core/Logging_p.h"
21#include <QGuiApplication>
26#include <QtTest/QTest>
31#ifdef DOCKS_TESTING_METHODS
38 explicit TestView(Core::CreateViewOptions opts, QQuickItem *parent)
42 setMinimumSize(opts.minSize);
43 setMaximumSize(opts.maxSize);
49 Core::CreateViewOptions m_opts;
52TestView::~TestView() =
default;
56 QtCommon::Platform_qt::maybeSetOffscreenQPA(argc, argv);
63 : Platform_qt(createCoreApplication(argc, argv))
64 , m_qquickHelpers(new QtQuickHelpers())
69void Platform::tests_initPlatform_impl()
71 Platform_qt::tests_initPlatform_impl();
73 QQuickStyle::setStyle(QStringLiteral(
"Material"));
77void Platform::tests_deinitPlatform_impl()
80 auto windows = qGuiApp->topLevelWindows();
83 windows = qGuiApp->topLevelWindows();
86 Platform_qt::tests_deinitPlatform_impl();
92 auto newItem =
new TestView(opts, parentItem);
94 if (!parentItem && opts.createWindow) {
95 auto view =
new QQuickView(m_qmlEngine,
nullptr);
96 view->resize(
QSize(800, 800));
98 newItem->QQuickItem::setParentItem(view->contentItem());
99 newItem->QQuickItem::setParent(view->contentItem());
101 newItem->QtQuick::View::setVisible(
true);
109Core::View *Platform::tests_createFocusableView(Core::CreateViewOptions opts,
Core::View *parent)
111 auto view = tests_createView(opts, parent);
119 Core::CreateViewOptions opts;
121 auto view = tests_createView(opts, parent);
128 Core::CreateViewOptions viewOpts,
129 MainWindowOptions options,
Core::View *parent,
135 auto view =
new QQuickView(m_qmlEngine,
nullptr);
136 view->resize(viewOpts.size);
138 view->setResizeMode(QQuickView::SizeRootObjectToView);
139 view->setSource(
QUrl(QStringLiteral(
"qrc:/main.qml")));
141 if (viewOpts.isVisible)
144 parentItem = view->rootObject();
150 return view->mainWindow();
153std::shared_ptr<Core::Window> Platform::tests_createWindow()
155 Core::CreateViewOptions viewOpts;
156 viewOpts.isVisible =
true;
159 auto mainWindow = createMainWindow(QStringLiteral(
"testWindow-%1").arg(
id), viewOpts);
160 return mainWindow->view()->window();
The MainWindow base-class. MainWindow and MainWindowBase are only split in two so we can share some c...
A docking area for dock widgets Named MainWindow as it's the QtWidgets/QMainWindow counterpart....