Added QA command OCC23950 and test case bugs/xde/bug23950 for issue 23950
authorapv <apv@opencascade.com>
Wed, 11 Jun 2014 08:44:00 +0000 (12:44 +0400)
committerapn <apn@opencascade.com>
Wed, 11 Jun 2014 10:44:42 +0000 (14:44 +0400)
src/QABugs/QABugs_19.cxx
tests/bugs/xde/bug23950 [new file with mode: 0644]

index aa405ad..900a14a 100755 (executable)
@@ -1800,6 +1800,47 @@ static Standard_Integer OCC23951 (Draw_Interpretor& di, Standard_Integer argc, c
 }
 
 
+//=======================================================================
+//function : OCC23950
+//purpose  :
+//=======================================================================
+static Standard_Integer OCC23950 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 1) {
+    di << "Usage: " << argv[0] << " invalid number of arguments" << "\n";
+    return 1;
+  }
+
+  Handle(TDocStd_Document) aDoc = new TDocStd_Document ("dummy");
+  TopoDS_Shape s6 = BRepBuilderAPI_MakeVertex (gp_Pnt (75, 0, 0));
+  gp_Trsf t0;
+  TopLoc_Location location0 (t0);
+
+  TDF_Label lab1 = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main ())->NewShape ();
+  XCAFDoc_DocumentTool::ShapeTool (aDoc->Main ())->SetShape (lab1, s6);
+  TDataStd_Name::Set(lab1, "Point1");
+
+  TDF_Label labelA0 = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main ())->NewShape ();
+  TDataStd_Name::Set(labelA0, "ASSEMBLY");
+
+  TDF_Label component01 = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main ())->AddComponent (labelA0, lab1, location0);
+
+  Quantity_Color yellow(1,1,0, Quantity_TOC_RGB);
+  XCAFDoc_DocumentTool::ColorTool (labelA0)->SetColor (component01, yellow, XCAFDoc_ColorGen);
+  XCAFDoc_DocumentTool::ColorTool (labelA0)->SetVisibility (component01, 0);
+
+  STEPControl_StepModelType mode = STEPControl_AsIs;
+  STEPCAFControl_Writer writer;
+  if (! writer.Transfer (aDoc, mode))
+  {
+    di << "The document cannot be translated or gives no result" << "\n";
+    return 1;
+  }
+
+  writer.Write ("test_point_assembly.step");
+  return 0;
+}
+
 //=======================================================================
 //function : OCC24622
 //purpose  : The command tests sourcing Image_PixMap to AIS_TexturedShape
@@ -2399,5 +2440,6 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) {
   theCommands.Add ("OCC23951", "OCC23951", __FILE__, OCC23951, group);
   theCommands.Add ("OCC24931", "OCC24931", __FILE__, OCC24931, group);
   theCommands.Add ("OCC24945", "OCC24945", __FILE__, OCC24945, group);
+  theCommands.Add ("OCC23950", "OCC23950", __FILE__, OCC23950, group);
   return;
 }
diff --git a/tests/bugs/xde/bug23950 b/tests/bugs/xde/bug23950
new file mode 100644 (file)
index 0000000..263ef1c
--- /dev/null
@@ -0,0 +1,33 @@
+puts "TODO OCC23950 ALL: ERROR: OCC23950 is reproduced"
+
+puts "=========="
+puts "OCC23950"
+puts "=========="
+puts ""
+#################################################################################
+# Names and visibility of points not saved when writing XCAF Document into STEP
+#################################################################################
+
+pload QAcommands
+
+set info [OCC23950]
+
+if {[regexp "Write  Done" $info] != 1} {
+  puts "Error: file was not written"
+} else {
+  puts "OK: file was written"
+}
+
+set is23950fixed "FALSE"
+set file23950 [open test_point_assembly.step RDONLY]
+while {[eof $file23950] == 0} {
+  set file23950line [string trim [gets $file23950]]
+  if {[string first "Point1" $file23950line] != -1} {
+    set is23950fixed "TRUE"
+  }
+}
+close $file23950
+
+if {[string compare $is23950fixed "FALSE"] == 0} {
+  puts "ERROR: OCC23950 is reproduced"
+}