Salome HOME
Issue #1383 Preview button: correction for the case: switch off auto_preview in extru...
[modules/shaper.git] / src / ExchangePlugin / Test / TestImport.py
index 5a7b23d2a5437fd5dd0295877de518627abd5cea..624f7f31867132550a84c3c5f3ec0c72530b2e9f 100644 (file)
@@ -20,22 +20,22 @@ aSession = ModelAPI_Session.get()
 #=========================================================================
 def testImport(theType, theFile, theVolume, theDelta):
     # Create a part for import
-    aSession.startOperation()
+    aSession.startOperation("Create part for import")
     aPartFeature = aSession.moduleDocument().addFeature("Part")
     aSession.finishOperation()
     aPart = aSession.activeDocument()
-    
-    aSession.startOperation()
+
+    aSession.startOperation("Import file")
     aFeatureKind = "Import"
     anImportFeature = aPart.addFeature(aFeatureKind)
     assert anImportFeature, "{0}: Can not create a feature {1}".format(theType, aFeatureKind)
-    aFieldName = "import_file_selector"
+    aFieldName = "file_path"
     file = anImportFeature.string(aFieldName)
     assert file, "{0}: Can not receive string field {1}".format(theType, aFieldName)
     file.setValue(theFile)
     anImportFeature.execute()
     aSession.finishOperation()
-    
+
     # Check results
     assert anImportFeature.error() == '', "{0}: The error after execution: {1}".format(theType, anImportFeature.error())
     assert len(anImportFeature.results()) == 1, "{0}: Wrong number of results: expected = 1, real = {1}".format(theType, len(anImportFeature.results()))
@@ -43,27 +43,28 @@ def testImport(theType, theFile, theVolume, theDelta):
     assert aResultBody, "{0}: The result is not a body".format(theType)
     aShape = aResultBody.shape()
     assert aShape, "{0}: The body does not have a shape".format(theType)
-    
+
     # Check shape volume
     aRefVolume = theVolume
-    aResVolume = GeomAlgoAPI_ShapeProps.volume(aShape)
+    aResVolume = GeomAlgoAPI_ShapeTools.volume(aShape)
     assert (math.fabs(aResVolume - aRefVolume) < theDelta), "{0}: The volume is wrong: expected = {1}, real = {2}".format(theType, aRefVolume, aResVolume)
 
 if __name__ == '__main__':
 #=========================================================================
 # Create a shape imported from BREP
 #=========================================================================
-    testImport("BREP", "Data/solid.brep", 259982.29715, 10 ** -5)
+    testImport("BREP", "Data/solid.brep", 259982.297176, 10 ** -5)
+    testImport("BRP", "Data/solid.brp", 259982.297176, 10 ** -5)
 #=========================================================================
 # Create a shape imported from STEP
 #=========================================================================
-    testImport("STP", "Data/screw.stp", 3.78827059338e-06, 10 ** -17)
-    testImport("STEP", "Data/screw.step", 3.78827059338e-06, 10 ** -17)
+    testImport("STP", "Data/screw.stp", 3.78827401738e-06, 10 ** -17)
+    testImport("STEP", "Data/screw.step", 3.78827401738e-06, 10 ** -17)
 #=========================================================================
 # Create a shape imported from IGES
 #=========================================================================
-    testImport("IGES", "Data/bearing.iges", 6.86980756235e-14, 10 ** -25)
-    testImport("IGS", "Data/bearing.igs", 6.86980756235e-14, 10 ** -25)
+    testImport("IGES", "Data/bearing.iges", 6.86970803067e-14, 10 ** -25)
+    testImport("IGS", "Data/bearing.igs", 6.86970803067e-14, 10 ** -25)
 #=========================================================================
 # End of test
 #=========================================================================