diff --git a/tests/qtwidgets/tst_qtwidgets.cpp b/tests/qtwidgets/tst_qtwidgets.cpp index f79e4ddb..c9836e95 100644 --- a/tests/qtwidgets/tst_qtwidgets.cpp +++ b/tests/qtwidgets/tst_qtwidgets.cpp @@ -9,6 +9,11 @@ Contact KDAB at for commercial licensing options. */ +/// @file +/// @brief Here lives the tests that only apply to QtWidgets +/// either because they haven't been ported to QtQuick yet or because they are really +/// QtWidgets specific. + #include "Platform.h" #include "KDDockWidgets.h" #include "../utils.h" @@ -39,9 +44,24 @@ using namespace KDDockWidgets::Controllers; using namespace KDDockWidgets::Tests; using namespace Layouting; -/// @brief Here lives the tests that only apply to QtWidgets -/// either because they haven't been ported to QtQuick yet or because they are really -/// QtWidgets specific. +inline EmbeddedWindow *createEmbeddedMainWindow(QSize sz) +{ + static int count = 0; + count++; + // Tests a MainWindow which isn't a top-level window, but is embedded in another window + auto mainwindow = createMainWindow(QSize(600, 600), MainWindowOption_HasCentralFrame).release(); + + auto window = new EmbeddedWindow(mainwindow); + + auto lay = new QVBoxLayout(window); + lay->setContentsMargins(100, 100, 100, 100); + lay->addWidget(qobject_cast(mainwindow->view()->asQObject())); + + window->show(); + window->resize(sz); + return window; +} + class TestQtWidgets : public QObject { Q_OBJECT diff --git a/tests/utils.h b/tests/utils.h index dcd8d5ef..5d77a5a5 100644 --- a/tests/utils.h +++ b/tests/utils.h @@ -437,27 +437,6 @@ inline void dragFloatingWindowTo(Controllers::FloatingWindow *fw, DropArea *targ drag(draggable, QPoint(), dropPoint, ButtonAction_Release); } -inline EmbeddedWindow *createEmbeddedMainWindow(QSize sz) -{ - static int count = 0; - count++; - // Tests a MainWindow which isn't a top-level window, but is embedded in another window - auto mainwindow = createMainWindow(QSize(600, 600), MainWindowOption_HasCentralFrame).release(); - - auto window = new EmbeddedWindow(mainwindow); -#ifdef KDDOCKWIDGETS_QTWIDGETS - auto lay = new QVBoxLayout(window); - lay->setContentsMargins(100, 100, 100, 100); - lay->addWidget(mainwindow->view()->asQWidget()); -#else - // TODO: For QtQuick we need some QML - qWarning() << "Parent me!"; -#endif - window->show(); - window->resize(sz); - return window; -} - } inline bool qpaPassedAsArgument(int argc, char *argv[])