| 243 | |
| 244 | |
| 245 | void TestShellBuddy::testDisableOpenAfterCurrent() |
| 246 | { |
| 247 | /* 5. Enable buddy option, Disable open next to active tab |
| 248 | Open foo.l.txt bar.cpp foo.cpp |
| 249 | Verify order (foo.l.txt foo.cpp bar.cpp) |
| 250 | Verify that foo.cpp is activated |
| 251 | Open x.cpp => tab must be placed at the end |
| 252 | Verify order (foo.l.txt foo.cpp bar.cpp x.cpp) |
| 253 | Verify that x.cpp is activated*/ |
| 254 | QCOMPARE(m_documentController->openDocuments().count(), 0); |
| 255 | enableBuddies(); |
| 256 | enableOpenAfterCurrent(false); |
| 257 | |
| 258 | QTemporaryDir dirA; |
| 259 | createFile(dirA, QStringLiteral("foo.l.txt")); |
| 260 | createFile(dirA, QStringLiteral("bar.r.txt")); |
| 261 | createFile(dirA, QStringLiteral("foo.r.txt")); |
| 262 | createFile(dirA, QStringLiteral("x.r.txt")); |
| 263 | |
| 264 | m_documentController->openDocument(QUrl::fromLocalFile(dirA.path() + "foo.l.txt")); |
| 265 | m_documentController->openDocument(QUrl::fromLocalFile(dirA.path() + "bar.r.txt")); |
| 266 | m_documentController->openDocument(QUrl::fromLocalFile(dirA.path() + "foo.r.txt")); |
| 267 | |
| 268 | Sublime::Area *area = m_uiController->activeArea(); |
| 269 | Sublime::AreaIndex* areaIndex = area->indexOf(m_uiController->activeSublimeWindow()->activeView()); |
| 270 | |
| 271 | verifyFilename(areaIndex->views().value(0), "foo.l.txt"); |
| 272 | verifyFilename(areaIndex->views().value(1), "foo.r.txt"); |
| 273 | verifyFilename(areaIndex->views().value(2), "bar.r.txt"); |
| 274 | verifyFilename(m_uiController->activeSublimeWindow()->activeView(), "foo.r.txt"); |
| 275 | |
| 276 | m_documentController->openDocument(QUrl::fromLocalFile(dirA.path() + "x.r.txt")); |
| 277 | verifyFilename(areaIndex->views().value(0), "foo.l.txt"); |
| 278 | verifyFilename(areaIndex->views().value(1), "foo.r.txt"); |
| 279 | verifyFilename(areaIndex->views().value(2), "bar.r.txt"); |
| 280 | verifyFilename(areaIndex->views().value(3), "x.r.txt"); |
| 281 | verifyFilename(m_uiController->activeSublimeWindow()->activeView(), "x.r.txt"); |
| 282 | |
| 283 | QCOMPARE(m_documentController->openDocuments().count(), 4); |
| 284 | for(int i = 0; i < 4; i++) |
| 285 | m_documentController->openDocuments().at(0)->close(IDocument::Discard); |
| 286 | QCOMPARE(m_documentController->openDocuments().count(), 0); |
| 287 | } |
| 288 | |
| 289 | |
| 290 | void TestShellBuddy::testDisableAll() |
nothing calls this directly
no test coverage detected