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

Method createWorkingSet

kdevplatform/shell/tests/test_workingsets.cpp:82–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80
81
82void TestWorkingSetController::createWorkingSet()
83{
84 // Create a persistent working set
85 m_area->setWorkingSet(setName);
86 const auto workingSets = m_workingSetCtrl->allWorkingSets();
87 QCOMPARE(workingSets.size(), 1);
88 const auto id = workingSets.first()->id();
89 workingSets.first()->setPersistent(true);
90 QVERIFY(workingSets.first()->isPersistent());
91 // Open a document such that the working set is not empty
92 m_documentCtrl->openDocument(QUrl::fromLocalFile(m_file.fileName()));
93
94 // Create and activate a non-persistent working set
95 m_area->setWorkingSet(setName3, false);
96 QCOMPARE(m_workingSetCtrl->allWorkingSets().size(), 2);
97 m_documentCtrl->openDocument(QUrl::fromLocalFile(m_file.fileName()));
98
99 // Create and activate another non-persistent working set
100 m_area->setWorkingSet(setName2, false);
101 QCOMPARE(m_workingSetCtrl->allWorkingSets().size(), 3);
102 const auto id2 = m_workingSetCtrl->workingSet(m_area->workingSet())->id();
103 m_documentCtrl->openDocument(QUrl::fromLocalFile(m_file.fileName()));
104
105 QTRY_COMPARE(m_closedSets->layout()->count(), 2); // working sets 1 + 3 (2 is active)
106
107 restartSession();
108
109 // Check if last non-persistent working set is active and persistent set exists
110 QCOMPARE(m_workingSetCtrl->allWorkingSets().size(), 2);
111 auto set = m_workingSetCtrl->workingSet(m_area->workingSet());
112 QCOMPARE(set->id(), id2);
113 QVERIFY(!set->isPersistent());
114
115 // Activate persistent working set
116 m_area->setWorkingSet(setName);
117 QCOMPARE(m_workingSetCtrl->allWorkingSets().size(), 2);
118 set = m_workingSetCtrl->workingSet(m_area->workingSet());
119 QCOMPARE(set->id(), id);
120 QVERIFY(set->isPersistent());
121
122 QTRY_COMPARE(m_closedSets->layout()->count(), 1); // working set 2 (1 is active)
123}
124
125void TestWorkingSetController::deleteWorkingSet()
126{

Callers

nothing calls this directly

Calls 11

allWorkingSetsMethod · 0.80
setPersistentMethod · 0.80
isPersistentMethod · 0.80
setWorkingSetMethod · 0.45
sizeMethod · 0.45
idMethod · 0.45
firstMethod · 0.45
openDocumentMethod · 0.45
fileNameMethod · 0.45
workingSetMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected