]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for the unit-tests that use not HighAPI pythion interface to create construction...
authormpv <mpv@opencascade.com>
Wed, 11 Jul 2018 14:20:44 +0000 (17:20 +0300)
committermpv <mpv@opencascade.com>
Wed, 11 Jul 2018 14:20:58 +0000 (17:20 +0300)
src/ConstructionPlugin/Test/TestAxisCreation.py
src/ConstructionPlugin/Test/TestPointName.py
src/FeaturesPlugin/Test/TestFillet.py
src/Model/Model_Expression.cpp
src/ModelAPI/Test/TestDocument.py
src/ModelAPI/Test/TestFolder_Create.py
src/ModelAPI/Test/TestFolder_Remove.py
src/ModelAPI/Test/TestFolder_Stability.py
src/ModelAPI/Test/TestFolder_Update.py
src/SketchPlugin/Test/TestConstraintCoincidence.py
src/SketchPlugin/Test/TestConstraintMiddlePoint.py

index a645c548e03fff88011f13993285b2e4e50b1485..642d83bde2f2c73dccb4e13df86a46334d4eb885 100644 (file)
@@ -48,10 +48,7 @@ aSession.startOperation()
 aPointFeature = aPart.addFeature("Point")
 aPointFeatureData = aPointFeature.data()
 assert(aPointFeatureData is not None)
-# aPointFeatureData.string("creation_method").setValue("by_xyz")
-aPointFeatureData.real("x").setValue(0.)
-aPointFeatureData.real("y").setValue(0.)
-aPointFeatureData.real("z").setValue(0.)
+geomDataAPI_Point(aPointFeatureData.attribute("point3d")).setValue(0., 0., 0.)
 aPointFeatureData.string("creation_method").setValue("by_xyz")
 aPointFeature.execute()
 aSession.finishOperation()
@@ -64,10 +61,7 @@ aSession.startOperation()
 aPointFeature = aPart.addFeature("Point")
 aPointFeatureData = aPointFeature.data()
 assert(aPointFeatureData is not None)
-# aPointFeatureData.string("creation_method").setValue("by_xyz")
-aPointFeatureData.real("x").setValue(0.)
-aPointFeatureData.real("y").setValue(0.)
-aPointFeatureData.real("z").setValue(100.)
+geomDataAPI_Point(aPointFeatureData.attribute("point3d")).setValue(0., 0., 100.)
 aPointFeatureData.string("creation_method").setValue("by_xyz")
 aPointFeature.execute()
 aSession.finishOperation()
index 5579700911197b14bae4f48e8523ca90a2243d49..3b4fee98513248617c1c61b2029d936afa627968 100644 (file)
@@ -19,6 +19,7 @@
 ##
 
 from ModelAPI import *
+from GeomDataAPI import *
 
 aSession = ModelAPI_Session.get()
 aDoc = aSession.moduleDocument()
@@ -27,10 +28,7 @@ aSession.startOperation()
 aFeature = aDoc.addFeature("Point")
 aFeatureData = aFeature.data()
 assert(aFeatureData is not None)
-# aFeatureData.string("creation_method").setValue("by_xyz")
-aFeatureData.real("x").setValue(0.)
-aFeatureData.real("y").setValue(0.)
-aFeatureData.real("z").setValue(0.)
+geomDataAPI_Point(aFeatureData.attribute("point3d")).setValue(0., 0., 0.)
 aFeatureData.string("creation_method").setValue("by_xyz")
 aFeatureName = aFeature.name()
 aFeature.execute()
index 49831b3f54d560f5d7e85c59ad88242e961bdb16..a641328bf4764a8f7f8b937b673cd251c4e3702a 100644 (file)
@@ -24,6 +24,7 @@
 """
 
 from ModelAPI import *
+from GeomDataAPI import *
 
 __updated__ = "2017-11-30"
 
@@ -51,9 +52,7 @@ aSession.finishOperation()
 aSession.startOperation()
 aPoint = aPart.addFeature("Point")
 aPoint.string("creation_method").setValue("by_xyz")
-aPoint.real("x").setValue(20)
-aPoint.real("y").setValue(5)
-aPoint.real("z").setValue(0)
+geomDataAPI_Point(aFeature.attribute("point3d")).setValue(20, 5, 0)
 aSession.finishOperation()
 
 aSession.startOperation()
index 4a129757aa406bf8625598c93fb59d69e54d4a0c..2696e6c2d75f0dc8ec7ea8e538c1403dcf58a8b6 100644 (file)
@@ -118,7 +118,7 @@ void Model_ExpressionDouble::setValue(const double theValue)
 
 double Model_ExpressionDouble::value()
 {
-  if (myIsInitialized)
+  if (myIsInitialized && !myReal.IsNull())
     return myReal->Get();
   return std::numeric_limits<double>::max(); // error
 }
@@ -166,7 +166,7 @@ void Model_ExpressionInteger::setValue(const int theValue)
 
 int Model_ExpressionInteger::value()
 {
-  if (myIsInitialized)
+  if (myIsInitialized && !myInteger.IsNull())
     return myInteger->Get();
   return std::numeric_limits<int>::max(); // error
 }
index f197d2606da5b9e1bc146108763178a0660b06e6..ee8f7eb1d8c3d47424e403a6fd223d1fd5758387 100644 (file)
@@ -27,6 +27,7 @@
 # Initialization of the test
 #=========================================================================
 from ModelAPI import *
+from GeomDataAPI import *
 
 __updated__ = "2014-12-26"
 
@@ -71,9 +72,7 @@ aSession.startOperation()
 aFeature = aPart.addFeature("Point")
 aFeatureData = aFeature.data()
 assert(aFeatureData is not None)
-aFeatureData.real("x").setValue(15.)
-aFeatureData.real("y").setValue(10.)
-aFeatureData.real("z").setValue(20.)
+geomDataAPI_Point(aFeatureData.attribute("point3d")).setValue(15., 10., 20.)
 aSession.finishOperation()
 assert(aPart.size("Features") == 1)
 # Duplicate the document
index ad96314551e5703e75e6d2880e6b5003503ad2de..6ef31341dd2bc0befedea1ed97d8bf20966848c2 100644 (file)
@@ -22,6 +22,7 @@
 # Initialization of the test
 #=========================================================================
 from ModelAPI import *
+from GeomDataAPI import *
 
 __updated__ = "2017-11-22"
 
@@ -35,9 +36,7 @@ aSession.startOperation()
 aPoint0 = aPartSetDoc.addFeature("Point")
 aPoint0Data = aPoint0.data()
 assert(aPoint0Data is not None)
-aPoint0Data.real("x").setValue(0.)
-aPoint0Data.real("y").setValue(0.)
-aPoint0Data.real("z").setValue(0.)
+geomDataAPI_Point(aPoint0Data.attribute("point3d")).setValue(0., 0., 0.)
 aPoint0Data.string("creation_method").setValue("by_xyz")
 aSession.finishOperation()
 
@@ -45,9 +44,7 @@ aSession.startOperation()
 aPoint1 = aPartSetDoc.addFeature("Point")
 aPoint1Data = aPoint1.data()
 assert(aPoint1Data is not None)
-aPoint1Data.real("x").setValue(0.)
-aPoint1Data.real("y").setValue(0.)
-aPoint1Data.real("z").setValue(0.)
+geomDataAPI_Point(aPoint1Data.attribute("point3d")).setValue(0., 0., 0.)
 aPoint1Data.string("creation_method").setValue("by_xyz")
 aSession.finishOperation()
 
@@ -87,9 +84,7 @@ aSession.startOperation()
 aPoint2 = aPartDoc.addFeature("Point")
 aPoint2Data = aPoint2.data()
 assert(aPoint2Data is not None)
-aPoint2Data.real("x").setValue(0.)
-aPoint2Data.real("y").setValue(0.)
-aPoint2Data.real("z").setValue(0.)
+geomDataAPI_Point(aPoint2Data.attribute("point3d")).setValue(0., 0., 0.)
 aPoint2Data.string("creation_method").setValue("by_xyz")
 aSession.finishOperation()
 
index 6e78b581f1c6ef9e0142bb20ade505e5ff00861e..632c88c6e428ada7eb089017c667b8e1739b674f 100644 (file)
@@ -22,6 +22,7 @@
 # Initialization of the test
 #=========================================================================
 from ModelAPI import *
+from GeomDataAPI import *
 
 __updated__ = "2017-11-24"
 
@@ -33,9 +34,7 @@ def newPoint(theDocument, theX, theY, theZ):
     aPoint = theDocument.addFeature("Point")
     aPointData = aPoint.data()
     assert(aPointData is not None)
-    aPointData.real("x").setValue(theX)
-    aPointData.real("y").setValue(theY)
-    aPointData.real("z").setValue(theZ)
+    geomDataAPI_Point(aPointData.attribute("point3d")).setValue(theX, theY, theZ)
     aPointData.string("creation_method").setValue("by_xyz")
     aSession.finishOperation()
     return aPoint
index e6cdbe893c8f280cc1a1f61fc381cbc00e4f6feb..e6a86c297baf3186b97327d1be27392131c82ea2 100644 (file)
@@ -22,6 +22,7 @@
 # Test checks stability of the foldering mechanism due to incorrect input parameters
 #=========================================================================
 from ModelAPI import *
+from GeomDataAPI import *
 
 __updated__ = "2017-11-23"
 
@@ -33,9 +34,7 @@ def newPoint(theDocument, theX, theY, theZ):
     aPoint = theDocument.addFeature("Point")
     aPointData = aPoint.data()
     assert(aPointData is not None)
-    aPointData.real("x").setValue(theX)
-    aPointData.real("y").setValue(theY)
-    aPointData.real("z").setValue(theZ)
+    geomDataAPI_Point(aPointData.attribute("point3d")).setValue(theX, theY, theZ)
     aPointData.string("creation_method").setValue("by_xyz")
     aSession.finishOperation()
     return aPoint
index 39406251df079dbd2b17e96f8e702cd718cda08d..145be954c067bdbf25acd70563559317d3bd37de 100644 (file)
@@ -22,6 +22,7 @@
 # Initialization of the test
 #=========================================================================
 from ModelAPI import *
+from GeomDataAPI import *
 
 __updated__ = "2017-11-23"
 
@@ -33,9 +34,7 @@ def newPoint(theDocument, theX, theY, theZ):
     aPoint = theDocument.addFeature("Point")
     aPointData = aPoint.data()
     assert(aPointData is not None)
-    aPointData.real("x").setValue(theX)
-    aPointData.real("y").setValue(theY)
-    aPointData.real("z").setValue(theZ)
+    geomDataAPI_Point(aPointData.attribute("point3d")).setValue(theX, theY, theZ)
     aPointData.string("creation_method").setValue("by_xyz")
     aSession.finishOperation()
     return aPoint
index 4ce25cd89b2033a504266abde2c2e3a667d5f91d..7d6424e87d2a739db8b0db0b758cef476d3466a6 100644 (file)
@@ -83,10 +83,7 @@ aDocument = aSession.moduleDocument()
 # add an origin
 aSession.startOperation()
 aFeature = aDocument.addFeature("Point")
-# aFeature.string("creation_method").setValue("by_xyz")
-aFeature.real("x").setValue(0.)
-aFeature.real("y").setValue(0.)
-aFeature.real("z").setValue(0.)
+geomDataAPI_Point(aFeature.attribute("point3d")).setValue(0., 0., 0.)
 aFeature.string("creation_method").setValue("by_xyz")
 anOriginName = aFeature.name()
 aSession.finishOperation()
index c5aaa01a867056b217a72eb9ba7c0480532b9414..53133e6b5cc24775b17cbb76930d3ccdf9ec1087 100644 (file)
@@ -67,10 +67,7 @@ aDocument = aSession.moduleDocument()
 # add an origin
 aSession.startOperation()
 aFeature = aDocument.addFeature("Point")
-# aFeature.string("creation_method").setValue("by_xyz")
-aFeature.real("x").setValue(0.)
-aFeature.real("y").setValue(0.)
-aFeature.real("z").setValue(0.)
+geomDataAPI_Point(aFeature.attribute("point3d")).setValue(0., 0., 0.)
 aFeature.string("creation_method").setValue("by_xyz")
 anOriginName = aFeature.name()
 aSession.finishOperation()