Commit d3b0344c authored by Olivier de Gaalon's avatar Olivier de Gaalon
Browse files

Fix test_shelldocumentoperation

Kate views are internally stored as a QHash, so the views() getter
will no longer return a list of views in the order of creation.
parent 13557a8e
...@@ -125,15 +125,21 @@ void TestShellDocumentOperation::testKateDocumentAndViewCreation() ...@@ -125,15 +125,21 @@ void TestShellDocumentOperation::testKateDocumentAndViewCreation()
QVERIFY(main); QVERIFY(main);
QVERIFY(main->guiFactory()->clients().contains(doc->views()[0])); QVERIFY(main->guiFactory()->clients().contains(doc->views()[0]));
//KTextEditor::views is internally a QHash::keys() call: so the order of the views will vary
const auto originalView = doc->views()[0];
//create the new view and activate it (using split action from mainwindow) //create the new view and activate it (using split action from mainwindow)
QAction *splitAction = main->actionCollection()->action("split_vertical"); QAction *splitAction = main->actionCollection()->action("split_vertical");
QVERIFY(splitAction); QVERIFY(splitAction);
splitAction->trigger(); splitAction->trigger();
QCOMPARE(doc->views().count(), 2); const auto viewList = doc->views();
QCOMPARE(viewList.count(), 2);
const auto newlySplitView = originalView == viewList[0] ? viewList[1] : viewList[0];
//check that we did switch to the new xmlguiclient //check that we did switch to the new xmlguiclient
QVERIFY(!main->guiFactory()->clients().contains(doc->views()[0])); QVERIFY(!main->guiFactory()->clients().contains(originalView));
QVERIFY(main->guiFactory()->clients().contains(doc->views()[1])); QVERIFY(main->guiFactory()->clients().contains(newlySplitView));
documentController->openDocuments()[0]->close(IDocument::Discard); documentController->openDocuments()[0]->close(IDocument::Discard);
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment