本文整理汇总了C++中testnodes::BinaryNode::setRight方法的典型用法代码示例。如果您正苦于以下问题:C++ BinaryNode::setRight方法的具体用法?C++ BinaryNode::setRight怎么用?C++ BinaryNode::setRight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testnodes::BinaryNode
的用法示例。
在下文中一共展示了BinaryNode::setRight方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST(ModelBase, PersistenceSave)
{
Model model;
PersistentStoreMock store;
TestNodes::BinaryNode* root = dynamic_cast<TestNodes::BinaryNode*> (model.createRoot("BinaryNode"));
model.setName("root");
model.save(&store);
CHECK_STR_EQUAL("BinaryNode,root,full,Text,name,full,,Integer,_ext_PositionExtension_x,full,0,Integer,_ext_PositionExtension_y,full,0,", store.getSaved());
model.beginModification(root, "make tree");
root->setLeft(new TestNodes::BinaryNode());
root->setRight( new TestNodes::BinaryNode());
root->name()->set("Troot");
root->left()->name()->set("Tleft");
root->right()->name()->set("Tright");
model.endModification();
store.clear();
model.save();
CHECK_STR_EQUAL("BinaryNode,root,full,Text,name,full,Troot,BinaryNode,left,full,Text,name,full,Tleft,Integer,_ext_PositionExtension_x,full,0,Integer,_ext_PositionExtension_y,full,0,BinaryNode,right,full,Text,name,full,Tright,Integer,_ext_PositionExtension_x,full,0,Integer,_ext_PositionExtension_y,full,0,Integer,_ext_PositionExtension_x,full,0,Integer,_ext_PositionExtension_y,full,0,", store.getSaved());
}
示例2: nl
TEST(ModelBase, ModificationNotificationTests)
{
Model model;
NotificationListener nl(model);
CHECK_CONDITION(nl.root == nullptr);
CHECK_INT_EQUAL(0, nl.modifiedNodes.size());
TestNodes::BinaryNode* root = dynamic_cast<TestNodes::BinaryNode*> (model.createRoot("BinaryNode"));
CHECK_CONDITION(root == nl.root);
model.beginModification(root, "make tree");
TestNodes::BinaryNode* left = new TestNodes::BinaryNode();
TestNodes::BinaryNode* right = new TestNodes::BinaryNode();
root->setLeft(left);
root->setRight(right);
model.endModification();
CHECK_INT_EQUAL(1, nl.modifiedNodes.size());
CHECK_CONDITION(nl.modifiedNodes[0] == root);
model.beginModification(left, "modify");
left->name()->set("Left text");
model.changeModificationTarget(right);
right->name()->set("Right text");
model.endModification();
CHECK_INT_EQUAL(4, nl.modifiedNodes.size());
CHECK_CONDITION(nl.modifiedNodes[0] == left);
CHECK_CONDITION(nl.modifiedNodes[1] == left->name());
CHECK_CONDITION(nl.modifiedNodes[2] == right);
CHECK_CONDITION(nl.modifiedNodes[3] == right->name());
nl.modifiedNodes.clear();
model.beginModification(nullptr);
model.undo();
model.undo();
model.endModification();
CHECK_INT_EQUAL(5, nl.modifiedNodes.size());
CHECK_CONDITION(nl.modifiedNodes[0] == right);
CHECK_CONDITION(nl.modifiedNodes[1] == right->name());
CHECK_CONDITION(nl.modifiedNodes[2] == left);
CHECK_CONDITION(nl.modifiedNodes[3] == left->name());
CHECK_CONDITION(nl.modifiedNodes[4] == root);
}
示例3: TestBoxNode
TEST(VisualizationBase, ExtendableTest)
{
Model::Model* model = new Model::Model();
Model::List* list = static_cast<Model::List*> (model->createRoot("List"));
model->beginModification(list, "set");
TestNodes::BinaryNode* first = new TestNodes::BinaryNode();
list->append(first);
TestNodes::BinaryNode* second = new TestNodes::BinaryNode();
list->append(second);
Model::Text* third = new Model::Text();
list->append(third);
first->name()->set("First node");
TestNodes::BinaryNode* left = new TestNodes::BinaryNode();
first->setLeft(left);
TestNodes::BinaryNode* right = new TestNodes::BinaryNode();
first->setRight(right);
left->name()->set("left node");
right->name()->set("right node");
second->name()->set("Empty node");
third->set("Some independent text");
list->append(new TestBoxNode("someText"));
list->append(new TestBoxNode("stretch", true));
model->endModification();
auto top = new RootItem(list);
auto scene = VisualizationManager::instance().mainScene();
scene->addTopLevelItem( top );
QApplication::processEvents();
VList* l = dynamic_cast<VList*> (top->item());
l->itemAt<VExtendable>(1)->setExpanded(false);
scene->scheduleUpdate();
scene->listenToModel(model);
CHECK_CONDITION(scene);
}
示例4: Scene
TEST(InteractionBase, TextSelect)
{
Scene* scene = new Scene();
Model::Model* model = new Model::Model();
Model::List* list = static_cast<Model::List*> (model->createRoot("List"));
model->beginModification(list, "set");
TestNodes::BinaryNode* first = new TestNodes::BinaryNode();
list->append(first);
TestNodes::BinaryNode* second = new TestNodes::BinaryNode();
list->append(second);
Model::Text* third = new Model::Text();
list->append(third);
first->name()->set("First node");
TestNodes::BinaryNode* left = new TestNodes::BinaryNode();
first->setLeft(left);
TestNodes::BinaryNode* right = new TestNodes::BinaryNode();
first->setRight(right);
left->name()->set("left node");
right->name()->set("right node");
second->name()->set("Empty node");
third->set("Some independent text");
model->endModification();
VList* l = dynamic_cast<VList*> (scene->renderer()->render(nullptr, list));
scene->addTopLevelItem(l);
scene->scheduleUpdate();
QApplication::processEvents();
l->at<VExtendable>(0)->setExpanded();
scene->scheduleUpdate();
scene->listenToModel(model);
// Create view
MainView* view = new MainView(scene);
CHECK_CONDITION(view != nullptr);
}
示例5:
TEST(ModelBase, ChildNodeRetrieval)
{
Model model;
TestNodes::BinaryNode* root = dynamic_cast<TestNodes::BinaryNode*> (model.createRoot("BinaryNode"));
model.beginModification(root, "Making nodes");
TestNodes::BinaryNode* left = new TestNodes::BinaryNode();
root->setLeft(left);
TestNodes::BinaryNode* right = new TestNodes::BinaryNode();
root->setRight(right);
model.endModification();
CHECK_CONDITION(root->hasAttribute("name"));
CHECK_CONDITION(root->hasAttribute("left"));
CHECK_CONDITION(root->hasAttribute("right"));
CHECK_CONDITION(root->hasAttribute("another") == false);
CHECK_CONDITION(root->get("name") == root->name());
CHECK_CONDITION(root->get("left") == left);
CHECK_CONDITION(root->get("right") == right);
}