/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
| 774 | //////////////////////////////////////////////////////////////////////////////// |
| 775 | //////////////////////////////////////////////////////////////////////////////// |
| 776 | void 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*>(); |
nothing calls this directly
no test coverage detected