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); }
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); }