tests: delete the dockwidgets when each test ends
Will save us from doing manual cleanup.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user