From d1c2c91f0011ca6bb059652d13238624e7b14a88 Mon Sep 17 00:00:00 2001 From: mpv Date: Tue, 9 Jan 2018 18:01:44 +0300 Subject: [PATCH] Add more tests for update of the sketcher behavior check --- src/ModelAPI/CMakeLists.txt | 1 + src/SketchPlugin/CMakeLists.txt | 1 + src/SketchPlugin/Test/Test2062.py | 38 +++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 src/SketchPlugin/Test/Test2062.py diff --git a/src/ModelAPI/CMakeLists.txt b/src/ModelAPI/CMakeLists.txt index aa0b87e0c..7393fd02d 100644 --- a/src/ModelAPI/CMakeLists.txt +++ b/src/ModelAPI/CMakeLists.txt @@ -174,6 +174,7 @@ ADD_UNIT_TESTS(TestConstants.py Test2241.py Test2252.py Test2276.py + Test2391.py TestCustomName_BooleanCut.py TestCustomName_CommonCompSolid.py TestCustomName_CutCompSolid.py diff --git a/src/SketchPlugin/CMakeLists.txt b/src/SketchPlugin/CMakeLists.txt index 1391e252a..55e8b72f6 100644 --- a/src/SketchPlugin/CMakeLists.txt +++ b/src/SketchPlugin/CMakeLists.txt @@ -198,6 +198,7 @@ ADD_UNIT_TESTS(TestSketchPointLine.py Test1924.py Test1966.py Test1967.py + Test2062.py Test2095.py Test2115.py TestTrimArc01.py diff --git a/src/SketchPlugin/Test/Test2062.py b/src/SketchPlugin/Test/Test2062.py new file mode 100644 index 000000000..aa323b823 --- /dev/null +++ b/src/SketchPlugin/Test/Test2062.py @@ -0,0 +1,38 @@ +## 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 +## + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOZ")) +SketchLine_1 = Sketch_1.addLine(10, 10, 10, 100) +SketchLine_2 = Sketch_1.addLine(10, 100, 100, 10) +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) +model.do() +# make non-perpendicular line perpendicular +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_2.result()) +model.do() +# this moves the line +assert(SketchLine_1.startPoint().x() != 10) +model.end() +model.undo() +# undo must move the line exactly back +assert(SketchLine_1.startPoint().x() == 10) -- 2.39.2