TEST_F(DataMapping_test, ViewDeletedOnAppShutdown) { QPointer<AbstractRenderView> view = env->mapping.createDefaultRenderViewType(); ASSERT_TRUE(view); { QMainWindow mainWindow; mainWindow.addDockWidget(Qt::LeftDockWidgetArea, view->dockWidgetParent()); ASSERT_EQ(view->dockWidgetParent(), view->parent()); ASSERT_EQ(&mainWindow, view->dockWidgetParent()->parent()); env.reset(); ASSERT_FALSE(view); } }
TEST_F(DataMapping_test, ViewOwnershipPassedToMainWindow) { QPointer<AbstractRenderView> view = env->mapping.createDefaultRenderViewType(); ASSERT_TRUE(view); QMainWindow mainWindow; mainWindow.addDockWidget(Qt::LeftDockWidgetArea, view->dockWidgetParent()); ASSERT_EQ(view->dockWidgetParent(), view->parent()); ASSERT_EQ(&mainWindow, view->dockWidgetParent()->parent()); view->close(); ASSERT_TRUE(view); QCoreApplication::processEvents(); ASSERT_FALSE(view); }