bool BuildItem::flatten( const std::shared_ptr<BuildItem> &i ) { if ( !(i->useName()) && i->getOutputs().empty() && ! i->getTool() ) { for ( auto &d: i->extractDependencies( DependencyType::EXPLICIT ) ) addDependency( DependencyType::EXPLICIT, d ); for ( auto &d: i->extractDependencies( DependencyType::CHAIN ) ) addDependency( DependencyType::CHAIN, d ); for ( auto &d: i->extractDependencies( DependencyType::IMPLICIT ) ) addDependency( DependencyType::IMPLICIT, d ); for ( auto &d: i->extractDependencies( DependencyType::ORDER ) ) addDependency( DependencyType::ORDER, d ); for ( const auto &v: i->getVariables() ) { auto mv = myVariables.find( v.first ); if ( mv != myVariables.end() ) mv->second.merge( v.second ); else myVariables.emplace( std::make_pair( v.first, v.second ) ); } return true; } return false; }
RubrosProveedoresModel::RubrosProveedoresModel(QObject *parent) : ModelBase(Tables::RubrosProveedores, "tareasProveedores", false, "library", parent) { defineColumnNames(); addDependency(static_cast<int>(Tables::Proveedores)); addDependency(static_cast<int>(Tables::Rubros)); }
void tst_PluginDependencyGraph::cycleDependencyTest() { auto graph = cycleGraph(); graph.addDependency("p1", "p2"); graph.addDependency("p2", "p3"); graph.addDependency("p2", "p4"); graph.addDependency("p3", "p5"); graph.addDependency("p4", "p5"); graph.addDependency("p5", "p2"); graph.addDependency("p5", "p6"); expect<PluginDependencyCycleException>([&]{ graph.findDependencies("p1"); }); QCOMPARE(graph.findDependents("p1"), QVector<QString>{}); expect<PluginDependencyCycleException>([&]{ graph.findDependencies("p2"); }); expect<PluginDependencyCycleException>([&]{ graph.findDependents("p2"); }); expect<PluginDependencyCycleException>([&]{ graph.findDependencies("p3"); }); expect<PluginDependencyCycleException>([&]{ graph.findDependents("p3"); }); expect<PluginDependencyCycleException>([&]{ graph.findDependencies("p4"); }); expect<PluginDependencyCycleException>([&]{ graph.findDependents("p4"); }); expect<PluginDependencyCycleException>([&]{ graph.findDependencies("p5"); }); expect<PluginDependencyCycleException>([&]{ graph.findDependents("p5"); }); QCOMPARE(graph.findDependencies("p6"), QVector<QString>{}); expect<PluginDependencyCycleException>([&]{ graph.findDependents("p6"); }); }
void ShaderCompiler::parseDependencies() { m_dependencies.clear(); bool is_opengl = getRenderer().isOpenGL(); Lumix::StaticString<30> compiled_dir("shaders/compiled", is_opengl ? "_gl" : ""); auto* iter = PlatformInterface::createFileIterator(compiled_dir, m_editor.getAllocator()); auto& fs = m_editor.getEngine().getFileSystem(); PlatformInterface::FileInfo info; while (PlatformInterface::getNextFile(iter, &info)) { if (!Lumix::PathUtils::hasExtension(info.filename, "d")) continue; auto* file = fs.open(fs.getDiskDevice(), Lumix::Path(Lumix::StaticString<Lumix::MAX_PATH_LENGTH>(compiled_dir, "/", info.filename)), Lumix::FS::Mode::READ | Lumix::FS::Mode::OPEN); if (!file) { Lumix::g_log_error.log("Editor") << "Could not open " << info.filename; continue; } char first_line[100]; readLine(file, first_line, sizeof(first_line)); for (int i = 0; i < sizeof(first_line); ++i) { if (first_line[i] == '\0' || first_line[i] == ' ') { first_line[i] = '\0'; break; } } char line[100]; while (readLine(file, line, sizeof(line))) { char* trimmed_line = Lumix::trimmed(line); char* c = trimmed_line; while (*c) { if (*c == ' ') break; ++c; } *c = '\0'; addDependency(trimmed_line, first_line); } char basename[Lumix::MAX_PATH_LENGTH]; char src[Lumix::MAX_PATH_LENGTH]; Lumix::PathUtils::getBasename(basename, sizeof(basename), first_line); getSourceFromBinaryBasename(src, sizeof(src), basename); addDependency(src, first_line); fs.close(*file); } PlatformInterface::destroyFileIterator(iter); }
void HomogMatrixPub::prepareInterface() { // Register data streams, events and event handlers HERE! //input streams registerStream("in_matrix", &in_matrix); registerStream("in_found", &in_found); registerStream("in_time_nsec_pocz", &in_time_nsec_pocz); registerStream("in_time_sec_pocz", &in_time_sec_pocz); //output streams registerStream("out_matrix", &out_matrix); registerStream("out_found", &out_found); registerStream("out_time_nsec_pocz", &out_time_nsec_pocz); registerStream("out_time_sec_pocz", &out_time_sec_pocz); registerStream("out_time_nsec_kon", &out_time_nsec_kon); registerStream("out_time_sec_kon", &out_time_sec_kon); // Register handlers h_onNewData.setup(boost::bind(&HomogMatrixPub::onNewData, this)); registerHandler("onNewData", &h_onNewData); addDependency("onNewData", &in_matrix); addDependency("onNewData", &in_found); //addDependency("onNewData", &in_time_nsec_pocz); //addDependency("onNewData", &in_time_sec_pocz); //registerProperty(trigger_delay); }
void CorrespondenceEstimation::prepareInterface() { // Register src-trg related data streams. registerStream("in_src_cloud_xyzsift", &in_src_cloud_xyzsift); registerStream("in_trg_cloud_xyzsift", &in_trg_cloud_xyzsift); registerStream("out_correspondences", &out_src_trg_correspondences); registerStream("out_corest", &out_corest); // Register lum related data streams. registerStream("in_lum_xyzsift", &in_lum_xyzsift); registerStream("out_lum_xyzsift", &out_lum_xyzsift); // Register models-scene related data streams. registerStream("in_scene_cloud_xyzsift", &in_trg_cloud_xyzsift); registerStream("in_model_clouds_xyzsift", &in_model_clouds_xyzsift); registerStream("out_models_scene_correspondences", &out_models_scene_correspondences); // Register src-trg correspondence estimation handler. registerHandler("estimateCorrespondencesForPairOfClouds", boost::bind(&CorrespondenceEstimation::estimateCorrespondencesForPairOfClouds, this)); addDependency("estimateCorrespondencesForPairOfClouds", &in_src_cloud_xyzsift); addDependency("estimateCorrespondencesForPairOfClouds", &in_trg_cloud_xyzsift); // Register lum-related correspondence estimation handler. registerHandler("estimateCorrespondencesForLUMGraph", boost::bind(&CorrespondenceEstimation::estimateCorrespondencesForLUMGraph, this)); addDependency("estimateCorrespondencesForLUMGraph", &in_lum_xyzsift); // Register src-trg correspondence estimation handler. registerHandler("estimateCorrespondencesBeteenModelsAndScene", boost::bind(&CorrespondenceEstimation::estimateCorrespondencesBeteenModelsAndScene, this)); addDependency("estimateCorrespondencesBeteenModelsAndScene", &in_trg_cloud_xyzsift); addDependency("estimateCorrespondencesBeteenModelsAndScene", &in_model_clouds_xyzsift); }
void CvWindow_Sink::prepareInterface() { CLOG(LTRACE) << "CvWindow_Sink::configure\n"; h_onRefresh.setup(this, &CvWindow_Sink::onRefresh); registerHandler("onRefresh", &h_onRefresh); addDependency("onRefresh", NULL); Base::EventHandler2 * hand; for (int i = 0; i < count; ++i) { char id = '0' + i; hand = new Base::EventHandler2; hand->setup(boost::bind(&CvWindow_Sink::onNewImageN, this, i)); handlers.push_back(hand); registerHandler(std::string("onNewImage") + id, hand); Base::DataStreamIn<cv::Mat, Base::DataStreamBuffer::Newest, Base::Synchronization::Mutex> * stream = new Base::DataStreamIn<cv::Mat, Base::DataStreamBuffer::Newest, Base::Synchronization::Mutex>; in_img.push_back(stream); registerStream(std::string("in_img") + id, (Base::DataStreamInterface*) (in_img[i])); addDependency(std::string("onNewImage") + id, stream); in_draw.push_back(new Base::DataStreamInPtr<Types::Drawable>); registerStream(std::string("in_draw") + id, in_draw[i]); out_point.push_back(new Base::DataStreamOut<cv::Point>); registerStream(std::string("out_point") + id, out_point[i]); // save handlers hand = new Base::EventHandler2; hand->setup(boost::bind(&CvWindow_Sink::onSaveImageN, this, i)); handlers.push_back(hand); registerHandler(std::string("onSaveImage") + id, hand); } h_onSaveAllImages.setup(this, &CvWindow_Sink::onSaveAllImages); registerHandler("onSaveAllImages", &h_onSaveAllImages); // register aliases for first handler and streams registerHandler("onNewImage", handlers[0]); registerStream("in_img", in_img[0]); registerStream("in_draw", in_draw[0]); img.resize(count); to_draw.resize(count); // Split window titles. std::string t = title; boost::split(titles, t, boost::is_any_of(",")); if ((titles.size() == 1) && (count > 1)) titles.clear(); for (int i = titles.size(); i < count; ++i) { char id = '0' + i; titles.push_back(std::string(title) + id); } }
TerrainDetailMapFeatGLSL::TerrainDetailMapFeatGLSL() : mTorqueDep( "shaders/common/gl/torque.glsl" ), mTerrainDep( "shaders/common/terrain/terrain.glsl" ) { addDependency( &mTorqueDep ); addDependency( &mTerrainDep ); }
TerrainMacroMapFeatHLSL::TerrainMacroMapFeatHLSL() : mTorqueDep( "shaders/common/torque.hlsl" ), mTerrainDep( "shaders/common/terrain/terrain.hlsl" ) { addDependency( &mTorqueDep ); addDependency( &mTerrainDep ); }
bool Shader::generateInstances() { for (int i = 0; i < m_instances.size(); ++i) { LUMIX_DELETE(m_allocator, m_instances[i]); } m_instances.clear(); uint32 count = 1 << m_combintions.m_define_count; auto* binary_manager = m_resource_manager.get(ResourceManager::SHADER_BINARY); char basename[MAX_PATH_LENGTH]; PathUtils::getBasename(basename, sizeof(basename), getPath().c_str()); for (uint32 mask = 0; mask < count; ++mask) { ShaderInstance* instance = LUMIX_NEW(m_allocator, ShaderInstance)(*this); m_instances.push(instance); instance->m_define_mask = getDefineMaskFromDense(mask); for (int pass_idx = 0; pass_idx < m_combintions.m_pass_count; ++pass_idx) { const char* pass = m_combintions.m_passes[pass_idx]; char path[MAX_PATH_LENGTH]; copyString(path, "shaders/compiled/"); catString(path, basename); catString(path, "_"); catString(path, pass); char mask_str[10]; int actual_mask = mask & m_combintions.m_vs_local_mask[pass_idx]; toCString(actual_mask, mask_str, sizeof(mask_str)); catString(path, mask_str); catString(path, "_vs.shb"); Path vs_path(path); auto* vs_binary = static_cast<ShaderBinary*>(binary_manager->load(vs_path)); addDependency(*vs_binary); instance->m_binaries[pass_idx * 2] = vs_binary; copyString(path, "shaders/compiled/"); catString(path, basename); catString(path, "_"); catString(path, pass); actual_mask = mask & m_combintions.m_fs_local_mask[pass_idx]; toCString(actual_mask, mask_str, sizeof(mask_str)); catString(path, mask_str); catString(path, "_fs.shb"); Path fs_path(path); auto* fs_binary = static_cast<ShaderBinary*>(binary_manager->load(fs_path)); addDependency(*fs_binary); instance->m_binaries[pass_idx * 2 + 1] = fs_binary; } } return true; }
void HomographyPoints::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("in_corners", &in_corners); registerStream("in_points", &in_points); registerStream("out_points", &out_points); // Register handlers registerHandler("findHomography_proc", boost::bind(&HomographyPoints::findHomography_proc, this)); addDependency("findHomography_proc", &in_corners); addDependency("findHomography_proc", &in_points); }
void Sum::prepareInterface() { // Register handlers with their dependencies. registerHandler("onNewImage", boost::bind(&Sum::onNewImage, this)); addDependency("onNewImage", &in_img1); addDependency("onNewImage", &in_img2); // Input and output data streams. registerStream("in_img1", &in_img1); registerStream("in_img2", &in_img2); registerStream("out_img", &out_img); }
void ApplyCornerMask::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("in_corners", &in_corners); registerStream("in_img", &in_img); registerStream("out_img", &out_img); // Register handlers h_apply_mask.setup(boost::bind(&ApplyCornerMask::apply_mask, this)); registerHandler("apply_mask", &h_apply_mask); addDependency("apply_mask", &in_corners); addDependency("apply_mask", &in_img); }
void ReprojectionError::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("in_correspondences", &in_correspondences); registerStream("in_xyz_cloud_expected", &in_xyz_cloud_expected); registerStream("in_xyz_cloud_obtained", &in_xyz_cloud_obtained); registerStream("out_error", &out_error); registerHandler("compute", boost::bind(&ReprojectionError::compute, this)); addDependency("compute", &in_correspondences); addDependency("compute", &in_xyz_cloud_expected); addDependency("compute", &in_xyz_cloud_obtained); }
void ImageWriter::prepareInterface() { CLOG(LTRACE) << name() << "::prepareInterface()"; // Register handlers Base::EventHandler2 * hand; for (int i = 0; i < count; ++i) { char id = '0'+i; hand = new Base::EventHandler2; hand->setup(boost::bind(&ImageWriter::write_image_N, this, i)); handlers.push_back(hand); registerHandler(std::string("write_image_")+id, hand); Base::DataStreamIn<cv::Mat, Base::DataStreamBuffer::Newest> * stream = new Base::DataStreamIn<cv::Mat, Base::DataStreamBuffer::Newest>; in_img.push_back(stream); registerStream( std::string("in_img")+id, (Base::DataStreamInterface*)(in_img[i])); addDependency(std::string("write_image_")+id, stream); // Add n flags for manual trigger. bool tmp_flag = false; save_flags.push_back(tmp_flag); } // register aliases for first handler and streams registerHandler("write_image", handlers[0]); registerStream("in_img", in_img[0]); counts.resize(count, 0); std::string t = base_name; boost::split(base_names, t, boost::is_any_of(",")); if ( (base_names.size() == 1) && (count > 1) ) base_names.clear(); for (int i = base_names.size(); i < count; ++i) { char id = '0' + i; base_names.push_back(std::string(base_name) + id); } std::string f = format; boost::split(formats, f, boost::is_any_of(",")); if ( (formats.size() == 1) && (count > 1) ) formats.clear(); for (int i = formats.size(); i < count; ++i) { formats.push_back(format); } // Register handlers - next image, can be triggered manually (from GUI) or by new data present in_load_next_image_trigger dataport. // 1st version - manually. registerHandler("SaveImage", boost::bind(&ImageWriter::onSaveButtonPressed, this)); // 2nd version - external trigger. registerHandler("onSaveTriggered", boost::bind(&ImageWriter::onSaveTriggered, this)); addDependency("onSaveTriggered", &in_trigger); }
void Drawcircles::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("in_img", &in_img); registerStream("circles", &circles); registerStream("out_img", &out_img); // Register handlers h_DrawCircles.setup(boost::bind(&Drawcircles::DrawCircles, this)); registerHandler("DrawCircles", &h_DrawCircles); addDependency("DrawCircles", &in_img); addDependency("DrawCircles", &circles); }
void HomogMatrixVector::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("in_hm", &in_hm); registerStream("in_hms", &in_hms); registerStream("out_hms", &out_hms); // Register handlers registerHandler("create_vector", boost::bind(&HomogMatrixVector::create_vector, this)); addDependency("create_vector", &in_hm); registerHandler("expand_vector", boost::bind(&HomogMatrixVector::expand_vector, this)); addDependency("expand_vector", &in_hms); addDependency("expand_vector", &in_hm); }
void Warper::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("in_img", &in_img); registerStream("in_transform", &in_transform); registerStream("in_camerainfo", &in_camerainfo); registerStream("out_img", &out_img); // Register handlers registerHandler("onNewImage", boost::bind(&Warper::onNewImage, this)); addDependency("onNewImage", &in_img); addDependency("onNewImage", &in_transform); addDependency("onNewImage", &in_camerainfo); }
void DrawSystem::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("in_img", &in_img); registerStream("in_csystem", &in_csystem); registerStream("in_impoints", &in_impoints); registerStream("out_img", &out_img); // Register handlers h_drawSys.setup(boost::bind(&DrawSystem::drawSys, this)); registerHandler("drawSys", &h_drawSys); addDependency("drawSys", &in_img); addDependency("drawSys", &in_csystem); addDependency("drawSys", &in_impoints); }
void KinectCalibration::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("in_img", &in_img); registerStream("in_depth", &in_depth); registerStream("in_homogMatrix", &in_homogMatrix); registerStream("in_chessboard", &in_chessboard); registerStream("out_img", &out_img); // Register handlers registerHandler("KinectCalibration_Processor", boost::bind(&KinectCalibration::KinectCalibration_Processor, this)); addDependency("KinectCalibration_Processor", &in_homogMatrix); addDependency("KinectCalibration_Processor", &in_img); addDependency("KinectCalibration_Processor", &in_depth); addDependency("KinectCalibration_Processor", &in_chessboard); }
void StatisticalOutlierRemoval::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("in_cloud_xyzrgb", &in_cloud_xyzrgb); registerStream("out_cloud_xyzrgb", &out_cloud_xyzrgb); registerStream("in_cloud_xyz", &in_cloud_xyz); registerStream("out_cloud_xyz", &out_cloud_xyz); // Register handlers registerHandler("filter_xyzrgb", boost::bind(&StatisticalOutlierRemoval::filter_xyzrgb, this)); addDependency("filter_xyzrgb", &in_cloud_xyzrgb); registerHandler("filter_xyz", boost::bind(&StatisticalOutlierRemoval::filter_xyz, this)); addDependency("filter_xyz", &in_cloud_xyz); }
PluginDependencyGraph tst_PluginDependencyGraph::linearGraph() { auto graph = PluginDependencyGraph{}; graph.addPlugin("p1"); graph.addPlugin("p2"); graph.addPlugin("p3"); graph.addPlugin("p4"); graph.addDependency("p1", "p2"); graph.addDependency("p2", "p3"); graph.addDependency("p3", "p4"); return std::move(graph); }
void ClustersViewer::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("in_clouds", &in_clouds); registerStream("in_projections", &in_projections); // Register handlers registerHandler("on_clouds", boost::bind(&ClustersViewer::on_clouds, this)); addDependency("on_clouds", &in_clouds); registerHandler("on_projections", boost::bind(&ClustersViewer::on_projections, this)); addDependency("on_projections", &in_projections); // Register spin handler. registerHandler("on_spin", boost::bind(&ClustersViewer::on_spin, this)); addDependency("on_spin", NULL); }
bool Shader::generateInstances() { bool is_opengl = getRenderer().isOpenGL(); for (int i = 0; i < m_instances.size(); ++i) { LUMIX_DELETE(m_allocator, m_instances[i]); } m_instances.clear(); uint32 count = 1 << m_combintions.define_count; auto* binary_manager = m_resource_manager.get(SHADER_BINARY_HASH); char basename[MAX_PATH_LENGTH]; PathUtils::getBasename(basename, sizeof(basename), getPath().c_str()); for (uint32 mask = 0; mask < count; ++mask) { ShaderInstance* instance = LUMIX_NEW(m_allocator, ShaderInstance)(*this); m_instances.push(instance); instance->define_mask = getDefineMaskFromDense(*this, mask); m_all_defines_mask |= instance->define_mask; for (int pass_idx = 0; pass_idx < m_combintions.pass_count; ++pass_idx) { const char* pass = m_combintions.passes[pass_idx]; StaticString<MAX_PATH_LENGTH> path("shaders/compiled", is_opengl ? "_gl/" : "/"); int actual_mask = mask & m_combintions.vs_local_mask[pass_idx]; path << basename << "_" << pass << actual_mask << "_vs.shb"; Path vs_path(path); auto* vs_binary = static_cast<ShaderBinary*>(binary_manager->load(vs_path)); addDependency(*vs_binary); instance->binaries[pass_idx * 2] = vs_binary; path.data[0] = '\0'; actual_mask = mask & m_combintions.fs_local_mask[pass_idx]; path << "shaders/compiled" << (is_opengl ? "_gl/" : "/") << basename; path << "_" << pass << actual_mask << "_fs.shb"; Path fs_path(path); auto* fs_binary = static_cast<ShaderBinary*>(binary_manager->load(fs_path)); addDependency(*fs_binary); instance->binaries[pass_idx * 2 + 1] = fs_binary; } } return true; }
void Script::initializeScript() { auto scriptNameValue = scriptName.getValue(); scriptInterpreter = getFactory()->getScene()->getScriptInterpreter(); scriptInterpreter->loadScript(scriptNameValue); std::string constructorName = scriptNameValue.substr(0, scriptNameValue.size() - 4); // Construct the script object. scriptObject = invokeFunction<LuaObject>(constructorName); scriptObject["scriptWrapper"] = this; // Add dependencies defined in the script. for (luabind::iterator it(scriptObject["dependencies"]), end; it != end; ++it) { LuaObject dependency = *it; auto casted = luabind::object_cast_nothrow<ComponentDependencyBase*>(dependency); if (casted) { addDependency(*casted); } } // Add attributes defined in the script. for (luabind::iterator it(scriptObject["attributes"]), end; it != end; ++it) { LuaObject attribute = *it; auto casted = luabind::object_cast_nothrow<ComponentAttributeBase*>(attribute); if (casted) { addAttribute(*casted); } } }
bool ReachIKCompiler::readJSON( const jsonxx::Object& root ) { BaseCompiler::readJSON(root); ReachResource reach; memset(&reach, 0x00, sizeof(reach)); vec3_make(reach.m_elbowAxis, 0, 1, 0); json_to_floats(root, "elbow_axis", reach.m_elbowAxis, 3); reach.m_hingeLimitAngle[0] = 0; reach.m_hingeLimitAngle[1] = 180; json_to_floats(root, "hinge_limit_angle", reach.m_hingeLimitAngle, 2); reach.m_reachGain = json_to_float(root, "reach_gain", 0.3f); reach.m_leaveGain = json_to_float(root, "leave_gain", 0.19f); reach.m_moveGain = json_to_float(root, "move_gain", 0.085f); reach.m_targetGain = json_to_float(root, "target_gain", 0.2f); reach.m_index = json_to_enum(root, "hand", left_right_names); const std::string& rigFile = root.get<std::string>("rig"); reach.m_rigName = stringid_caculate(rigFile.c_str()); addDependency("rig", name_to_file_path(rigFile, EngineNames::ANIMATION_RIG)); return write_file(m_output, &reach, sizeof(reach)); }
/* The function adds the given list of vectors to the dependency set of the current dataset. */ void dataset::addDependencies (vector * v) { vector * next; for (vector * t = v; t != NULL; t = next) { next = (vector *) t->getNext (); addDependency (t); } }
void Trigger::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("out_trigger", &out_trigger); h_onTrigger.setup(this, &Trigger::onTrigger); registerHandler("onTrigger", &h_onTrigger); addDependency("onTrigger", NULL); }
void RGBDViewer::prepareInterface() { CLOG(LTRACE) << name() << "::onFinish"; // Register data streams, events and event handlers HERE! registerStream("in_rgb", &in_rgb); registerStream("in_depth", &in_depth); // Refresh. h_onNewRGBDImage.setup(this, &RGBDViewer::onNewRGBDImage); registerHandler("onNewRGBDImage", &h_onNewRGBDImage); addDependency("onNewRGBDImage", &in_rgb); addDependency("onNewRGBDImage", &in_depth); // Save. h_onSaveRGBDImage.setup(this, &RGBDViewer::onSaveRGBDImage); registerHandler("onSaveRGBDImage", &h_onSaveRGBDImage); }
void InsertProjectTester::testDependencies() { Part pp(0); MainDocument part( &pp ); pp.setDocument( &part ); Task *t1 = addTask( part ); Task *t2 = addTask( part ); QCOMPARE( t1->numDependChildNodes(), 0 ); QCOMPARE( t2->numDependParentNodes(), 0 ); Relation *r = addDependency( part, t1, t2 ); QCOMPARE( t1->numDependChildNodes(), 1 ); QCOMPARE( t2->numDependParentNodes(), 1 ); QCOMPARE( t1->getDependChildNode( 0 ), r ); QCOMPARE( t2->getDependParentNode( 0 ), r ); Part pp2(0); MainDocument part2( &pp2 ); pp2.setDocument( &part2 ); QVERIFY( part2.insertProject( part.getProject(), 0, 0 ) ); Project &p2 = part2.getProject(); QVERIFY( p2.numChildren() == 2 ); QCOMPARE( p2.childNode( 0 ), t1 ); QCOMPARE( p2.childNode( 1 ), t2 ); QCOMPARE( t1->numDependChildNodes(), 1 ); QCOMPARE( t2->numDependParentNodes(), 1 ); QCOMPARE( t1->getDependChildNode( 0 ), r ); QCOMPARE( t2->getDependParentNode( 0 ), r ); }