示例#1
0
    // Test computation on a simple example
    void updateTest(){

        m_mecaobject->findData("position")->read("0. 0. 0.   1. 0. 0.   2. 4. 0.   3. 0. 0.");
        m_mecaobject->init();

        m_thisObject->findData("indices")->read("0 1 2 3");
        m_thisObject->init();
        m_thisObject->update();

        EXPECT_TRUE(m_thisObject->findData("average")->getValueString()=="1.5 1 0");
    }
示例#2
0
    // Test computation on a simple example
    void updateTest(){
        m_thisObject->findData("position")->read("0. 0. 0.  1. 0. 0.  0. 1. 0.");
        m_thisObject->findData("triangles")->read("0 1 2");
        m_thisObject->findData("distance")->read("0.");
        m_thisObject->init();
        m_thisObject->update();

        // Check output
        EXPECT_TRUE(m_thisObject->findData("output_position")->getValueString()=="0 0 0 1 0 0 0 1 0"); // Should stay invariant
        EXPECT_TRUE(m_thisObject->findData("normal")->getValueString()=="0 0 1 0 0 1 0 0 1");

        m_thisObject->findData("distance")->read("0.1");
        m_thisObject->update();
        EXPECT_TRUE(m_thisObject->findData("output_position")->getValueString()=="0 0 0.1 1 0 0.1 0 1 0.1"); // Should apply distance along normal
    }
示例#3
0
    /// It is important to freeze what are the available Data field
    /// of a component and rise warning/errors when some one removed.
    void attributesTests()
    {
        m_thisObject->setName("myname") ;
        EXPECT_TRUE(m_thisObject->getName() == "myname") ;

        // List of the supported attributes the user expect to find
        // This list needs to be updated if you add an attribute.
        vector<string> attrnames = {
            "plane",
            "position", "edges",  "triangles", "tetrahedra",
            "computeEdges", "computeTriangles", "computeTetrahedra",
            "indices", "edgeIndices", "triangleIndices", "tetrahedronIndices",
            "pointsInROI", "edgesInROI", "trianglesInROI", "tetrahedraInROI",
            "drawBoxes", "drawPoints", "drawEdges", "drawTriangles", "drawTetrahedra",
            "drawSize"
        };

        for(auto& attrname : attrnames)
            EXPECT_NE( m_thisObject->findData(attrname), nullptr ) << "Missing attribute with name '" << attrname << "'." ;

        return ;
    }
示例#4
0
    // Test computation on a simple example
    void updateTest(){

        m_thisObject->findData("position")->read("0. 0. 0.  0. 0. 1.  0. 0. 2.  0. 0. 3.  0. 0. 4.  0. 0. 5.  0. 0. 6.");
        m_thisObject->findData("nbSet")->read("2");
        m_thisObject->init();
        m_thisObject->findData("setIndices1")->read("0 1");
        m_thisObject->findData("setIndices2")->read("5 6");
        m_thisObject->update();

        EXPECT_TRUE(m_thisObject->findData("indices")->getValueString() == "2 3 4");
        EXPECT_TRUE(m_thisObject->findData("pointsInROI")->getValueString() == "0 0 2 0 0 3 0 0 4");
    }
示例#5
0
    // Basic tests (data and init).
    void normalTests(){

        m_thisObject->setName("myname") ;
        EXPECT_TRUE(m_thisObject->getName() == "myname") ;

        EXPECT_TRUE( m_thisObject->findData("indices") != NULL ) ;
        EXPECT_TRUE( m_thisObject->findData("vecId") != NULL ) ;
        EXPECT_TRUE( m_thisObject->findData("average") != NULL ) ;

        EXPECT_NO_THROW( m_thisObject->init() ) ;
        EXPECT_NO_THROW( m_thisObject->bwdInit() ) ;
        EXPECT_NO_THROW( m_thisObject->reinit() ) ;
        EXPECT_NO_THROW( m_thisObject->reset() ) ;

        this->mstate = NULL;
        EXPECT_NO_THROW(this->update()) ;

        return ;
    }
示例#6
0
    // Basic tests (data and init).
    void normalTests(){
        m_thisObject->setName("myname") ;
        EXPECT_TRUE(m_thisObject->getName() == "myname") ;

        EXPECT_TRUE( m_thisObject->findData("input_position") != NULL ) ;
        EXPECT_TRUE( m_thisObject->findData("output_position") != NULL ) ;
        EXPECT_TRUE( m_thisObject->findData("triangles") != NULL ) ;
        EXPECT_TRUE( m_thisObject->findData("quads") != NULL ) ;
        EXPECT_TRUE( m_thisObject->findData("normal") != NULL ) ;
        EXPECT_TRUE( m_thisObject->findData("thickness") != NULL ) ;
        EXPECT_TRUE( m_thisObject->findData("distance") != NULL ) ;
        EXPECT_TRUE( m_thisObject->findData("minThickness") != NULL ) ;

        EXPECT_NO_THROW( m_thisObject->init() ) ;
        EXPECT_NO_THROW( m_thisObject->bwdInit() ) ;
        EXPECT_NO_THROW( m_thisObject->reinit() ) ;
        EXPECT_NO_THROW( m_thisObject->reset() ) ;
        EXPECT_NO_THROW(this->update()) ;

        return ;
    }
示例#7
0
 /// Shouldn't crash without input data
 void initTest()
 {
     EXPECT_NO_THROW(m_thisObject->init()) << "The component should succeed in being initialized.";
 }
示例#8
0
    // Basic tests (data and init).
    void normalTests(){

        m_thisObject->setName("myname") ;
        EXPECT_TRUE(m_thisObject->getName() == "myname") ;

        EXPECT_TRUE( m_thisObject->findData("position") != NULL ) ;
        EXPECT_TRUE( m_thisObject->findData("nbSet") != NULL ) ;
        EXPECT_TRUE( m_thisObject->findData("indices") != NULL ) ;
        EXPECT_TRUE( m_thisObject->findData("pointsInROI") != NULL ) ;

        EXPECT_NO_THROW( m_thisObject->init() ) ;
        EXPECT_NO_THROW( m_thisObject->bwdInit() ) ;
        EXPECT_NO_THROW( m_thisObject->reinit() ) ;
        EXPECT_NO_THROW( m_thisObject->reset() ) ;

        m_thisObject->findData("nbSet")->read("3");
        m_thisObject->init();

        EXPECT_TRUE( m_thisObject->findData("setIndices1") != NULL ) ;
        EXPECT_TRUE( m_thisObject->findData("setIndices2") != NULL ) ;
        EXPECT_TRUE( m_thisObject->findData("setIndices3") != NULL ) ;

        return ;
    }