X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FTest%2FTestConstraintParallel.py;h=4e71f0d01368b87458e3aa4b7dea7a312f55bf1d;hb=89c7c98ec9edffa2ae3f5216707fb87784f4ec4c;hp=2dd6ce202acedd6c1608ce9ad27df7b984705d0f;hpb=5b6031b015602aa07f5a6fc668c13ac3faf7a8a9;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/Test/TestConstraintParallel.py b/src/SketchPlugin/Test/TestConstraintParallel.py index 2dd6ce202..4e71f0d01 100644 --- a/src/SketchPlugin/Test/TestConstraintParallel.py +++ b/src/SketchPlugin/Test/TestConstraintParallel.py @@ -1,7 +1,26 @@ +# Copyright (C) 2014-2019 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 +30,8 @@ """ from GeomDataAPI import * from ModelAPI import * +from salome.shaper import model + #========================================================================= # Initialization of the test #========================================================================= @@ -49,6 +70,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 +93,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 +110,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 +129,9 @@ aLineBEndPointNew = (aLineBEndPoint.x(), aLineBEndPoint.y()) assert (aLineBStartPointPrev != aLineBStartPointNew) assert (aLineBEndPointPrev != aLineBEndPointNew) +assert (model.dof(aSketchFeature) == 5) #========================================================================= # End of test #========================================================================= -from salome.shaper import model assert(model.checkPythonDump())