X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FTest%2FTestConstraintParallel.py;h=1b040ba3ced73893847f619c6b08fe6f13a8e0a3;hb=aa7ce8bd36a44173fd76fefa189d8b6123d76ad2;hp=076b2fc6277986ba1e1340c3a28b4e5a29c6cdb0;hpb=d34842c50d5f335cca443c78910c16c54139c7d0;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/Test/TestConstraintParallel.py b/src/SketchPlugin/Test/TestConstraintParallel.py index 076b2fc62..1b040ba3c 100644 --- a/src/SketchPlugin/Test/TestConstraintParallel.py +++ b/src/SketchPlugin/Test/TestConstraintParallel.py @@ -1,7 +1,27 @@ +## Copyright (C) 2014-2017 CEA/DEN, EDF R&D +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +## +## See http:##www.salome-platform.org/ or +## email : webmaster.salome@opencascade.com +## + """ TestConstraintParallel.py Unit test of SketchPlugin_ConstraintParallel class - + SketchPlugin_ConstraintParallel static const std::string MY_CONSTRAINT_PARALLEL_ID("SketchConstraintParallel"); data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); @@ -11,6 +31,8 @@ """ from GeomDataAPI import * from ModelAPI import * +from salome.shaper import model + #========================================================================= # Initialization of the test #========================================================================= @@ -49,6 +71,7 @@ aLineBEndPoint = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint")) aLineBStartPoint.setValue(0., 50) aLineBEndPoint.setValue(80., 75) aSession.finishOperation() +assert (model.dof(aSketchFeature) == 8) #========================================================================= # Make a constraint to keep the length of the line constant # to parallel perpendicular constraint collapsing line to point @@ -71,6 +94,7 @@ assert (aLineBStartPoint.x() == 0) assert (aLineBStartPoint.y() == 50) assert (aLineBEndPoint.x() == 80) assert (aLineBEndPoint.y() == 75) +assert (model.dof(aSketchFeature) == 6) #========================================================================= # Link lines with parallel constraint #========================================================================= @@ -87,6 +111,7 @@ refattrA.setObject(aResultA) refattrB.setObject(aResultB) aParallelConstraint.execute() aSession.finishOperation() +assert (model.dof(aSketchFeature) == 5) #========================================================================= # Check values and move one constrainted object #========================================================================= @@ -105,9 +130,9 @@ aLineBEndPointNew = (aLineBEndPoint.x(), aLineBEndPoint.y()) assert (aLineBStartPointPrev != aLineBStartPointNew) assert (aLineBEndPointPrev != aLineBEndPointNew) +assert (model.dof(aSketchFeature) == 5) #========================================================================= # End of test #========================================================================= -import model assert(model.checkPythonDump())