tests: Use tests_createView() instead of MyWidget2
Decouples tests from Qt a bit more
This commit is contained in:
@@ -95,6 +95,33 @@ Controllers::DockWidget *KDDockWidgets::Tests::createDockWidget(const QString &n
|
||||
}
|
||||
};
|
||||
|
||||
Controllers::DockWidget *KDDockWidgets::Tests::createDockWidget(const QString &name, View *guest,
|
||||
Controllers::DockWidget::Options options,
|
||||
Controllers::DockWidget::LayoutSaverOptions layoutSaverOptions,
|
||||
bool show,
|
||||
const QString &affinityName)
|
||||
{
|
||||
guest->setFocusPolicy(Qt::StrongFocus);
|
||||
auto dock = new Controllers::DockWidget(name, options, layoutSaverOptions);
|
||||
dock->setAffinityName(affinityName);
|
||||
dock->setGuestView(guest->asWrapper());
|
||||
dock->setObjectName(name);
|
||||
dock->view()->setGeometry(QRect(0, 0, 400, 400));
|
||||
if (show) {
|
||||
dock->show();
|
||||
dock->dptr()->morphIntoFloatingWindow();
|
||||
dock->view()->activateWindow();
|
||||
Q_ASSERT(dock->window());
|
||||
if (Platform::instance()->tests_waitForWindowActive(dock->view()->window(), 1000)) {
|
||||
return dock;
|
||||
}
|
||||
qWarning() << Q_FUNC_INFO << "Couldn't activate window";
|
||||
return nullptr;
|
||||
} else {
|
||||
return dock;
|
||||
}
|
||||
};
|
||||
|
||||
Controllers::DockWidget *KDDockWidgets::Tests::createDockWidget(const QString &name, QColor color)
|
||||
{
|
||||
return createDockWidget(name, new MyWidget(name, color));
|
||||
|
||||
Reference in New Issue
Block a user