END_TEST START_TEST (test_CubicBezier_setBasePoint2_NULL ) { CubicBezier_setBasePoint2(CB,NULL); Point_t *pos=CubicBezier_getBasePoint2(CB); fail_unless(pos != NULL); fail_unless(Point_getXOffset(pos) == 0.0); fail_unless(Point_getYOffset(pos) == 0.0); fail_unless(Point_getZOffset(pos) == 0.0); }
END_TEST START_TEST (test_CubicBezier_setBasePoint2 ) { Point_t *pos= new (std::nothrow) Point(LN,-10.10,11.11,-12.12); CubicBezier_setBasePoint2(CB,pos); Point_t* POS=CubicBezier_getBasePoint2(CB); fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS)); fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS)); fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS)); Point_free(pos); }
static LineSegment_t * rsbml_build_doc_line_segment(SEXP r_line_segment) { LineSegment_t * line_segment; if (inherits(r_line_segment, "CubicBezier")) { line_segment = (LineSegment_t *)CubicBezier_create(); CubicBezier_setBasePoint1((CubicBezier_t *)line_segment, rsbml_build_doc_point(GET_SLOT(r_line_segment, install("basePoint1")))); CubicBezier_setBasePoint2((CubicBezier_t *)line_segment, rsbml_build_doc_point(GET_SLOT(r_line_segment, install("basePoint2")))); } else line_segment = LineSegment_create(); rsbml_build_doc_s_base((SBase_t *)line_segment, r_line_segment); LineSegment_setStart(line_segment, rsbml_build_doc_point(GET_SLOT(r_line_segment, install("start")))); LineSegment_setEnd(line_segment, rsbml_build_doc_point(GET_SLOT(r_line_segment, install("end")))); return line_segment; }
END_TEST START_TEST ( test_CubicBezier_createFrom ) { Point_t* start= new (std::nothrow) Point(LN,1.1,-2.2,3.3); Point_t* base1= new (std::nothrow) Point(LN,-4.4,5.5,-6.6); Point_t* base2= new (std::nothrow) Point(LN,7.7,-8.8,9.9); Point_t* end= new (std::nothrow) Point(LN,-10.10,11.11,-12.12); CubicBezier_setStart(CB,start); CubicBezier_setBasePoint1(CB,base1); CubicBezier_setBasePoint2(CB,base2); CubicBezier_setEnd(CB,end); CubicBezier_t* cb=CubicBezier_createFrom(CB); fail_unless( cb->getPackageName() == "layout"); fail_unless( cb->getTypeCode() == SBML_LAYOUT_CUBICBEZIER); if(SBase_isSetMetaId((SBase_t*)CB)) { std::string c1=SBase_getMetaId((SBase_t*)CB); std::string c2=SBase_getMetaId((SBase_t*)cb); fail_unless( c1 == c2 ); } // c1=SBase_getNotes((SBase_t*)CB); // c2=SBase_getNotes((SBase_t*)cb); // if(SBase_isSetNotes((SBase_t*)CB)) // { // fail_unless( strncmp(c1 , c2 ,strlen( c1)+1 )==0 ); // } // else{ // fail_unless(!(c1 || c2)); // } // c1=SBase_getAnnotation((SBase_t*)CB); // c2=SBase_getAnnotation((SBase_t*)cb); // if(SBase_isSetAnnotation((SBase_t*)CB)) // { // fail_unless( strncmp(c1 , c2 ,strlen( c1)+1 )==0 ); // } // else{ // fail_unless(!(c1 || c2)); // } Point_t *pos=CubicBezier_getStart(cb); Point_t *POS=CubicBezier_getStart(CB); fail_unless(pos != NULL); fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS)); fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS)); fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS)); pos=CubicBezier_getBasePoint1(cb); POS=CubicBezier_getBasePoint1(CB); fail_unless(pos != NULL); fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS)); fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS)); fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS)); pos=CubicBezier_getBasePoint2(cb); POS=CubicBezier_getBasePoint2(CB); fail_unless(pos != NULL); fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS)); fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS)); fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS)); pos=CubicBezier_getEnd(cb); POS=CubicBezier_getEnd(CB); fail_unless(pos != NULL); fail_unless(Point_getXOffset(pos) == Point_getXOffset(POS)); fail_unless(Point_getYOffset(pos) == Point_getYOffset(POS)); fail_unless(Point_getZOffset(pos) == Point_getZOffset(POS)); Point_free(start); Point_free(base1); Point_free(base2); Point_free(end); CubicBezier_free(cb); }