tests: delete the dockwidgets when each test ends

Will save us from doing manual cleanup.
This commit is contained in:
Sergio Martins
2021-01-08 08:45:28 -08:00
parent 309a90d3a6
commit 26f1b75976
2 changed files with 5 additions and 7 deletions

View File

@@ -397,13 +397,8 @@ void TestDocks::tst_restoreSimple()
dock3->morphIntoFloatingWindow(); // as it would take 1 event loop. Do it now so we can compare already.
QCOMPARE(dock3->window()->pos(), dock3FloatingPoint);
// Cleanup
dock3->deleteLater();
QVERIFY(Testing::waitForDeleted(dock3));
}
void TestDocks::tst_doesntHaveNativeTitleBar()
{
// Tests that a floating window doesn't have a native title bar

View File

@@ -101,13 +101,16 @@ struct EnsureTopLevelsDeleted
~EnsureTopLevelsDeleted()
{
auto dr = DockRegistry::self();
qDeleteAll(DockRegistry::self()->floatingWindows(/*includeBeingDeleted=*/ true));
qDeleteAll(DockRegistry::self()->dockwidgets());
if (!dr->isEmpty())
if (!DockRegistry::self()->isEmpty()) {
auto dr = DockRegistry::self();
qWarning() << "There's still top-level widgets present!"
<< "\nfloatings:" << dr->floatingWindows(/*includeBeingDeleted=*/ true)
<< "\nmainwindows:" << dr->mainWindowsNames()
<< "\ndocks:" << dr->dockWidgetNames();
}
// Other cleanup, since we use this class everywhere
Config::self().setDockWidgetFactoryFunc(nullptr);