MCPcopy Create free account
hub / github.com/BehaviorTree/Groot / modifyCustomModel

Method modifyCustomModel

test/editor_test.cpp:368–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

366}
367
368void EditorTest::modifyCustomModel()
369{
370 QString file_xml = readFile(":/crossdoor_with_subtree.xml");
371 main_win->on_actionClear_triggered();
372 main_win->loadFromXML( file_xml );
373
374 QAbstractButton *button_lock = main_win->findChild<QAbstractButton*>("buttonLock");
375 button_lock->setChecked(false);
376
377 auto sidepanel_editor = main_win->findChild<SidepanelEditor*>("SidepanelEditor");
378 auto treeWidget = sidepanel_editor->findChild<QTreeWidget*>("paletteTreeWidget");
379
380 NodeModel jump_model = { NodeType::ACTION,
381 "JumpOutWindow",
382 { {"UseParachute", PortModel() } }
383 };
384
385 sidepanel_editor->onReplaceModel("PassThroughWindow", jump_model);
386
387 auto pass_window_items = treeWidget->findItems("PassThroughWindow",
388 Qt::MatchExactly | Qt::MatchRecursive);
389 QCOMPARE( pass_window_items.empty(), true);
390
391 auto jump_window_items = treeWidget->findItems( jump_model.registration_ID,
392 Qt::MatchExactly | Qt::MatchRecursive);
393 QCOMPARE( jump_window_items.size(), 1);
394
395 auto abs_tree = getAbstractTree();
396
397 auto jump_abs_node = abs_tree.findFirstNode( jump_model.registration_ID );
398 QVERIFY( jump_abs_node != nullptr);
399 sleepAndRefresh( 500 );
400 QCOMPARE( jump_abs_node->model, jump_model );
401
402 sleepAndRefresh( 500 );
403}
404
405void EditorTest::multipleSubtrees()
406{

Callers

nothing calls this directly

Calls 5

PortModelClass · 0.85
loadFromXMLMethod · 0.80
onReplaceModelMethod · 0.80
findFirstNodeMethod · 0.80

Tested by

no test coverage detected