Salome HOME
Issue #1383 Preview button: correction for the case: switch off auto_preview in extru...
[modules/shaper.git] / src / ExchangePlugin / Test / TestExport.py
index 750bde940a656b69913d64a44a4da3056f202276..50b8fc8839ec76366eb596c60e7983aa16f0501d 100644 (file)
@@ -31,46 +31,46 @@ def removeFile(theFileName):
 # Common test function
 #=========================================================================
 def testExport(theType, theFormat, theFile, theVolume, theDelta):
-    # Import a reference part 
-    aSession.startOperation()
+    # Import a reference part
+    aSession.startOperation("Add part")
     aPartFeature = aSession.moduleDocument().addFeature("Part")
     aSession.finishOperation()
     aPart = aSession.activeDocument()
-    
-    aSession.startOperation()
+
+    aSession.startOperation("Import screw")
     anImportFeature = aPart.addFeature("Import")
-    anImportFeature.string("import_file_selector").setValue("Data/screw.step")
+    anImportFeature.string("file_path").setValue("Data/screw.step")
     anImportFeature.execute()
     aSession.finishOperation()
-    
+
     removeFile(theFile)
     # Export a part
-    aSession.startOperation()
+    aSession.startOperation("Export part")
     aFeatureKind = "Export"
     anExportFeature = aPart.addFeature(aFeatureKind)
     assert anExportFeature, "{0}: Can not create a feature {1}".format(theType, aFeatureKind)
-    
-    aFormatAttrName = "export_file_format"
+
+    aFormatAttrName = "file_format"
     aFormatAttr = anExportFeature.string(aFormatAttrName)
     assert aFormatAttr, "{0}: Can not receive string field {1}".format(theType, aFormatAttrName)
     aFormatAttr.setValue(theFormat)
-    
-    aFileAttrName = "export_file_selector"
+
+    aFileAttrName = "file_path"
     aFileAttr = anExportFeature.string(aFileAttrName)
     assert aFileAttr, "{0}: Can not receive string field {1}".format(theType, aFileAttrName)
     aFileAttr.setValue(theFile)
-    
+
     aSelectionListAttrName = "selection_list"
     aSelectionListAttr = anExportFeature.selectionList(aSelectionListAttrName)
     assert aSelectionListAttr, "{0}: Can not receive selection list field {1}".format(theType, aSelectionListAttrName)
     aSelectionListAttr.setSelectionType("solids")
     aSelectionListAttr.append(anImportFeature.firstResult(), anImportFeature.firstResult().shape())
-    
+
     anExportFeature.execute()
     aSession.finishOperation()
-    
+
     assert os.path.exists(theFile), "{0}: Can not find exported file {1}".format(theType, theFile)
-    
+
     # Test exported file by importing
     testImport(theType, theFile, theVolume, theDelta)
 
@@ -78,21 +78,21 @@ if __name__ == '__main__':
 #=========================================================================
 # Export a shape into BREP
 #=========================================================================
-    aRealVolume = 3.78827059338e-06
+    aRealVolume = 3.78827401738e-06
     testExport("BREP", "BREP", os.path.join(os.getcwd(), "Data", "screw_export.brep"), aRealVolume, 10 ** -17)
     testExport("BRP", "BREP", os.path.join(os.getcwd(), "Data", "screw_export.brp"), aRealVolume, 10 ** -17)
 #=========================================================================
 # Export a shape into STEP
 #=========================================================================
-    testExport("STEP", "STEP", os.path.join(os.getcwd(), "Data", "screw_export.step"), 3.7882546512e-06, 10 ** -17)
-    testExport("STP", "STEP", os.path.join(os.getcwd(), "Data", "screw_export.stp"), 3.7882546512e-06, 10 ** -17)
+    testExport("STEP", "STEP", os.path.join(os.getcwd(), "Data", "screw_export.step"), 3.78825807533e-06, 10 ** -17)
+    testExport("STP", "STEP", os.path.join(os.getcwd(), "Data", "screw_export.stp"), 3.78825807533e-06, 10 ** -17)
 #=========================================================================
 # Export a shape into IGES
 #=========================================================================
-    testExport("IGES-5.1", "IGES-5.1", os.path.join(os.getcwd(), "Data", "screw_export-5.1.iges"), 1.98291079746e-06, 10 ** -17)
-    testExport("IGS-5.1", "IGES-5.1", os.path.join(os.getcwd(), "Data", "screw_export-5.1.igs"), 1.98291079746e-06, 10 ** -17)
-    testExport("IGES-5.3", "IGES-5.3", os.path.join(os.getcwd(), "Data", "screw_export-5.3.iges"), 3.78827060085e-06, 10 ** -17)
-    testExport("IGS-5.3", "IGES-5.3", os.path.join(os.getcwd(), "Data", "screw_export-5.3.igs"), 3.78827060085e-06, 10 ** -17)
+    testExport("IGES-5.1", "IGES-5.1", os.path.join(os.getcwd(), "Data", "screw_export-5.1.iges"), 3.78829613776e-06, 10 ** -17)
+    testExport("IGS-5.1", "IGES-5.1", os.path.join(os.getcwd(), "Data", "screw_export-5.1.igs"), 3.78829613776e-06, 10 ** -17)
+    testExport("IGES-5.3", "IGES-5.3", os.path.join(os.getcwd(), "Data", "screw_export-5.3.iges"), 3.78827401651e-06, 10 ** -17)
+    testExport("IGS-5.3", "IGES-5.3", os.path.join(os.getcwd(), "Data", "screw_export-5.3.igs"), 3.78827401651e-06, 10 ** -17)
 #=========================================================================
 # End of test
 #=========================================================================