| 198 | |
| 199 | |
| 200 | void TestShellBuddy::testDisableBuddies() |
| 201 | { |
| 202 | /* 3. Deactivate buddy option, Activate open next to active tab |
| 203 | Open a.cpp a.l.txt |
| 204 | Verify order (a.cpp a.l.txt) |
| 205 | Verify that a.l.txt is activated |
| 206 | Activate a.cpp |
| 207 | Open b.cpp |
| 208 | Verify order (a.cpp b.cpp a.l.txt) */ |
| 209 | QCOMPARE(m_documentController->openDocuments().count(), 0); |
| 210 | enableBuddies(false); |
| 211 | enableOpenAfterCurrent(); |
| 212 | |
| 213 | QTemporaryDir dirA; |
| 214 | createFile(dirA, QStringLiteral("a.l.txt")); |
| 215 | createFile(dirA, QStringLiteral("a.r.txt")); |
| 216 | createFile(dirA, QStringLiteral("b.r.txt")); |
| 217 | |
| 218 | m_documentController->openDocument(QUrl::fromLocalFile(dirA.path() + "a.r.txt")); |
| 219 | m_documentController->openDocument(QUrl::fromLocalFile(dirA.path() + "a.l.txt")); |
| 220 | |
| 221 | Sublime::Area *area = m_uiController->activeArea(); |
| 222 | Sublime::AreaIndex* areaIndex = area->indexOf(m_uiController->activeSublimeWindow()->activeView()); |
| 223 | |
| 224 | // Buddies disabled => order of tabs should be the order of file opening |
| 225 | verifyFilename(areaIndex->views().value(0), "a.r.txt"); |
| 226 | verifyFilename(areaIndex->views().value(1), "a.l.txt"); |
| 227 | verifyFilename(m_uiController->activeSublimeWindow()->activeView(), "a.l.txt"); |
| 228 | |
| 229 | //activate a.cpp => new doc should be opened right next to it |
| 230 | m_uiController->activeSublimeWindow()->activateView(areaIndex->views().value(0)); |
| 231 | |
| 232 | m_documentController->openDocument(QUrl::fromLocalFile(dirA.path() + "b.r.txt")); |
| 233 | verifyFilename(areaIndex->views().value(0), "a.r.txt"); |
| 234 | verifyFilename(areaIndex->views().value(1), "b.r.txt"); |
| 235 | verifyFilename(areaIndex->views().value(2), "a.l.txt"); |
| 236 | verifyFilename(m_uiController->activeSublimeWindow()->activeView(), "b.r.txt"); |
| 237 | |
| 238 | QCOMPARE(m_documentController->openDocuments().count(), 3); |
| 239 | for(int i = 0; i < 3; i++) |
| 240 | m_documentController->openDocuments().at(0)->close(IDocument::Discard); |
| 241 | QCOMPARE(m_documentController->openDocuments().count(), 0); |
| 242 | } |
| 243 | |
| 244 | |
| 245 | void TestShellBuddy::testDisableOpenAfterCurrent() |
nothing calls this directly
no test coverage detected