MCPcopy Create free account
hub / github.com/KDE/kdevelop / splitViewActiveTabsTest

Method splitViewActiveTabsTest

kdevplatform/sublime/tests/test_areaoperation.cpp:776–893  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

774////////////////////////////////////////////////////////////////////////////////
775////////////////////////////////////////////////////////////////////////////////
776void TestAreaOperation::splitViewActiveTabsTest()
777{
778 MainWindow mw(m_controller);
779 m_controller->showArea(m_area1, &mw);
780 checkArea1(&mw);
781
782 // at first show of the area, the active view should be m_pView111
783 QCOMPARE(mw.activeView(), m_pView111);
784
785 // Try to get to the main container :
786 // get the central widget
787 QWidget *pCentral = mw.centralWidget();
788 QVERIFY(pCentral);
789 QVERIFY(pCentral->inherits("QWidget"));
790
791 // get its first splitter
792 QWidget *pSplitter = pCentral->findChild<QSplitter*>();
793 QVERIFY(pSplitter);
794 QVERIFY(pSplitter->inherits("QSplitter"));
795
796 // finally, get the splitter's container
797 auto *pContainer = pSplitter->findChild<Sublime::Container*>();
798 QVERIFY(pContainer);
799
800 // verify that the current active widget in the container is the one in activeview (m_pView111)
801 QVERIFY(mw.activeView()->widget());
802 QCOMPARE(pContainer->currentWidget(), mw.activeView()->widget());
803
804 // activate the second tab of the area (view212)
805 mw.activateView(m_pView121);
806
807 // verify that the active view was correctly updated to m_pView121
808 QCOMPARE(mw.activeView(), m_pView121);
809
810 // check if the container's current widget was updated to the active view's
811 QVERIFY(mw.activeView()->widget());
812 QCOMPARE(pContainer->currentWidget(), mw.activeView()->widget());
813
814 // now, create a split view of the active view (m_pView121)
815 Sublime::View *pNewView = mw.activeView()->document()->createView();
816 pNewView->setObjectName("splitOf" + mw.activeView()->objectName());
817 m_area1->addView(pNewView, mw.activeView(), Qt::Vertical);
818
819 // verify that creating a new view did not break the central widget
820 QCOMPARE(pCentral, mw.centralWidget());
821
822 // verify that creating a new view did not break the main splitter
823 QCOMPARE(pSplitter, pCentral->findChild<QSplitter*>());
824
825 // creating a new view created two new children splitters, get them
826 QVERIFY(pSplitter->findChildren<QSplitter*>().size() == 2);
827 QWidget *pFirstSplitter = pSplitter->findChildren<QSplitter*>().at(0);
828 QVERIFY(pFirstSplitter);
829 QWidget *pSecondSplitter = pSplitter->findChildren<QSplitter*>().at(1);
830 QVERIFY(pSecondSplitter);
831
832 // for each splitter, get the corresponding container
833 auto *pFirstContainer = pFirstSplitter->findChild<Sublime::Container*>();

Callers

nothing calls this directly

Calls 12

showAreaMethod · 0.80
hasWidgetMethod · 0.80
activeViewMethod · 0.45
widgetMethod · 0.45
currentWidgetMethod · 0.45
activateViewMethod · 0.45
createViewMethod · 0.45
documentMethod · 0.45
addViewMethod · 0.45
sizeMethod · 0.45
atMethod · 0.45
removeViewMethod · 0.45

Tested by

no test coverage detected