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

Method switchArea

kdevplatform/shell/tests/test_workingsets.cpp:157–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157void TestWorkingSetController::switchArea()
158{
159 // Create a persistent working set
160 m_area->setWorkingSet(setName2);
161 auto set2 = m_workingSetCtrl->workingSet(m_area->workingSet());
162 set2->setPersistent(true);
163 m_documentCtrl->openDocument(QUrl::fromLocalFile(m_file.fileName()));
164
165 // Create and activate another persistent working set
166 m_area->setWorkingSet(setName);
167 auto set = m_workingSetCtrl->workingSet(m_area->workingSet());
168 set->setPersistent(true);
169 m_documentCtrl->openDocument(QUrl::fromLocalFile(m_file.fileName()));
170 m_documentCtrl->openDocumentFromText(QString()); // add an unsaved document
171
172 Core::self()->uiController()->switchToArea(QStringLiteral("debug"), IUiController::ThisWindow);
173 m_area_debug = Core::self()->uiControllerInternal()->activeArea();
174 // explicitly set the current working set, as in DebugController::addSession
175 m_area_debug->setWorkingSet(setName, m_area->workingSetPersistent(), m_area);
176
177 QTRY_COMPARE(m_closedSets->layout()->count(), 1); // working set 2
178 QTRY_COMPARE(m_area_debug->views().size(), 2); // check that the unsaved document is displayed, BUG 486746
179
180 m_area_debug->setWorkingSet(setName2);
181 m_documentCtrl->openDocumentFromText(QString()); // add two unsaved documents
182 m_documentCtrl->openDocumentFromText(QString());
183
184 QTest::qSleep(1000);
185 QCOMPARE(m_closedSets->layout()->count(), 1); // working set 1, BUG 375446
186
187 Core::self()->uiController()->switchToArea(QStringLiteral("code"), IUiController::ThisWindow);
188 // explicitly set the current working set, as in DebugController::debuggerStateChanged
189 m_area->setWorkingSet(setName2, m_area_debug->workingSetPersistent(), m_area_debug);
190
191 QTRY_COMPARE(m_area->views().size(), 3); // check that both unsaved documents are displayed, BUG 486746
192
193 m_area->setWorkingSet(setName);
194
195 QTRY_COMPARE(m_closedSets->layout()->count(), 1); // working set 2, BUG 375446
196}
197
198void TestWorkingSetController::restoreSplits()
199{

Callers

nothing calls this directly

Calls 15

setPersistentMethod · 0.80
openDocumentFromTextMethod · 0.80
switchToAreaMethod · 0.80
uiControllerMethod · 0.80
activeAreaMethod · 0.80
uiControllerInternalMethod · 0.80
workingSetPersistentMethod · 0.80
QStringClass · 0.50
setWorkingSetMethod · 0.45
workingSetMethod · 0.45
openDocumentMethod · 0.45
fileNameMethod · 0.45

Tested by

no test coverage detected