X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FTest%2FTestMultiTranslation.py;h=02aed600b52d4569d9b423d7d882ef8ef2603392;hb=06e7f5859095193fc7f498bd89a7d28009794f53;hp=639fd4e30a2a69cce9da2856b84ff45146156a57;hpb=1de75803e9baf3de59fa755f9eccb6ef60bb64e4;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/Test/TestMultiTranslation.py b/src/SketchPlugin/Test/TestMultiTranslation.py index 639fd4e30..02aed600b 100644 --- a/src/SketchPlugin/Test/TestMultiTranslation.py +++ b/src/SketchPlugin/Test/TestMultiTranslation.py @@ -1,7 +1,26 @@ +# Copyright (C) 2014-2023 CEA, EDF +# +# 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 +# + """ TestMultiTranslation.py Unit test of SketchPlugin_MultiTranslation class - + SketchPlugin_MultiTranslation static const std::string MY_CONSTRAINT_TRANSLATION_ID("SketchMultiTranslation"); data()->addAttribute(VALUE_TYPE(), ModelAPI_AttributeString::typeId()); @@ -34,7 +53,7 @@ def createSketch(theSketch): allFeatures.append(aSketchArc) theSketch.execute() return allFeatures - + def createLine(theSketch): aSketchLine = theSketch.addFeature("SketchLine") aStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint")) @@ -43,7 +62,7 @@ def createLine(theSketch): aEndPoint.setValue(1., 3.) theSketch.execute() return aSketchLine - + def checkTranslation(theObjects, theNbObjects, theDeltaX, theDeltaY): # Verify distances of the objects and the number of copies aFeatures = [] @@ -52,15 +71,15 @@ def checkTranslation(theObjects, theNbObjects, theDeltaX, theDeltaY): feat = ModelAPI_Feature.feature(theObjects.object(i)) assert(feat is not None) aFeatures.append(feat) - - anInd = 0 + + anInd = 0 for feat, next in zip(aFeatures[:-1], aFeatures[1:]): anInd = anInd + 1 if (anInd > theNbObjects-1): anInd = 0 continue assert(feat.getKind() == next.getKind()) - + anAttributes = [] if (feat.getKind() == "SketchLine"): anAttributes.append('StartPoint') @@ -69,7 +88,7 @@ def checkTranslation(theObjects, theNbObjects, theDeltaX, theDeltaY): anAttributes.append('center_point') anAttributes.append('start_point') anAttributes.append('end_point') - + for attr in anAttributes: aPoint1 = geomDataAPI_Point2D(feat.attribute(attr)) aPoint2 = geomDataAPI_Point2D(next.attribute(attr))