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

Method areaCloning

kdevplatform/sublime/tests/test_areaoperation.cpp:380–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

378}
379
380void TestAreaOperation::areaCloning()
381{
382 //show m_area1 in MainWindow1
383 MainWindow mw1(m_controller);
384 m_controller->showArea(m_area1, &mw1);
385 checkArea1(&mw1);
386
387 //now try to show the same area in MainWindow2 and check that we get a clone
388 MainWindow mw2(m_controller);
389 m_controller->showArea(m_area1, &mw2);
390
391 //two mainwindows have different areas
392 QVERIFY(mw1.area() != mw2.area());
393 //the area for the second mainwindow is a clone of the
394 //original area and should have the same name.
395 QVERIFY(mw2.area()->objectName() == mw1.area()->objectName());
396
397 //check mainwindow layouts - original and copy
398 checkArea1(&mw1);
399 checkArea1(&mw2);
400
401 const auto& toolViews1 = mw1.area()->toolViews();
402 const auto& toolViews2 = mw2.area()->toolViews();
403 // m_area1 is shown in one main window and its clone - in another.
404 // The number and order of tool views must be the same.
405 QCOMPARE_EQ(toolViews1.size(), toolViews2.size());
406 for (auto i = qsizetype{0}, size = toolViews1.size(); i < size; ++i) {
407 compareDifferentViewsOfOneDocument(toolViews1[i], toolViews2[i], MainWindowAffinity::DifferentWindows);
408 }
409}
410
411/*! Functor used by areaSwitchingInSameMainWindow()
412 Walks all Views and checks if they got a widget.*/

Callers

nothing calls this directly

Calls 4

showAreaMethod · 0.80
areaMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected