0029412: Huge Memory leak since I upgraded to OC 6.9.0
[occt.git] / src / QABugs / QABugs_19.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 6bcc1c3..88ad638
 
 #include <QABugs.hxx>
 
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <ViewerTest.hxx>
-#include <V3d_View.hxx>
-#include <TopoDS_Shape.hxx>
 #include <AIS_InteractiveContext.hxx>
 #include <AIS_LocalContext.hxx>
-#include <AIS_TexturedShape.hxx>
-#include <Image_PixMap.hxx>
-#include <Image_Color.hxx>
-
-#include <gp_Pnt2d.hxx>
-#include <gp_Ax1.hxx>
-#include <GCE2d_MakeSegment.hxx>
-#include <Geom2d_TrimmedCurve.hxx>
-#include <DrawTrSurf.hxx>
-
-#include <Precision.hxx>
-
-#include <cstdio>
-#include <cmath>
-#include <iostream>
-#include <OSD_Timer.hxx>
-#include <OSD_Parallel.hxx>
-#include <OSD_PerfMeter.hxx>
+#include <AIS_Shape.hxx>
+#include <BRepAlgoAPI_Cut.hxx>
+#include <BRepOffsetAPI_MakePipe.hxx>
 #include <BRepPrimAPI_MakeBox.hxx>
 #include <BRepPrimAPI_MakeSphere.hxx>
-#include <BRepAlgo_Cut.hxx>
-#include <NCollection_Map.hxx>
+#include <DBRep.hxx>
+#include <Draw_Interpretor.hxx>
+#include <DrawTrSurf.hxx>
+#include <GCE2d_MakeSegment.hxx>
+#include <Geom2d_TrimmedCurve.hxx>
+#include <GeomFill_Trihedron.hxx>
+#include <Graphic3d_ArrayOfTriangles.hxx>
+#include <gp_Ax1.hxx>
+#include <gp_Pnt2d.hxx>
+#include <gp_Quaternion.hxx>
+#include <Image_Color.hxx>
+#include <Image_PixMap.hxx>
 #include <NCollection_Handle.hxx>
 #include <NCollection_IncAllocator.hxx>
+#include <NCollection_Map.hxx>
+#include <OSD_Parallel.hxx>
+#include <OSD_PerfMeter.hxx>
+#include <OSD_Timer.hxx>
+#include <Precision.hxx>
+#include <Prs3d_ShadingAspect.hxx>
+#include <Prs3d_Text.hxx>
+#include <SelectMgr_Filter.hxx>
+#include <Standard_Version.hxx>
+#include <StdSelect_BRepOwner.hxx>
 #include <TCollection_HAsciiString.hxx>
-#include <GeomFill_Trihedron.hxx>
-#include <BRepOffsetAPI_MakePipe.hxx>
 #include <TopExp_Explorer.hxx>
+#include <TopoDS_Shape.hxx>
+#include <V3d_View.hxx>
+#include <ViewerTest.hxx>
+#include <XmlDrivers_DocumentRetrievalDriver.hxx>
+#include <XmlDrivers_DocumentStorageDriver.hxx>
+#include <TDataStd_Real.hxx>
+#include <Standard_Atomic.hxx>
 
-#include <Standard_Version.hxx>
+#include <cstdio>
+#include <cmath>
+#include <iostream>
 
 #define QCOMPARE(val1, val2) \
   di << "Checking " #val1 " == " #val2 << \
 static Standard_Integer OCC230 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
 {
   if ( argc != 4) {
-    di << "ERROR OCC230: Usage : " << argv[0] << " TrimmedCurve Pnt2d Pnt2d" << "\n";
+    di << "ERROR OCC230: Usage : " << argv[0] << " TrimmedCurve Pnt2d Pnt2d\n";
     return 1;
   }
 
   gp_Pnt2d P1, P2;
   if ( !DrawTrSurf::GetPoint2d(argv[2],P1)) {
-    di << "ERROR OCC230: " << argv[2] << " is not Pnt2d" << "\n";
+    di << "ERROR OCC230: " << argv[2] << " is not Pnt2d\n";
     return 1;
   }
   if ( !DrawTrSurf::GetPoint2d(argv[3],P2)) {
-    di << "ERROR OCC230: " << argv[3] << " is not Pnt2d" << "\n";
+    di << "ERROR OCC230: " << argv[3] << " is not Pnt2d\n";
     return 1;
   }
 
@@ -98,9 +104,9 @@ static Standard_Integer OCC23361 (Draw_Interpretor& di, Standard_Integer /*argc*
 
   // points must be equal
   if ( ! p2.IsEqual(p3, Precision::Confusion()) )
-    di << "ERROR OCC23361: equivalent transformations does not produce equal points" << "\n";
+    di << "ERROR OCC23361: equivalent transformations does not produce equal points\n";
   else 
-    di << "OCC23361: OK" << "\n";
+    di << "OCC23361: OK\n";
 
   return 0;
 }
@@ -121,21 +127,25 @@ static Standard_Integer OCC23237 (Draw_Interpretor& di, Standard_Integer /*argc*
     // do some operation that will take considerable time compared with time of starting / stopping timers
     BRepPrimAPI_MakeBox aBox (10., 10., 10.);
     BRepPrimAPI_MakeSphere aSphere (10.);
-    BRepAlgo_Cut aCutter (aBox.Shape(), aSphere.Shape());
+    BRepAlgoAPI_Cut aCutter (aBox.Shape(), aSphere.Shape());
 
     aTM.Stop();
     aPM.Stop();
   }
  
   int aNbEnters = 0;
-  Standard_Real aPerfMeter_CPUtime = 0., aTimer_ElapsedTime = aTM.ElapsedTime();
+  Standard_Real aPerfMeter_CPUtime = 0., aTimer_CPUTime = 0., aS;
+  Standard_Integer aM, aH;
+  aTM.Show(aS, aM, aH, aTimer_CPUTime);
 
   perf_get_meter("TestMeter", &aNbEnters, &aPerfMeter_CPUtime);
+  perf_init_meter("TestMeter");
 
-  Standard_Real aTimeDiff = (fabs(aTimer_ElapsedTime - aPerfMeter_CPUtime) / aTimer_ElapsedTime);
+  Standard_Real aTimeDiff = (fabs(aTimer_CPUTime - aPerfMeter_CPUtime) / aTimer_CPUTime);
 
   printf("\nMeasurement results (%d cycles):\n", count);
-  printf("\nOSD_PerfMeter CPU time: %lf\nOSD_Timer elapsed time: %lf\n", aPerfMeter_CPUtime, aTimer_ElapsedTime);
+  printf("\nOSD_PerfMeter CPU time: %lf\nOSD_Timer CPU time: %lf\n",
+    aPerfMeter_CPUtime, aTimer_CPUTime);
   printf("Time delta is: %.3lf %%\n", aTimeDiff * 100);
 
   if (aTimeDiff > 0.2)
@@ -193,16 +203,16 @@ static Standard_Integer OCC22980 (Draw_Interpretor& di, Standard_Integer /*argc*
 }
 
 #include <TDocStd_Application.hxx>
-#include <XCAFApp_Application.hxx>
 #include <TDocStd_Document.hxx>
 #include <XCAFDoc_ShapeTool.hxx>
 #include <XCAFDoc_DocumentTool.hxx>
 #include <TDF_Label.hxx>
 #include <TDataStd_Name.hxx>
+#include <DDocStd.hxx>
 
 static Standard_Integer OCC23595 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
 {
-  const Handle(TDocStd_Application)& anApp = XCAFApp_Application::GetApplication();
+  Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
   Handle(TDocStd_Document) aDoc;
   anApp->NewDocument ("XmlXCAF", aDoc);
   QCOMPARE (!aDoc.IsNull(), Standard_True);
@@ -298,7 +308,7 @@ static Standard_Boolean OCC23774Test(const TopoDS_Face& grossPlateFace, const To
   BRepBuilderAPI_Transform transformer1(mirror1);
   transformer1.Perform(originalWire);
   if(!transformer1.IsDone()) {
-    di << "Not Done1 " << "\n";
+    di << "Not Done1 \n";
     return Standard_False;
   }
   TopoDS_Shape step1ModifiedShape = transformer1.ModifiedShape(originalWire);
@@ -381,12 +391,12 @@ static Standard_Address GeomConvertTest (Standard_Address data)
   GeomConvert_ApproxSurface aGAS (info->surf, 1e-4, GeomAbs_C1, GeomAbs_C1, 9, 9, 100, 1);
   if (!aGAS.IsDone()) {
     cout << "Error: ApproxSurface is not done!" << endl;
-    return Standard_False;
+    return 0;
   }
   const Handle(Geom_BSplineSurface)& aBSurf = aGAS.Surface();
   if (aBSurf.IsNull()) {
     cout << "Error: BSplineSurface is not created!" << endl;
-    return Standard_False;
+    return 0;
   }
   cout << "Number of UPoles:" << aBSurf->NbUPoles();
   if (aBSurf->NbUPoles() == info->nbupoles)
@@ -515,7 +525,7 @@ static Standard_Integer OCC23952intersect (Draw_Interpretor& di, Standard_Intege
 static Standard_Integer OCC23683 (Draw_Interpretor& di, Standard_Integer argc,const char ** argv)
 {
   if (argc < 2) {
-    di<<"Usage: " << argv[0] << " invalid number of arguments"<<"\n";
+    di<<"Usage: " << argv[0] << " invalid number of arguments\n";
     return 1;
   }
 
@@ -546,7 +556,7 @@ static int test_offset(Draw_Interpretor& di, Standard_Integer argc, const char**
   // Check the command arguments
   if ( argc != 1 )
   {
-    di << "Error: " << argv[0] << " - invalid number of arguments" << "\n";
+    di << "Error: " << argv[0] << " - invalid number of arguments\n";
     di << "Usage: type help " << argv[0] << "\n";
     return 1; // TCL_ERROR
   }
@@ -555,8 +565,8 @@ static int test_offset(Draw_Interpretor& di, Standard_Integer argc, const char**
   gp_Ax22d Ax2( gp::Origin2d(), gp::DY2d(), gp::DX2d() );
   Handle(Geom_Surface) Plane = new Geom_Plane( gp::YOZ() );
 
-  di << "<<<< Preparing sample surface of revolution based on trimmed curve >>>>" << "\n";
-  di << "-----------------------------------------------------------------------" << "\n";
+  di << "<<<< Preparing sample surface of revolution based on trimmed curve >>>>\n";
+  di << "-----------------------------------------------------------------------\n";
 
   Handle(Geom2d_Circle) C2d1 = new Geom2d_Circle(Ax2, 1.0);
   Handle(Geom2d_TrimmedCurve) C2d1Trimmed = new Geom2d_TrimmedCurve(C2d1, 0.0, M_PI/2.0);
@@ -569,10 +579,10 @@ static int test_offset(Draw_Interpretor& di, Standard_Integer argc, const char**
 
   DBRep::Set("f1", F1);
 
-  di << "Result: f1" << "\n";
+  di << "Result: f1\n";
 
-  di << "<<<< Preparing sample surface of revolution based on offset curve  >>>>" << "\n";
-  di << "-----------------------------------------------------------------------" << "\n";
+  di << "<<<< Preparing sample surface of revolution based on offset curve  >>>>\n";
+  di << "-----------------------------------------------------------------------\n";
 
   Handle(Geom2d_OffsetCurve) C2d2Offset = new Geom2d_OffsetCurve(C2d1Trimmed, -0.5);
   TopoDS_Edge E2 = BRepBuilderAPI_MakeEdge(C2d2Offset, Plane);
@@ -584,7 +594,7 @@ static int test_offset(Draw_Interpretor& di, Standard_Integer argc, const char**
 
   DBRep::Set("f2", F2);
 
-  di << "Result: f2" << "\n";
+  di << "Result: f2\n";
 
   return 0;
 }
@@ -600,17 +610,17 @@ static int test_offset(Draw_Interpretor& di, Standard_Integer argc, const char**
 static Standard_Integer OCC24008 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
 {
   if (argc != 3) {
-    di << "Usage: " << argv[0] << " invalid number of arguments" << "\n";
+    di << "Usage: " << argv[0] << " invalid number of arguments\n";
     return 1;
   }
   Handle(Geom_Curve) aCurve = DrawTrSurf::GetCurve(argv[1]);
   Handle(Geom_Surface) aSurf = DrawTrSurf::GetSurface(argv[2]);
   if (aCurve.IsNull()) {
-    di << "Curve was not read" << "\n";
+    di << "Curve was not read\n";
        return 1;
   }
   if (aSurf.IsNull()) {
-       di << "Surface was not read" << "\n";
+       di << "Surface was not read\n";
        return 1;
   }
   ShapeConstruct_ProjectCurveOnSurface aProj;
@@ -619,11 +629,11 @@ static Standard_Integer OCC24008 (Draw_Interpretor& di, Standard_Integer argc, c
     Handle(Geom2d_Curve) aPCurve;
     aProj.Perform (aCurve, aCurve->FirstParameter(), aCurve->LastParameter(), aPCurve);
     if (aPCurve.IsNull()) {
-         di << "PCurve was not created" << "\n";
+         di << "PCurve was not created\n";
          return 1;
     }
   } catch (...) {
-    di << "Exception was caught" << "\n";
+    di << "Exception was caught\n";
   }
   return 0;
 }
@@ -691,53 +701,6 @@ static Standard_Integer OCC23945 (Draw_Interpretor& /*di*/,Standard_Integer n, c
   return 0;
 }
 
-#include <Voxel_BoolDS.hxx>
-#include <Voxel_FastConverter.hxx>
-#include <Voxel_BooleanOperation.hxx>
-static Standard_Integer OCC24019 (Draw_Interpretor& di, Standard_Integer argc, const char** argv) 
-{
-  if ( argc != 2 ) {
-    di << "Error: " << argv[0] << " - invalid number of arguments" << "\n";
-       return 1;
-  }
-
-  TCollection_AsciiString aFileName = argv[1];
-  TopoDS_Shape aShape;
-  BRep_Builder aBuilder;
-
-  if (!BRepTools::Read(aShape, aFileName.ToCString(), aBuilder)) {
-    di << "Error: Could not read a shape!" << "\n";
-       return 1;
-  }
-  
-  TopoDS_Solid aShape1 = BRepPrimAPI_MakeSphere(gp_Pnt(20,25,35), 7);
-
-  Standard_Real deflection = 0.005;
-  Standard_Integer nbThreads = 1;
-  Standard_Integer nbx = 200, nby = 200, nbz = 200;
-  Voxel_BoolDS theVoxels(0,0,0, 50, 50, 50, nbx, nby, nbz);
-  Voxel_BoolDS theVoxels1(0,0,0, 50, 50, 50, nbx, nby, nbz);
-
-  Standard_Integer progress = 0;
-  Voxel_FastConverter fcp(aShape, theVoxels, deflection, nbx, nby, nbz, nbThreads);
-  fcp.ConvertUsingSAT(progress, 1);
-  fcp.FillInVolume(1);
-
-  Voxel_FastConverter fcp1(aShape1, theVoxels1, deflection, nbx, nby, nbz, nbThreads);
-  fcp1.ConvertUsingSAT(progress, 1);
-  fcp1.FillInVolume(1);
-
-  Voxel_BooleanOperation op;
-  Standard_Boolean result = op.Cut(theVoxels1, theVoxels);
-  if ( result != 1 ) {
-    di << "Error: invalid boolean operation" << "\n";
-  } else {
-       di << "OK: boolean operation is ok" << "\n";
-  }
-
-  return 0;
-}
-
 //=======================================================================
 //function : OCC11758
 //purpose  : 
@@ -1243,7 +1206,7 @@ static Standard_Integer OCC24005 (Draw_Interpretor& theDI, Standard_Integer theN
 
   if (!anInters.IsDone())
   {
-    theDI<<"No intersections found!"<<"\n";
+    theDI<<"No intersections found!\n";
 
     return 1;
   }
@@ -1324,41 +1287,13 @@ static Standard_Integer OCC24012 (Draw_Interpretor& di, Standard_Integer argc, c
     {
         TopoDS_Shape rshape = anormpro.Projection();
                Handle(AIS_InteractiveObject) myShape = new AIS_Shape (rshape);
-               myAISContext->SetColor(myShape, Quantity_Color(Quantity_NOC_YELLOW));
-               myAISContext->Display(myShape, Standard_True);
+               myAISContext->SetColor (myShape, Quantity_Color(Quantity_NOC_YELLOW), Standard_False);
+               myAISContext->Display (myShape, Standard_True);
     }
 
        return 0;
 }
 
-#include <Voxel_FastConverter.hxx>
-static Standard_Integer OCC24051 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) 
-{
-       if (argc != 1) {
-               di << "Usage : " << argv[0] << " should be one argument (command name only)";
-               return 1;
-       }
-
-       TopoDS_Shape shape = BRepPrimAPI_MakeBox(gp_Pnt(5, 10, 10), 10, 20, 30).Shape();
-       Standard_Integer progress = 0;
-       Standard_Real deflection = 0.005;
-       Standard_Integer nbx = 200, nby = 200, nbz = 200;
-       Voxel_BoolDS theVoxels(-50,-50,-30, 100, 100, 100, nbx, nby, nbz);
-       Voxel_BoolDS theVoxels1(-50,-50,-30, 100, 100, 100, nbx, nby, nbz);
-       Standard_Integer nbThreads = 5;
-       Voxel_FastConverter fcp(shape, theVoxels, deflection, nbx, nby, nbz, nbThreads, Standard_True);
-       
-       #ifdef WNT
-       #pragma omp parallel for
-        for(int i = 0; i < nbThreads; i++)
-                       fcp.ConvertUsingSAT(progress, i+1);
-       #endif
-       
-       fcp.ConvertUsingSAT(progress);
-
-       return 0;
-}
-
 #include <BRepFeat_SplitShape.hxx>
 #include <ShapeAnalysis_ShapeContents.hxx>
 #include <BRepAlgo.hxx>
@@ -1388,9 +1323,9 @@ static Standard_Integer OCC24086 (Draw_Interpretor& di, Standard_Integer argc, c
     ana.NbFaces();
 
        if (!(BRepAlgo::IsValid(result))) {
-               di << "Result was checked and it is INVALID" << "\n";
+               di << "Result was checked and it is INVALID\n";
        } else {
-               di << "Result was checked and it is VALID" << "\n";
+               di << "Result was checked and it is VALID\n";
        }
        
        Handle(AIS_InteractiveObject) myShape = new AIS_Shape (result);
@@ -1407,7 +1342,7 @@ static Standard_Integer OCC24086 (Draw_Interpretor& di, Standard_Integer argc, c
 static Standard_Integer OCC24945 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
 {
   if (argc != 1) {
-    di << "Usage: " << argv[0] << " invalid number of arguments" << "\n";
+    di << "Usage: " << argv[0] << " invalid number of arguments\n";
     return 1;
   }
 
@@ -1432,7 +1367,7 @@ static Standard_Integer OCC24945 (Draw_Interpretor& di, Standard_Integer argc, c
   return 0;
 }
 
-#include <Extrema_FuncExtPS.hxx>
+#include <Extrema_FuncPSNorm.hxx>
 #include <math_FunctionSetRoot.hxx>
 #include <math_Vector.hxx>
 #include <BRepBuilderAPI_MakeVertex.hxx>
@@ -1441,7 +1376,7 @@ static Standard_Integer OCC24137 (Draw_Interpretor& theDI, Standard_Integer theN
   Standard_Integer anArgIter = 1;
   if (theNArg < 5)
     {
-      theDI <<"Usage: " << theArgv[0] << " face vertex U V [N]"<<"\n";
+      theDI <<"Usage: " << theArgv[0] << " face vertex U V [N]\n";
       return 1;
     }
 
@@ -1469,7 +1404,7 @@ static Standard_Integer OCC24137 (Draw_Interpretor& theDI, Standard_Integer theN
 
   gp_Pnt aPnt = BRep_Tool::Pnt (aVert), aRes;
 
-  Extrema_FuncExtPS    anExtFunc;
+  Extrema_FuncPSNorm    anExtFunc;
   math_FunctionSetRoot aRoot (anExtFunc, aNbIts);
 
   math_Vector aTolUV (1, 2), aUVinf  (1, 2), aUVsup  (1, 2), aFromUV (1, 2);
@@ -1664,7 +1599,7 @@ static Standard_Integer OCC23972 (Draw_Interpretor& di,Standard_Integer n, const
 static Standard_Integer OCC24370 (Draw_Interpretor& di, Standard_Integer argc,const char ** argv)
 {
   if (argc < 5) {
-    di<<"Usage: " << argv[0] << " invalid number of arguments"<<"\n";
+    di<<"Usage: " << argv[0] << " invalid number of arguments\n";
     return 1;
   }
 
@@ -1730,7 +1665,7 @@ static void DoIsNull(Draw_Interpretor& di)
   HT aHandle;
   //    QVERIFY (aHandle.IsNull());
   QCOMPARE (aHandle.IsNull(), Standard_True);
-  const T* p = aHandle.Access();
+  const T* p = aHandle.get();
 #if OCC_VERSION_HEX > 0x060700
   //QVERIFY (!p);
   //QVERIFY (p == 0);
@@ -1741,7 +1676,7 @@ static void DoIsNull(Draw_Interpretor& di)
   aHandle = new T;
   //QVERIFY (!aHandle.IsNull());
   QCOMPARE (!aHandle.IsNull(), Standard_True);
-  p = aHandle.Access();
+  p = aHandle.get();
   //QVERIFY (p);
   //QVERIFY (p != 0);
   QCOMPARE (p != NULL, Standard_True);
@@ -1770,18 +1705,17 @@ public:
     std::cerr << "QABugs_HandleClass[" << this << "] " << theArgVec[0] << "\n";
     return 0;
   }
-  DEFINE_STANDARD_RTTI(QABugs_HandleClass) // Type definition
+  DEFINE_STANDARD_RTTI_INLINE(QABugs_HandleClass,Standard_Transient) // Type definition
 };
 DEFINE_STANDARD_HANDLE    (QABugs_HandleClass, Standard_Transient)
-IMPLEMENT_STANDARD_HANDLE (QABugs_HandleClass, Standard_Transient)
-IMPLEMENT_STANDARD_RTTIEXT(QABugs_HandleClass, Standard_Transient)
+
 
 // Dummy class to test interface for compilation issues
 struct QABugs_NHandleClass
 {
   Standard_Integer NHandleProc (Draw_Interpretor& , Standard_Integer  , const char** theArgVec)
   {
-    std::cerr << "QABugs_NHandleClass[" << this << "] " << "" << theArgVec[0] << "\n";
+    std::cerr << "QABugs_NHandleClass[" << this << "] " << theArgVec[0] << "\n";
     return 0;
   }
 };
@@ -1792,7 +1726,7 @@ struct QABugs_NHandleClass
 static Standard_Integer OCC23951 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
 {
   if (argc != 2) {
-    di << "Usage: " << argv[0] << " invalid number of arguments" << "\n";
+    di << "Usage: " << argv[0] << " invalid number of arguments\n";
     return 1;
   }
   Handle(TDocStd_Document) aDoc = new TDocStd_Document("dummy");;
@@ -1842,6 +1776,7 @@ static Standard_Integer OCC23950 (Draw_Interpretor& di, Standard_Integer argc, c
   TDataStd_Name::Set(labelA0, "ASSEMBLY");
 
   TDF_Label component01 = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main ())->AddComponent (labelA0, lab1, location0);
+  XCAFDoc_DocumentTool::ShapeTool (aDoc->Main ())->UpdateAssemblies();
 
   Quantity_Color yellow(1,1,0, Quantity_TOC_RGB);
   XCAFDoc_DocumentTool::ColorTool (labelA0)->SetColor (component01, yellow, XCAFDoc_ColorGen);
@@ -1851,7 +1786,7 @@ static Standard_Integer OCC23950 (Draw_Interpretor& di, Standard_Integer argc, c
   STEPCAFControl_Writer writer;
   if (! writer.Transfer (aDoc, mode))
   {
-    di << "The document cannot be translated or gives no result" << "\n";
+    di << "The document cannot be translated or gives no result\n";
     return 1;
   }
 
@@ -1859,65 +1794,6 @@ static Standard_Integer OCC23950 (Draw_Interpretor& di, Standard_Integer argc, c
   return 0;
 }
 
-//=======================================================================
-//function : OCC24622
-//purpose  : The command tests sourcing Image_PixMap to AIS_TexturedShape
-//=======================================================================
-static Standard_Integer OCC24622 (Draw_Interpretor& /*theDi*/, Standard_Integer theArgNb, const char** theArgVec)
-{
-  if (theArgNb != 2)
-  {
-    std::cout << "Usage : " << theArgVec[0] << " texture={1D|2D}";
-    return 1;
-  }
-
-  const Handle(AIS_InteractiveContext)& anAISContext = ViewerTest::GetAISContext();
-  if (anAISContext.IsNull())
-  {
-    std::cout << "Please initialize view with \"vinit\".\n";
-    return 1;
-  }
-
-  Handle(Image_PixMap) anImage = new Image_PixMap();
-
-  static const Image_ColorRGB aBitmap[8] =
-  {
-    {{255,   0, 0}}, {{0,  148, 255}}, {{ 0, 148, 255}}, {{255,  94, 0}},
-    {{255, 121, 0}}, {{76, 255,   0}}, {{76, 255,   0}}, {{255, 202, 0}}
-  };
-
-  TCollection_AsciiString aTextureTypeArg (theArgVec[1]);
-  aTextureTypeArg.UpperCase();
-  if (aTextureTypeArg == "1D")
-  {
-    anImage->InitWrapper (Image_PixMap::ImgRGB, (Standard_Byte*)aBitmap, 8, 1);
-  }
-  else if (aTextureTypeArg == "2D")
-  {
-    anImage->InitTrash (Image_PixMap::ImgRGB, 8, 8);
-    for (Standard_Integer aRow = 0; aRow < 8; ++aRow)
-    {
-      for (Standard_Integer aCol = 0; aCol < 8; ++aCol)
-      {
-        anImage->ChangeValue<Image_ColorRGB> (aRow, aCol) = aBitmap[aRow];
-      }
-    }
-  }
-  else
-  {
-    std::cout << "Please specify type of texture to test {1D|2D}.\n";
-    return 1;
-  }
-
-  TopoDS_Shape aBlankShape = BRepPrimAPI_MakeBox (10.0, 10.0, 10.0).Shape();
-
-  Handle(AIS_TexturedShape) aTexturedShape = new AIS_TexturedShape (aBlankShape);
-  aTexturedShape->SetTexturePixMap (anImage);
-  anAISContext->Display (aTexturedShape, 3, 0);
-
-  return 0;
-}
-
 //=======================================================================
 //function : OCC24667
 //purpose  : 
@@ -1926,11 +1802,11 @@ static Standard_Integer OCC24667 (Draw_Interpretor& di, Standard_Integer n, cons
 {
   if (n == 1)
   {
-    di << "OCC24667 result Wire_spine Profile [Mode [Approx]]" << "\n";
-    di << "Mode = 0 - CorrectedFrenet," << "\n";
-    di << "     = 1 - Frenet," << "\n";
-    di << "     = 2 - DiscreteTrihedron" << "\n";
-    di << "Approx - force C1-approximation if result is C0" << "\n";
+    di << "OCC24667 result Wire_spine Profile [Mode [Approx]]\n";
+    di << "Mode = 0 - CorrectedFrenet,\n";
+    di << "     = 1 - Frenet,\n";
+    di << "     = 2 - DiscreteTrihedron\n";
+    di << "Approx - force C1-approximation if result is C0\n";
     return 0;
   }
 
@@ -1976,7 +1852,6 @@ static Standard_Integer OCC24667 (Draw_Interpretor& di, Standard_Integer n, cons
   return 0;
 }
 
-#include <Handle_BRepTools_NurbsConvertModification.hxx>
 #include <BRepPrimAPI_MakeCylinder.hxx>
 #include <BRepBuilderAPI_Copy.hxx>
 #include <BRepTools_NurbsConvertModification.hxx>
@@ -1986,7 +1861,7 @@ static TopoDS_Shape CreateTestShape (int& theShapeNb)
   BRep_Builder aBuilder;
   aBuilder.MakeCompound (aComp);
   //NURBS modifier is used to increase footprint of each shape
-  Handle_BRepTools_NurbsConvertModification aNurbsModif = new BRepTools_NurbsConvertModification;
+  Handle(BRepTools_NurbsConvertModification) aNurbsModif = new BRepTools_NurbsConvertModification;
   TopoDS_Shape aRefShape = BRepPrimAPI_MakeCylinder (50., 100.).Solid();
   BRepTools_Modifier aModifier (aRefShape, aNurbsModif);
   if (aModifier.IsDone()) {
@@ -2005,19 +1880,18 @@ static TopoDS_Shape CreateTestShape (int& theShapeNb)
   return aComp;
 }
 
-#include <AppStd_Application.hxx>
 #include <TDataStd_Integer.hxx>
 #include <TNaming_Builder.hxx>
 static Standard_Integer OCC24931 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
 {
   if (argc != 2) {
-    di << "Usage: " << argv[0] << " invalid number of arguments"<<"\n";
+    di << "Usage: " << argv[0] << " invalid number of arguments\n";
     return 1;
   }
   TCollection_ExtendedString aFileName (argv[1]);
   PCDM_StoreStatus aSStatus  = PCDM_SS_Failure;
 
-  Handle(TDocStd_Application) anApp = new AppStd_Application;
+  Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
   {
     Handle(TDocStd_Document) aDoc;
     anApp->NewDocument ("XmlOcaf", aDoc);
@@ -2035,9 +1909,6 @@ static Standard_Integer OCC24931 (Draw_Interpretor& di, Standard_Integer argc, c
   return 0;
 }
 
-#include <AppStdL_Application.hxx>
-#include <TDocStd_Application.hxx>
-#include <TDataStd_Integer.hxx>
 #include <TDF_AttributeIterator.hxx>
 //=======================================================================
 //function : OCC24755
@@ -2051,19 +1922,26 @@ static Standard_Integer OCC24755 (Draw_Interpretor& di, Standard_Integer n, cons
     return 1;
   }
 
-  Handle(TDocStd_Application) anApp = new AppStdL_Application;
+  Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
   Handle(TDocStd_Document) aDoc;
   anApp->NewDocument ("BinOcaf", aDoc);
   TDF_Label aLab = aDoc->Main();
+  // Prepend an int value.
   TDataStd_Integer::Set (aLab, 0);
+  // Prepend a name.
   TDataStd_Name::Set (aLab, "test");
+  // Append a double value.
+  aLab.AddAttribute(new TDataStd_Real(), true/*append*/);
 
   TDF_AttributeIterator i (aLab);
   Handle(TDF_Attribute) anAttr = i.Value();
+  QCOMPARE (anAttr->IsKind (STANDARD_TYPE (TDataStd_Name)), Standard_True);
+  i.Next();
+  anAttr = i.Value();
   QCOMPARE (anAttr->IsKind (STANDARD_TYPE (TDataStd_Integer)), Standard_True);
   i.Next();
   anAttr = i.Value();
-  QCOMPARE (anAttr->IsKind (STANDARD_TYPE (TDataStd_Name)), Standard_True);
+  QCOMPARE (anAttr->IsKind (STANDARD_TYPE (TDataStd_Real)), Standard_True);
 
   return 0;
 }
@@ -2273,7 +2151,7 @@ static Standard_Integer OCC25004 (Draw_Interpretor& theDI,
                                   Standard_Integer /*theNArg*/,
                                   const char** /*theArgs*/)
 {
-  math_MultipleVarFunction* aFunc = new BraninFunction();
+  BraninFunction aFunc;
 
   math_Vector aLower(1,2), aUpper(1,2);
   aLower(1) = -5;
@@ -2296,7 +2174,7 @@ static Standard_Integer OCC25004 (Draw_Interpretor& theDI,
       aCurrPnt1(1) = aLower(1) + (aUpper(1) - aLower(1)) * (i - 1) / (aGridOrder - 1.0);
       aCurrPnt1(2) = aLower(2) + (aUpper(2) - aLower(2)) * (j - 1) / (aGridOrder - 1.0);
 
-      aFunc->Value(aCurrPnt1, aFuncValues(idx));
+      aFunc.Value(aCurrPnt1, aFuncValues(idx));
       idx++;
     }
   }
@@ -2327,7 +2205,7 @@ static Standard_Integer OCC25004 (Draw_Interpretor& theDI,
         aLipConst = C;
     }
 
-  math_GlobOptMin aFinder(aFunc, aLower, aUpper, aLipConst);
+  math_GlobOptMin aFinder(&aFunc, aLower, aUpper, aLipConst);
   aFinder.Perform();
   //(-pi , 12.275), (pi , 2.275), (9.42478, 2.475)
 
@@ -2357,32 +2235,24 @@ class Test_TDocStd_Application : public TDocStd_Application
 {
 public:
 
-  static void initGlobalPluginMap (const TCollection_AsciiString& thePlugin,
-                                   const TCollection_AsciiString& theSaver,
-                                   const TCollection_AsciiString& theLoader)
-  {
-    const Handle(Resource_Manager)& aManager = Plugin::AdditionalPluginMap();
-    aManager->SetResource ((theSaver  + ".Location").ToCString(), thePlugin.ToCString());
-    aManager->SetResource ((theLoader + ".Location").ToCString(), thePlugin.ToCString());
-  }
-
-  Test_TDocStd_Application (const TCollection_AsciiString& thePlugin,
-                            const TCollection_AsciiString& theSaver,
-                            const TCollection_AsciiString& theLoader)
+  Test_TDocStd_Application ()
   {
-    initGlobalPluginMap (thePlugin, theSaver, theLoader);
-
     // explicitly initialize resource manager
     myResources = new Resource_Manager ("");
     myResources->SetResource ("xml.FileFormat", THE_QATEST_DOC_FORMAT);
     myResources->SetResource (THE_QATEST_DOC_FORMAT ".Description",     "Test XML Document");
     myResources->SetResource (THE_QATEST_DOC_FORMAT ".FileExtension",   "xml");
-    myResources->SetResource (THE_QATEST_DOC_FORMAT ".StoragePlugin",   theSaver.ToCString());
-    myResources->SetResource (THE_QATEST_DOC_FORMAT ".RetrievalPlugin", theLoader.ToCString());
   }
 
-  virtual Standard_CString ResourcesName() { return ""; }
-  virtual void Formats (TColStd_SequenceOfExtendedString& theFormats) { theFormats.Clear(); }
+  virtual Handle(PCDM_Reader) ReaderFromFormat (const TCollection_ExtendedString&) Standard_OVERRIDE
+  {
+    return new XmlDrivers_DocumentRetrievalDriver ();
+  }
+  virtual Handle(PCDM_StorageDriver) WriterFromFormat (const TCollection_ExtendedString&) Standard_OVERRIDE
+  {
+    return new XmlDrivers_DocumentStorageDriver ("Test");
+  }
+  virtual Standard_CString ResourcesName() Standard_OVERRIDE { return ""; }
 };
 
 //=======================================================================
@@ -2416,7 +2286,7 @@ static Standard_Integer OCC24925 (Draw_Interpretor& theDI,
   PCDM_StoreStatus  aSStatus = PCDM_SS_Failure;
   PCDM_ReaderStatus aRStatus = PCDM_RS_OpenError;
 
-  Handle(TDocStd_Application) anApp = new Test_TDocStd_Application (aPlugin, aSaver, aLoader);
+  Handle(TDocStd_Application) anApp = new Test_TDocStd_Application ();
   {
     Handle(TDocStd_Document) aDoc;
     anApp->NewDocument (THE_QATEST_DOC_FORMAT, aDoc);
@@ -2467,8 +2337,8 @@ static Standard_Integer OCC25043 (Draw_Interpretor& theDI,
     for (; anCheckIter.More(); anCheckIter.Next())
     {
       const BOPAlgo_CheckResult& aCurCheckRes = anCheckIter.Value();
-      const BOPCol_ListOfShape& aCurFaultyShapes = aCurCheckRes.GetFaultyShapes1();
-      BOPCol_ListIteratorOfListOfShape aFaultyIter(aCurFaultyShapes);
+      const TopTools_ListOfShape& aCurFaultyShapes = aCurCheckRes.GetFaultyShapes1();
+      TopTools_ListIteratorOfListOfShape aFaultyIter(aCurFaultyShapes);
       for (; aFaultyIter.More(); aFaultyIter.Next())
       {
         const TopoDS_Shape& aFaultyShape = aFaultyIter.Value();
@@ -2488,14 +2358,14 @@ static Standard_Integer OCC25043 (Draw_Interpretor& theDI,
         }
         else 
         {
-          theDI << "Info. Faulty shape if found in source shape\n";
+          theDI << "Info. Faulty shape is found in source shape\n";
         }
       }
     }
   }
   else 
   {
-    theDI << "Error. Problems are not detected. Test is not performed.";
+    theDI << "Problems are not detected. Test is not performed.";
   }
 
   return 0;
@@ -2529,46 +2399,6 @@ static Standard_Integer OCC24606 (Draw_Interpretor& theDI,
   return 0;
 }
 
-//=======================================================================
-//function : OCC23010
-//purpose  :
-//=======================================================================
-#include <STEPCAFControl_Reader.hxx>
-
-class mOcafApplication : public TDocStd_Application
-{
-  void Formats(TColStd_SequenceOfExtendedString& Formats)
-  {
-    Formats.Append(TCollection_ExtendedString("mOcafApplication"));
-  }
-  Standard_CString ResourcesName()
-  {
-    return Standard_CString("Resources");
-  }
-};
-
-static Standard_Integer OCC23010 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 2) {
-    di << "Usage: " << argv[0] << " invalid number of arguments" << "\n";
-    return 1;
-  }
-  std::string fileName=argv[1];
-  mOcafApplication *mCasApp = new mOcafApplication();
-  Handle(TDocStd_Document) doc;
-  mCasApp->NewDocument("BinXCAF", doc);
-  STEPCAFControl_Reader stepReader;
-  IFSelect_ReturnStatus status = stepReader.ReadFile (fileName.c_str());
-  if (status != IFSelect_RetDone)
-    return false;
-  stepReader.SetColorMode(Standard_True);
-  stepReader.SetLayerMode(Standard_True);
-  stepReader.SetNameMode(Standard_True);
-  stepReader.Transfer(doc); // ERROR HERE!!!
-  delete mCasApp;
-  return 0;
-}
-
 //=======================================================================
 //function : OCC25202
 //purpose  :
@@ -2660,7 +2490,7 @@ static Standard_Integer OCC25202 ( Draw_Interpretor& theDI,
 static Standard_Integer OCC7570 (Draw_Interpretor& di, Standard_Integer n, const char** a)
 {
   if (n != 2) {
-    di<<"Usage: "<<a[0]<<" invalid number of arguments"<<"\n";
+    di<<"Usage: "<<a[0]<<" invalid number of arguments\n";
     return 1;
   }
   TopoDS_Shape in_shape (DBRep::Get (a[1]));
@@ -2797,7 +2627,7 @@ static Standard_Integer OCC25100 (Draw_Interpretor& di, Standard_Integer argc, c
   TopoDS_Shape S = DBRep::Get(argv[1]);
   if ( S.IsNull() )
   {
-    di << "Shape is empty" << "\n";
+    di << "Shape is empty\n";
     return 1;
   }
   
@@ -2847,7 +2677,7 @@ static Standard_Integer OCC25348 (Draw_Interpretor& theDI,
 static Standard_Integer OCC25413 (Draw_Interpretor& di, Standard_Integer narg , const char** a)
 {
   if (narg != 2) {
-    di << "Usage: " << a[0] << " invalid number of arguments" << "\n";
+    di << "Usage: " << a[0] << " invalid number of arguments\n";
     return 1;
   }
   TopoDS_Shape aShape = DBRep::Get (a[1]);
@@ -2886,10 +2716,8 @@ static Standard_Integer OCC25413 (Draw_Interpretor& di, Standard_Integer narg ,
 #include <BRepAlgoAPI_Cut.hxx>
 #include <BRepAlgoAPI_Section.hxx>
 //
-#include <BOPTools.hxx>
-//
-#include <BOPCol_MapOfShape.hxx>
-#include <BOPCol_ListOfShape.hxx>
+#include <TopExp.hxx>
+#include <TopTools_MapOfShape.hxx>
 //=======================================================================
 //function : OCC25446
 //purpose  :
@@ -2926,7 +2754,7 @@ static Standard_Integer OCC25446 (Draw_Interpretor& theDI,
   aOp = (BOPAlgo_Operation)iOp;
   //
   Standard_Integer iErr;
-  BOPCol_ListOfShape aLS;
+  TopTools_ListOfShape aLS;
   BOPAlgo_PaveFiller aPF;
   //
   aLS.Append(aS1);
@@ -2934,7 +2762,7 @@ static Standard_Integer OCC25446 (Draw_Interpretor& theDI,
   aPF.SetArguments(aLS);
   //
   aPF.Perform();
-  iErr = aPF.ErrorStatus();
+  iErr = aPF.HasErrors();
   if (iErr) {
     theDI << "Intersection failed with error status: " << iErr << "\n";
     return 1;
@@ -2962,7 +2790,7 @@ static Standard_Integer OCC25446 (Draw_Interpretor& theDI,
     break;
   }
   //
-  iErr = pBuilder->ErrorStatus();
+  iErr = pBuilder->HasErrors();
   if (!pBuilder->IsDone()) {
     theDI << "BOP failed with error status: " << iErr << "\n";
     return 1;
@@ -2971,14 +2799,14 @@ static Standard_Integer OCC25446 (Draw_Interpretor& theDI,
   const TopoDS_Shape& aRes = pBuilder->Shape();
   DBRep::Set(argv[1], aRes);
   //
-  BOPCol_MapOfShape aMapArgs, aMapShape;
-  BOPCol_MapIteratorOfMapOfShape aIt;
+  TopTools_MapOfShape aMapArgs, aMapShape;
+  TopTools_MapIteratorOfMapOfShape aIt;
   Standard_Boolean bIsDeletedHist, bIsDeletedMap;
   TopAbs_ShapeEnum aType;
   //
-  BOPTools::MapShapes(aS1, aMapArgs);
-  BOPTools::MapShapes(aS2, aMapArgs);
-  BOPTools::MapShapes(aRes, aMapShape);
+  TopExp::MapShapes(aS1, aMapArgs);
+  TopExp::MapShapes(aS2, aMapArgs);
+  TopExp::MapShapes(aRes, aMapShape);
   //
   aIt.Initialize(aMapArgs);
   for (; aIt.More(); aIt.Next()) {
@@ -3035,19 +2863,19 @@ struct OCC25545_Functor
 //function : OCC25545
 //purpose  : Tests data race when concurrently accessing TopLoc_Location::Transformation()
 //=======================================================================
-#ifdef HAVE_TBB
+
 static Standard_Integer OCC25545 (Draw_Interpretor& di, 
                                   Standard_Integer, 
                                   const char **)
 {
   // Place vertices in a vector, giving the i-th vertex the
   // transformation that translates it on the vector (i,0,0) from the origin.
-  size_t n = 1000;
+  Standard_Integer n = 1000;
   std::vector<TopoDS_Shape> aShapeVec (n);
   std::vector<TopLoc_Location> aLocVec (n);
   TopoDS_Shape aShape = BRepBuilderAPI_MakeVertex (gp::Origin ());
   aShapeVec[0] = aShape;
-  for (size_t i = 1; i < n; ++i) {
+  for (Standard_Integer i = 1; i < n; ++i) {
     gp_Trsf aT;
     aT.SetTranslation (gp_Vec (1, 0, 0));
     aLocVec[i] = aLocVec[i - 1] * aT;
@@ -3058,20 +2886,12 @@ static Standard_Integer OCC25545 (Draw_Interpretor& di,
   // concurrently
   OCC25545_Functor aFunc(aShapeVec);
 
-  //concurrently process
-  tbb::parallel_for (size_t (0), n, aFunc, tbb::simple_partitioner ());
+  // concurrently process
+  OSD_Parallel::For (0, n, aFunc);
+
   QVERIFY (!aFunc.myIsRaceDetected);
   return 0;
 }
-#else
-static Standard_Integer OCC25545 (Draw_Interpretor&, 
-                                  Standard_Integer, 
-                                  const char **argv)
-{
-  cout << "Test skipped: command " << argv[0] << " requires TBB library" << endl;
-  return 0;
-}
-#endif
 
 //=======================================================================
 //function : OCC25547
@@ -3243,7 +3063,7 @@ static Standard_Integer OCC26139 (Draw_Interpretor& theDI,
 #include <OSD.hxx>
 #include <ShapeFix_Wire.hxx>
 #include <ShapeExtend_Status.hxx>
-#ifdef WNT
+#ifdef _WIN32
 #define EXCEPTION ...
 #else
 #define EXCEPTION Standard_Failure
@@ -3271,7 +3091,7 @@ static ShapeExtend_Status getStatusGap(const Handle(ShapeFix_Wire)&   theFix,
 static Standard_Integer OCC24881 (Draw_Interpretor& di, Standard_Integer narg , const char** a)
 {
   if (narg < 2) {
-    di<<"Usage: "<<a[0]<<" invalid number of arguments"<<"\n";
+    di<<"Usage: "<<a[0]<<" invalid number of arguments\n";
     return 1;
   }
 //    cout <<"FileName1: " << argv[1] <<endl;
@@ -3364,7 +3184,7 @@ static Standard_Integer OCC24881 (Draw_Interpretor& di, Standard_Integer narg ,
        }    
        if (nbOk)
        {
-               di << "Fix_FillGaps_NothingToDo" <<"\n";
+               di << "Fix_FillGaps_NothingToDo\n";
 
        }
        TColStd_DataMapIteratorOfDataMapOfIntegerInteger aStatusItr(aStatusNbDMap);
@@ -3425,14 +3245,16 @@ static Standard_Integer OCC26172 (Draw_Interpretor& theDI, Standard_Integer theA
   BRepBuilderAPI_MakeEdge anEdgeBuilder (aStart, anEnd);
   TopoDS_Edge anEdge = anEdgeBuilder.Edge();
   Handle(AIS_Shape) aTestAISShape = new AIS_Shape (anEdge);
-  anAISContext->Display (aTestAISShape);
+  anAISContext->Display (aTestAISShape, Standard_True);
 
   // 2. activate it in selection modes
   TColStd_SequenceOfInteger aModes;
   aModes.Append (AIS_Shape::SelectionMode ((TopAbs_ShapeEnum) TopAbs_VERTEX));
   aModes.Append (AIS_Shape::SelectionMode ((TopAbs_ShapeEnum) TopAbs_EDGE));
 
+  Standard_DISABLE_DEPRECATION_WARNINGS
   anAISContext->OpenLocalContext();
+  Standard_ENABLE_DEPRECATION_WARNINGS
   anAISContext->Deactivate (aTestAISShape);
   anAISContext->Load (aTestAISShape, -1, true);
   for (Standard_Integer anIt = 1; anIt <= aModes.Length(); ++anIt)
@@ -3442,6 +3264,7 @@ static Standard_Integer OCC26172 (Draw_Interpretor& theDI, Standard_Integer theA
 
   // select entities in vertex selection mode
   Handle(SelectMgr_Selection) aSelection = aTestAISShape->Selection (aModes (1));
+  Standard_DISABLE_DEPRECATION_WARNINGS
   for (aSelection->Init(); aSelection->More(); aSelection->Next())
   {
     Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive()->BaseSensitive();
@@ -3460,9 +3283,11 @@ static Standard_Integer OCC26172 (Draw_Interpretor& theDI, Standard_Integer theA
 
     anAISContext->LocalContext()->AddOrRemoveSelected (anOwner);
   }
+  Standard_ENABLE_DEPRECATION_WARNINGS
 
   // select entities in edge selection mode
   aSelection = aTestAISShape->Selection (aModes (2));
+  Standard_DISABLE_DEPRECATION_WARNINGS
   for (aSelection->Init(); aSelection->More(); aSelection->Next())
   {
     Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive()->BaseSensitive();
@@ -3481,10 +3306,13 @@ static Standard_Integer OCC26172 (Draw_Interpretor& theDI, Standard_Integer theA
 
     anAISContext->LocalContext()->AddOrRemoveSelected (anOwner);
   }
+  Standard_ENABLE_DEPRECATION_WARNINGS
 
   // deactivate vertex mode and check clearing of outdated selection
   anAISContext->Deactivate (aTestAISShape, aModes (1));
+  Standard_DISABLE_DEPRECATION_WARNINGS
   anAISContext->LocalContext()->ClearOutdatedSelection (aTestAISShape, true);
+  Standard_ENABLE_DEPRECATION_WARNINGS
 
   return 0;
 }
@@ -3511,16 +3339,17 @@ static Standard_Integer OCC26284 (Draw_Interpretor& theDI, Standard_Integer theA
 
   BRepPrimAPI_MakeSphere aSphereBuilder (gp_Pnt (0.0, 0.0, 0.0), 1.0);
   Handle(AIS_Shape) aSphere = new AIS_Shape (aSphereBuilder.Shape());
-  anAISContext->Display (aSphere);
+  anAISContext->Display (aSphere, Standard_False);
   for (Standard_Integer aChildIdx = 0; aChildIdx < 5; ++aChildIdx)
   {
     BRepPrimAPI_MakeSphere aBuilder (gp_Pnt (1.0 + aChildIdx, 1.0 + aChildIdx, 1.0 + aChildIdx), 1.0);
     Handle(AIS_Shape) aChild = new AIS_Shape (aBuilder.Shape());
     aSphere->AddChild (aChild);
-    anAISContext->Display (aChild);
+    anAISContext->Display (aChild, Standard_False);
   }
 
   anAISContext->RecomputeSelectionOnly (aSphere);
+  anAISContext->UpdateCurrentViewer();
 
   return 0;
 }
@@ -3581,6 +3410,7 @@ Standard_Integer xprojponf (Draw_Interpretor& di,
 //purpose  :
 //=======================================================================
 #include <BRepMesh_CircleTool.hxx>
+#include <SelectMgr_EntityOwner.hxx>
 
 static Standard_Boolean inspect_point(const gp_XY&        thePoint,
                                       const gp_XY&        theCenter,
@@ -3654,86 +3484,2039 @@ static Standard_Integer OCC24923(
   if (aDeviation > aMaxDeviation)
   {
     theDI << "Failed. Number of incorrect results is too huge: " << 
-      aDeviation * 100 << "% (Max " << aMaxDeviation * 100 << "%)" << "\n";
+      aDeviation * 100 << "% (Max " << aMaxDeviation * 100 << "%)\n";
     return 1;
   }
 
   theDI << "Deviation of incorrect results is: " <<
-    aDeviation * 100 << "% (Max " << aMaxDeviation * 100 << "%)" << "\n";
+    aDeviation * 100 << "% (Max " << aMaxDeviation * 100 << "%)\n";
   theDI << "Test completed\n";
   return 0;
 }
 
-void QABugs::Commands_19(Draw_Interpretor& theCommands) {
-  const char *group = "QABugs";
+//=======================================================================
+//function : OCC25574
+//purpose  : check implementation of Euler angles in gp_Quaternion
+//=======================================================================
 
-  Handle(QABugs_HandleClass) aClassPtr = new QABugs_HandleClass();
-  theCommands.Add ("OCC24202_1", "Test Handle-based procedure",
-                   __FILE__, aClassPtr, &QABugs_HandleClass::HandleProc, group);
-  NCollection_Handle<QABugs_NHandleClass> aNClassPtr = new QABugs_NHandleClass();
-  theCommands.Add ("OCC24202_2", "Test NCollection_Handle-based procedure",
-                   __FILE__, aNClassPtr, &QABugs_NHandleClass::NHandleProc, group);
+static Standard_Integer OCC25574 (Draw_Interpretor& theDI, Standard_Integer /*argc*/, const char** /*argv*/)
+{
+  Standard_Boolean isTestOk = Standard_True;
+
+  // Check consistency of Get and Set operations for Euler angles
+  gp_Quaternion aQuat;
+  aQuat.Set(0.06766916507860499, 0.21848101129786085, 0.11994599260380681,0.9660744746954637);
+  Standard_Real alpha,beta,gamma;
+  gp_Mat aRinv = aQuat.GetMatrix().Inverted();
+  gp_Mat aI;
+  aI.SetIdentity();
+  const char* names[] = { "Extrinsic_XYZ", "Extrinsic_XZY", "Extrinsic_YZX", "Extrinsic_YXZ", "Extrinsic_ZXY", "Extrinsic_ZYX", 
+                          "Intrinsic_XYZ", "Intrinsic_XZY", "Intrinsic_YZX", "Intrinsic_YXZ", "Intrinsic_ZXY", "Intrinsic_ZYX", 
+                          "Extrinsic_XYX", "Extrinsic_XZX", "Extrinsic_YZY", "Extrinsic_YXY", "Extrinsic_ZYZ", "Extrinsic_ZXZ",
+                          "Intrinsic_XYX", "Intrinsic_XZX", "Intrinsic_YZY", "Intrinsic_YXY", "Intrinsic_ZXZ", "Intrinsic_ZYZ" };
+  for (int i = gp_Extrinsic_XYZ; i <= gp_Intrinsic_ZYZ; i++)
+  {
+    aQuat.GetEulerAngles (gp_EulerSequence(i), alpha, beta, gamma);
 
-  theCommands.Add ("OCC230", "OCC230 TrimmedCurve Pnt2d Pnt2d", __FILE__, OCC230, group);
-  theCommands.Add ("OCC23361", "OCC23361", __FILE__, OCC23361, group);
-  theCommands.Add ("OCC23237", "OCC23237", __FILE__, OCC23237, group); 
-  theCommands.Add ("OCC22980", "OCC22980", __FILE__, OCC22980, group);
-  theCommands.Add ("OCC23595", "OCC23595", __FILE__, OCC23595, group);
-  theCommands.Add ("OCC22611", "OCC22611 string nb", __FILE__, OCC22611, group);
-  theCommands.Add ("OCC22595", "OCC22595", __FILE__, OCC22595, group);
-  theCommands.Add ("OCC23774", "OCC23774 shape1 shape2", __FILE__, OCC23774, group);
-  theCommands.Add ("OCC23683", "OCC23683 shape", __FILE__, OCC23683, group);
-  theCommands.Add ("OCC23952sweep", "OCC23952sweep nbupoles shape", __FILE__, OCC23952sweep, group);
-  theCommands.Add ("OCC23952intersect", "OCC23952intersect nbsol shape1 shape2", __FILE__, OCC23952intersect, group);
-  theCommands.Add ("test_offset", "test_offset", __FILE__, test_offset, group);
-  theCommands.Add ("OCC23945", "OCC23945 surfname U V X Y Z [DUX DUY DUZ DVX DVY DVZ [D2UX D2UY D2UZ D2VX D2VY D2VZ D2UVX D2UVY D2UVZ]]", __FILE__, OCC23945,group);
-  theCommands.Add ("OCC24008", "OCC24008 curve surface", __FILE__, OCC24008, group);
-  theCommands.Add ("OCC24019", "OCC24019 aShape", __FILE__, OCC24019, group);
-  theCommands.Add ("OCC11758", "OCC11758", __FILE__, OCC11758, group);
-  theCommands.Add ("OCC24005", "OCC24005 result", __FILE__, OCC24005, group);
-  theCommands.Add ("OCC24137", "OCC24137 face vertex U V [N]", __FILE__, OCC24137, group);
-  theCommands.Add ("OCC24271", "Boolean operations on NCollection_Map", __FILE__, OCC24271, group);
-  theCommands.Add ("OCC23972", "OCC23972", __FILE__, OCC23972, group);
-  theCommands.Add ("OCC24370", "OCC24370 edge pcurve surface prec", __FILE__, OCC24370, group);
-  theCommands.Add ("OCC24533", "OCC24533", __FILE__, OCC24533, group);
-  theCommands.Add ("OCC24012", "OCC24012 face edge", __FILE__, OCC24012, group);
-  theCommands.Add ("OCC24051", "OCC24051", __FILE__, OCC24051, group);
-  theCommands.Add ("OCC24086", "OCC24086 face wire", __FILE__, OCC24086, group);
-  theCommands.Add ("OCC24622", "OCC24622 texture={1D|2D}\n Tests sourcing of 1D/2D pixmaps for AIS_TexturedShape", __FILE__, OCC24622, group);
-  theCommands.Add ("OCC24667", "OCC24667 result Wire_spine Profile [Mode [Approx]], no args to get help", __FILE__, OCC24667, group);
-  theCommands.Add ("OCC24755", "OCC24755", __FILE__, OCC24755, group);
-  theCommands.Add ("OCC24834", "OCC24834", __FILE__, OCC24834, group);
-  theCommands.Add ("OCC24889", "OCC24889", __FILE__, OCC24889, group);
-  theCommands.Add ("OCC23951", "OCC23951 path to saved step file", __FILE__, OCC23951, group);
-  theCommands.Add ("OCC24931", "OCC24931 path to saved xml file", __FILE__, OCC24931, group);
-  theCommands.Add ("OCC24945", "OCC24945", __FILE__, OCC24945, group);
-  theCommands.Add ("OCC23950", "OCC23950 step_file", __FILE__, OCC23950, group);
-  theCommands.Add ("OCC25004", "OCC25004", __FILE__, OCC25004, group);
-  theCommands.Add ("OCC24925",
-                   "OCC24925 filename [pluginLib=TKXml storageGuid retrievalGuid]"
-                   "\nOCAF persistence without setting environment variables",
-                   __FILE__, OCC24925, group);
-  theCommands.Add ("OCC23010", "OCC23010 STEP_file", __FILE__, OCC23010, group);
-  theCommands.Add ("OCC25043", "OCC25043 shape", __FILE__, OCC25043, group);
-  theCommands.Add ("OCC24826,", "This test performs simple saxpy test.\n Usage: OCC24826 length", __FILE__, OCC24826, group);
-  theCommands.Add ("OCC24606", "OCC24606 : Tests ::FitAll for V3d view ('vfit' is for NIS view)", __FILE__, OCC24606, group);
-  theCommands.Add ("OCC25202", "OCC25202 res shape numF1 face1 numF2 face2", __FILE__, OCC25202, group);
-  theCommands.Add ("OCC7570", "OCC7570 shape", __FILE__, OCC7570, group);
-  theCommands.Add ("OCC25100", "OCC25100 shape", __FILE__, OCC25100, group);
-  theCommands.Add ("OCC25340", "OCC25340", __FILE__, OCC25340, group);
-  theCommands.Add ("OCC25348", "OCC25348", __FILE__, OCC25348, group);
-  theCommands.Add ("OCC25413", "OCC25413 shape", __FILE__, OCC25413, group);
-  theCommands.Add ("OCC25446", "OCC25446 res b1 b2 op", __FILE__, OCC25446, group);
-  theCommands.Add ("OCC25545", 
-                   "no args; tests data race when concurrently accessing \n"
-                   "\t\tTopLoc_Location::Transformation()",
-                   __FILE__, OCC25545, group);
-  theCommands.Add ("OCC25547", "OCC25547", __FILE__, OCC25547, group);
-  theCommands.Add ("OCC24881", "OCC24881 shape", __FILE__, OCC24881, group);
-  theCommands.Add ("OCC26172", "OCC26172", __FILE__, OCC26172, group);
-  theCommands.Add ("xprojponf", "xprojponf p f", __FILE__, xprojponf, group);
-  theCommands.Add ("OCC24923", "OCC24923", __FILE__, OCC24923, group);
-  theCommands.Add ("OCC26139", "OCC26139 [-boxsize value] [-boxgrid value] [-compgrid value]", __FILE__, OCC26139, group);
-  theCommands.Add ("OCC26284", "OCC26284", __FILE__, OCC26284, group);
+    gp_Quaternion aQuat2;
+    aQuat2.SetEulerAngles (gp_EulerSequence(i), alpha, beta, gamma);
+
+    gp_Mat aR = aQuat2.GetMatrix();
+    gp_Mat aDiff = aR * aRinv - aI;
+    if (aDiff.Determinant() > 1e-5)
+    {
+      theDI << "Error: Euler angles conversion incorrect for sequence " << names[i - gp_Extrinsic_XYZ] << "\n";
+      isTestOk = Standard_False;
+    }
+  }
+
+  // Check conversion between intrinsic and extrinsic rotations
+  // Any extrinsic rotation is equivalent to an intrinsic rotation
+  // by the same angles but with inverted order of elemental rotations, and vice versa
+  // For instance:
+  //    Extrinsic_XZY = Incrinsic_XZY
+  //    R = X(A)Z(B)Y(G) --> R = Y(G)Z(B)X(A)
+  alpha = 0.1517461713131;
+  beta = 1.5162198410141;
+  gamma = 1.9313156236541;
+  Standard_Real alpha2, beta2, gamma2;
+  gp_EulerSequence pairs[][2] = { {gp_Extrinsic_XYZ, gp_Intrinsic_ZYX},
+                                  {gp_Extrinsic_XZY, gp_Intrinsic_YZX},
+                                  {gp_Extrinsic_YZX, gp_Intrinsic_XZY},
+                                  {gp_Extrinsic_YXZ, gp_Intrinsic_ZXY},
+                                  {gp_Extrinsic_ZXY, gp_Intrinsic_YXZ},
+                                  {gp_Extrinsic_ZYX, gp_Intrinsic_XYZ} };
+  for (int i = 0; i < 6; i++)
+  {
+    aQuat.SetEulerAngles(pairs[i][0],  alpha,  beta,  gamma);
+    aQuat.GetEulerAngles(pairs[i][1], gamma2, beta2, alpha2);
+
+    if (Abs(alpha - alpha2) > 1e-5 || Abs(beta - beta2) > 1e-5 || Abs(gamma - gamma2) > 1e-5)
+    {
+      theDI << "Error: intrinsic and extrinsic conversion incorrect for sequence " << names[i] << "\n";
+      isTestOk = Standard_False;
+    }
+  }
+
+  // Check correspondence of enumeration and actual rotation it defines, 
+  // by rotation by one axis and checking that it does not change a point on that axis
+  for (int i = gp_Extrinsic_XYZ; i <= gp_Intrinsic_ZYZ; i++)
+  {
+    // Iterate over rotations R(A)R(B)R(G) for each Euler angle Alpha, Beta, Gamma
+    // There are three ordered axes corresponding to three rotations.
+    // Each rotation applyed with current angle around current axis.
+    for (int j=0; j < 3; j++)
+    {
+      // note that current axis index is obtained by parsing of enumeration name!
+      int anAxis = names[i - gp_Extrinsic_XYZ][10 + j] - 'X';
+      Standard_ASSERT_RETURN (anAxis >=0 && anAxis <= 2, "Incorrect parsing of enumeration name", 1);
+
+      // Set 90 degrees to current Euler angle
+      double anAngles[3] = {0., 0., 0.};
+      anAngles[j] = 0.5 * M_PI;
+
+      gp_Quaternion q2;
+      q2.SetEulerAngles (gp_EulerSequence(i), anAngles[0], anAngles[1], anAngles[2]);
+
+      // Set point on axis corresponding to current rotation
+      // We will apply rotation around this axis
+      gp_XYZ v (0., 0., 0.);
+      v.SetCoord (anAxis + 1, 1.);
+
+      // Apply rotation to point
+      gp_Trsf aT;
+      aT.SetRotation (q2);
+      gp_XYZ v2 = v;
+      aT.Transforms (v2);
+
+      // Check that point is still on origin position
+      if ((v - v2).SquareModulus() > Precision::SquareConfusion())
+      {
+        // avoid reporting small coordinates
+        for (int k=1; k <= 3; k++) 
+          if (Abs (v2.Coord(k)) < Precision::Confusion())
+            v2.SetCoord (k, 0.);
+
+        isTestOk = Standard_False;
+        theDI << "Error: Euler sequence " << names[i - gp_Extrinsic_XYZ] << " is incorrect:\n";
+        theDI << "rotating by angle 90 deg around " << (anAxis == 0 ? "X" : anAxis == 1 ? "Y" : "Z") <<
+                      " converts vector (" << v.X() << ", " << v.Y() << ", " << v.Z() << ") to ("
+                        << v2.X() << ", " << v2.Y() << ", " << v2.Z() << ")\n";
+      }
+    }
+  }
+
+  // Check correspondence of enumeration and actual rotation it defines, 
+  // by comparing cumulative rotation matrix with sequence of rotations by axes
+  const Standard_Real anAngle[3] = { 0.1, 0.2, 0.3 };
+  for (int i = gp_Extrinsic_XYZ; i <= gp_Intrinsic_ZYZ; i++)
+  {
+    // Sequence of rotations
+    gp_Mat aR[3];
+    for (int j=0; j < 3; j++)
+    {
+      // note that current axis index is obtained by parsing of enumeration name!
+      int anAxis = names[i - gp_Extrinsic_XYZ][10 + j] - 'X';
+      Standard_ASSERT_RETURN (anAxis >=0 && anAxis <= 2, "Incorrect parsing of enumeration name", 1);
+
+      // Set point on axis corresponding to current rotation
+      // We will apply rotation around this axis
+      gp_XYZ v (0., 0., 0.);
+      v.SetCoord (anAxis + 1, 1.);
+      aR[j].SetRotation (v, anAngle[j]);
+    }
+
+    // construct cumulative transformation (differently for extrinsic and intrinsic rotations);
+    // note that we parse first symbol of the enum name to identify its type
+    gp_Mat aRot;
+    if (names[i - gp_Extrinsic_XYZ][0] == 'E') // extrinsic
+    {
+      aRot = aR[2] * aR[1] * aR[0];
+    }
+    else // intrinsic
+    {
+      aRot = aR[0] * aR[1] * aR[2];
+    }
+
+    // set the same angles in quaternion
+    aQuat.SetEulerAngles (gp_EulerSequence(i), anAngle[0], anAngle[1], anAngle[2]);
+
+    gp_Mat aRQ = aQuat.GetMatrix();
+    gp_Mat aDiff = aRQ * aRot.Inverted() - aI;
+    if (aDiff.Determinant() > 1e-5)
+    {
+      theDI << "Error: Euler angles conversion does not correspond to sequential rotations for " << names[i - gp_Extrinsic_XYZ] << "\n";
+      isTestOk = Standard_False;
+    }
+  }
+
+  // similar checkfor YawPitchRoll sequence as defined in description of #25574
+  {
+    // Start with world coordinate system
+    gp_Ax2 world;
+
+    // Perform three rotations using the yaw-pitch-roll convention.
+    // This means: rotate around the original z axis with angle alpha,
+    // then rotate around the new y axis with angle beta,
+    // then rotate around the new x axis with angle gamma.
+    alpha = 0.0 / 180.0 * M_PI;
+    beta = -35.0 / 180.0 * M_PI;
+    gamma = 90.0 / 180.0 * M_PI;
+
+    const gp_Quaternion rotationZ(world.Direction(), alpha);
+    const gp_Vec rotY = rotationZ.Multiply(world.YDirection());
+    const gp_Vec rotX = rotationZ.Multiply(world.XDirection());
+
+    const gp_Quaternion rotationY(rotY, beta);
+    const gp_Vec rotZ = rotationY.Multiply(world.Direction());
+    const gp_Vec rotRotX = rotationY.Multiply(rotX);
+
+    const gp_Quaternion rotationX(rotRotX, gamma);
+    const gp_Vec rotRotZ = rotationX.Multiply(rotZ);
+
+    gp_Ax2 result(gp_Pnt(0.0, 0.0, 0.0), rotRotZ, rotRotX);
+
+    // Now compute the Euler angles
+    gp_Trsf transformation;
+    transformation.SetDisplacement(gp_Ax2(), result);
+
+    Standard_Real computedAlpha;
+    Standard_Real computedBeta;
+    Standard_Real computedGamma;
+
+    transformation.GetRotation().GetEulerAngles(gp_YawPitchRoll, computedAlpha, computedBeta, computedGamma);
+
+    // We expect now to get the same angles as we have used for our rotations
+    if (Abs(alpha - computedAlpha) > 1e-5 || Abs(beta - computedBeta) > 1e-5 || Abs(gamma - computedGamma) > 1e-5)
+    {
+      theDI << "Error: unexpected values of Euler angles for YawPitchRoll sequence:\n";
+      theDI << "alpha: " << alpha / M_PI * 180.0 << " and computed alpha: "
+            << computedAlpha / M_PI * 180.0 << "\n";
+      theDI << "beta: " << beta / M_PI * 180.0 << " and computed beta: "
+            << computedBeta / M_PI * 180.0 << "\n";
+      theDI << "gamma: " << gamma / M_PI * 180.0 << " and computed gamma: "
+            << computedGamma / M_PI * 180.0 << "\n";
+      isTestOk = Standard_False;
+    }
+  }
+
+  // test from #25946
+  {
+    gp_Quaternion q;
+    q.Set(0.06766916507860499, 0.21848101129786085, 0.11994599260380681,0.9660744746954637);
+
+    q.GetEulerAngles(gp_Intrinsic_ZYX, alpha,beta, gamma);
+    q.GetEulerAngles(gp_Extrinsic_XYZ, alpha2,beta2,gamma2);
+
+    // gp_Intrinsic_ZYX and gp_Extrinsic_XYZ should produce the same values of angles but in opposite order
+    if (Abs(alpha - gamma2) > 1e-5 || Abs(beta - beta2) > 1e-5 || Abs(gamma - alpha2) > 1e-5)
+    {
+      theDI << "Error: Euler angles computed for gp_Intrinsic_ZYX and gp_Extrinsic_XYZ do not match:\n";
+      theDI << "alpha: " << alpha / M_PI * 180.0 << " and " << alpha2 / M_PI * 180.0 << "\n";
+      theDI << "beta: " << beta / M_PI * 180.0 << " and " << beta2 / M_PI * 180.0 << "\n";
+      theDI << "gamma: " << gamma / M_PI * 180.0 << " and " << gamma2 / M_PI * 180.0 << "\n";
+      isTestOk = Standard_False;
+    }
+  }
+
+  theDI << (isTestOk ? "Test completed" : "Test failed") << "\n";
+  return 0;
+}
+
+#include <TColGeom_Array1OfBSplineCurve.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <TColGeom_HArray1OfBSplineCurve.hxx>
+#include <GeomConvert.hxx>
+
+//=======================================================================
+//function : OCC26446
+//purpose  : 
+//=======================================================================
+Standard_Integer OCC26446 (Draw_Interpretor& di, 
+                           Standard_Integer n, 
+                           const char** a)
+{
+  if (n != 4) {
+    di << "Usage: OCC26446 r c1 c2\n";
+    return 1;
+  }
+
+  Handle(Geom_BSplineCurve) aCurve1 =
+    Handle(Geom_BSplineCurve)::DownCast(DrawTrSurf::GetCurve(a[2]));
+  Handle(Geom_BSplineCurve) aCurve2 = 
+    Handle(Geom_BSplineCurve)::DownCast(DrawTrSurf::GetCurve(a[3]));
+
+  if (aCurve1.IsNull()) {
+    di << a[2] << " is not a BSpline curve\n";
+       return 1;
+  }
+
+  if (aCurve2.IsNull()) {
+    di << a[3] << " is not a BSpline curve\n";
+       return 1;
+  }
+
+  TColGeom_Array1OfBSplineCurve          aCurves     (0, 1);
+  TColStd_Array1OfReal                   aTolerances (0, 0);
+  Standard_Real                          aTolConf    = 1.e-3;
+  Standard_Real                          aTolClosure = Precision::Confusion();
+  Handle(TColGeom_HArray1OfBSplineCurve) aConcatCurves;
+  Handle(TColStd_HArray1OfInteger)       anIndices;
+
+  aCurves.SetValue(0, aCurve1);
+  aCurves.SetValue(1, aCurve2);
+  aTolerances.SetValue(0, aTolConf);
+
+  GeomConvert::ConcatC1(aCurves,
+                        aTolerances,
+                        anIndices,
+                        aConcatCurves,
+                        Standard_False,
+                        aTolClosure);
+
+  Handle(Geom_BSplineCurve) aResult =
+    aConcatCurves->Value(aConcatCurves->Lower());
+
+  DrawTrSurf::Set(a[1], aResult);
+  return 0;
+}
+
+static Standard_Integer OCC26448 (Draw_Interpretor& theDI, Standard_Integer, const char **)
+{
+  TColStd_SequenceOfReal aSeq1, aSeq2;
+  aSeq1.Append(11.);
+  aSeq1.Prepend (aSeq2);
+  theDI << "TCollection: 11 -> " << aSeq1.First() << "\n";
+
+  NCollection_Sequence<Standard_Real> nSeq1, nSeq2;
+  nSeq1.Append(11.);
+  nSeq1.Prepend (nSeq2);
+  theDI << "NCollection: 11 -> " << nSeq1.First() << "\n";
+
+  theDI << "OK";
+  return 0;
+}
+
+//=======================================================================
+//function : OCC26407
+//purpose  :
+//=======================================================================
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepMesh_IncrementalMesh.hxx>
+#include <TCollection_AsciiString.hxx>
+static Standard_Integer OCC26407 (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
+{
+  if (theArgNb != 2)
+  {
+    std::cerr << "Error: wrong number of arguments! See usage:\n";
+    theDI.PrintHelp (theArgVec[0]);
+    return 1;
+  }
+
+  // Construct vertices.
+  std::vector<TopoDS_Vertex> wire_vertices;
+  wire_vertices.push_back(BRepBuilderAPI_MakeVertex(gp_Pnt(587.90000000000009094947, 40.6758179230516248026106, 88.5)));
+  wire_vertices.push_back(BRepBuilderAPI_MakeVertex(gp_Pnt(807.824182076948432040808, 260.599999999999965893949, 88.5)));
+  wire_vertices.push_back(BRepBuilderAPI_MakeVertex(gp_Pnt(644.174182076948454778176, 424.249999999999943156581, 88.5000000000000142108547)));
+  wire_vertices.push_back(BRepBuilderAPI_MakeVertex(gp_Pnt(629.978025792618950617907, 424.25, 88.5)));
+  wire_vertices.push_back(BRepBuilderAPI_MakeVertex(gp_Pnt(793.628025792618700506864, 260.599999999999852207111, 88.5)));
+  wire_vertices.push_back(BRepBuilderAPI_MakeVertex(gp_Pnt(587.900000000000204636308, 54.8719742073813492311274, 88.5)));
+  wire_vertices.push_back(BRepBuilderAPI_MakeVertex(gp_Pnt(218.521974207381418864315, 424.250000000000056843419, 88.5)));
+  wire_vertices.push_back(BRepBuilderAPI_MakeVertex(gp_Pnt(204.325817923051886282337, 424.249999999999943156581, 88.5)));
+
+  // Construct wire.
+  BRepBuilderAPI_MakeWire wire_builder;
+  for (size_t i = 0; i < wire_vertices.size(); i++)
+  {
+    const TopoDS_Vertex &v = wire_vertices[i];
+    const TopoDS_Vertex &w = wire_vertices[(i+1) % wire_vertices.size()];
+
+    wire_builder.Add(BRepBuilderAPI_MakeEdge(v, w));
+  }
+
+  // Create face and triangulate it.
+  // Construct face.
+  gp_Pnt v0 = BRep_Tool::Pnt(wire_vertices[0]);
+  gp_Pnt v1 = BRep_Tool::Pnt(wire_vertices[1]);
+  gp_Pnt v2 = BRep_Tool::Pnt(wire_vertices[wire_vertices.size() - 1]);
+
+  gp_Vec face_normal = gp_Vec(v0, v1).Crossed(gp_Vec(v0, v2));
+
+  TopoDS_Face face = BRepBuilderAPI_MakeFace(gp_Pln(v0, face_normal), wire_builder);
+  BRepMesh_IncrementalMesh m(face, 1e-7);
+
+  if (m.GetStatusFlags() != 0)
+  {
+    theDI << "Failed. Status for face constructed from vertices: " << m.GetStatusFlags() << "\n";
+    return 1;
+  }
+  DBRep::Set(theArgVec[1], face);
+  char buf[256];
+  sprintf(buf, "isos %s 0", theArgVec[1]);
+  theDI.Eval(buf);
+
+  sprintf(buf, "triangles %s", theArgVec[1]);
+  theDI.Eval(buf);
+
+  theDI.Eval("smallview; fit");
+
+  theDI << "Test completed\n";
+  return 0;
+}
+
+//=======================================================================
+//function : OCC26485
+//purpose  :
+//=======================================================================
+#include <Poly.hxx>
+static Standard_Integer OCC26485 (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
+{
+  if (theArgNb != 2)
+  {
+    std::cerr << "Error: wrong number of arguments! See usage:\n";
+    theDI.PrintHelp (theArgVec[0]);
+    return 1;
+  }
+
+  TopoDS_Shape aShape = DBRep::Get(theArgVec[1]);
+  if (aShape.IsNull())
+  {
+    theDI << "Failed. Null shape\n";
+    return 1;
+  }
+
+  Standard_Boolean isFailed = Standard_False;
+  TopExp_Explorer aExplorer(aShape, TopAbs_FACE);
+  for (; aExplorer.More(); aExplorer.Next())
+  {
+    const TopoDS_Face& aFace = TopoDS::Face( aExplorer.Current() );
+    TopLoc_Location L = TopLoc_Location();
+    const Handle(Poly_Triangulation)& aT = BRep_Tool::Triangulation( aFace , L );
+
+    if(aT.IsNull())
+      continue;
+
+    Poly::ComputeNormals(aT);
+    const TColgp_Array1OfPnt&       aVertices = aT->Nodes();
+    const TShort_Array1OfShortReal& aNormals  = aT->Normals();
+
+    // Number of nodes in the triangulation
+    int aVertexNb = aT->Nodes().Length();
+    if (aVertexNb*3 != aNormals.Length())
+    {
+      theDI << "Failed. Different number of normals vs. vertices\n";
+      return 1;
+    }
+
+    // Get each vertex index, checking common vertexes between shapes
+    for( int i=0; i < aVertexNb; i++ )
+    {
+      gp_Pnt aPoint = aVertices.Value( i+1 );
+      gp_Vec aNormal = gp_Vec(
+        aNormals.Value( i*3 + 1 ),
+        aNormals.Value( i*3 + 2 ),
+        aNormals.Value( i*3 + 3 ) );
+
+      if (aNormal.X() == 0 && aNormal.Y() == 0 && aNormal.Z() == 1)
+      {
+        char buf[256];
+        sprintf(buf, "fail_%d", i+1);
+        theDI << "Failed. Point " << buf << ": "
+              << aPoint.X() << " "
+              << aPoint.Y() << " "
+              << aPoint.Z() << "\n";
+
+        DrawTrSurf::Set (buf, aPoint);
+      }
+    }
+  }
+
+  theDI << (isFailed ? "Test failed" : "Test completed") << "\n";
+  return 0;
+}
+
+//=======================================================================
+//function : OCC26553
+//purpose  :
+//=======================================================================
+#include <BRepBuilderAPI_MakeWire.hxx>
+
+static Standard_Integer OCC26553 (Draw_Interpretor& theDI, Standard_Integer theArgc, const char** theArgv)
+{
+  if (theArgc < 2)
+  {
+    theDI << "Error: path to file with shell is missing\n";
+    return 1;
+  }
+
+  BRep_Builder aBuilder;
+  TopoDS_Shape aShell;
+  BRepTools::Read(aShell, theArgv[1], aBuilder);
+
+  if (aShell.IsNull())
+  {
+    theDI << "Error: shell not loaded\n";
+    return 1;
+  }
+
+  TopoDS_Edge aPipeEdge = BRepBuilderAPI_MakeEdge (gp_Pnt (0, 0, 0), gp_Pnt (0, 0, 10));
+  TopoDS_Wire aPipeWire = BRepBuilderAPI_MakeWire(aPipeEdge).Wire();
+
+  BRepOffsetAPI_MakePipe aPipeBuilder(aPipeWire, aShell);
+  if (!aPipeBuilder.IsDone())
+  {
+    theDI << "Error: failed to create pipe\n";
+    return 1;
+  }
+
+  for (TopExp_Explorer aShapeExplorer(aShell, TopAbs_EDGE); aShapeExplorer.More(); aShapeExplorer.Next ()) {
+    const TopoDS_Shape& aGeneratedShape = aPipeBuilder.Generated(aPipeEdge, aShapeExplorer.Current());
+    if (aGeneratedShape.IsNull())
+    {
+      theDI << "Error: null shape\n";
+      return 1;
+    }
+  }
+
+  theDI << "History returned successfully\n";
+  return 0;
+}
+
+//=======================================================================
+//function : OCC26195
+//purpose  :
+//=======================================================================
+#include <SelectMgr_SelectingVolumeManager.hxx>
+#include <BRepBuilderAPI_MakePolygon.hxx>
+#include <Geom_CartesianPoint.hxx>
+#include <AIS_Line.hxx>
+#include <Aspect_Window.hxx>
+static Standard_Integer OCC26195 (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
+{
+  if (theArgNb < 3)
+  {
+    std::cerr << "Error: wrong number of arguments! See usage:\n";
+    theDI.PrintHelp (theArgVec[0]);
+    return 1;
+  }
+
+  if (ViewerTest::GetAISContext().IsNull())
+  {
+    std::cerr << "Error: No opened context!\n";
+    return 1;
+  }
+
+  gp_Pnt2d aPxPnt1, aPxPnt2;
+  aPxPnt1.SetX (Draw::Atof (theArgVec[1]));
+  aPxPnt1.SetY (Draw::Atof (theArgVec[2]));
+  if (theArgNb > 4)
+  {
+    aPxPnt2.SetX (Draw::Atof (theArgVec[3]));
+    aPxPnt2.SetY (Draw::Atof (theArgVec[4]));
+  }
+  Standard_Boolean toPrint = Standard_False;
+  if (theArgNb % 2 == 0)
+  {
+    toPrint = Draw::Atoi (theArgVec[theArgNb - 1]) != 0;
+  }
+
+  SelectMgr_SelectingVolumeManager* aMgr = new SelectMgr_SelectingVolumeManager();
+  aMgr->SetActiveSelectionType (theArgNb > 4 ?
+    SelectMgr_SelectingVolumeManager::Box : SelectMgr_SelectingVolumeManager::Point);
+  aMgr->SetCamera (ViewerTest::CurrentView()->Camera());
+  aMgr->SetPixelTolerance (ViewerTest::GetAISContext()->PixelTolerance());
+  Standard_Integer aWidth, aHeight;
+  ViewerTest::CurrentView()->View()->Window()->Size (aWidth, aHeight);
+  aMgr->SetWindowSize (aWidth, aHeight);
+  if (theArgNb > 4)
+  {
+    aMgr->BuildSelectingVolume (aPxPnt1, aPxPnt2);
+  }
+  else
+  {
+    aMgr->BuildSelectingVolume (aPxPnt1);
+  }
+  const gp_Pnt* aVerts = aMgr->GetVertices();
+  gp_Pnt aNearPnt = aMgr->GetNearPickedPnt();
+  gp_Pnt aFarPnt  = aMgr->GetFarPickedPnt();
+  BRepBuilderAPI_MakePolygon aWireBldrs[4];
+
+  aWireBldrs[0].Add (gp_Pnt (aVerts[0].X(), aVerts[0].Y(), aVerts[0].Z()));
+  aWireBldrs[0].Add (gp_Pnt (aVerts[4].X(), aVerts[4].Y(), aVerts[4].Z()));
+  aWireBldrs[0].Add (gp_Pnt (aVerts[6].X(), aVerts[6].Y(), aVerts[6].Z()));
+  aWireBldrs[0].Add (gp_Pnt (aVerts[2].X(), aVerts[2].Y(), aVerts[2].Z()));
+  aWireBldrs[0].Add (gp_Pnt (aVerts[0].X(), aVerts[0].Y(), aVerts[0].Z()));
+
+  aWireBldrs[1].Add (gp_Pnt (aVerts[4].X(), aVerts[4].Y(), aVerts[4].Z()));
+  aWireBldrs[1].Add (gp_Pnt (aVerts[5].X(), aVerts[5].Y(), aVerts[5].Z()));
+  aWireBldrs[1].Add (gp_Pnt (aVerts[7].X(), aVerts[7].Y(), aVerts[7].Z()));
+  aWireBldrs[1].Add (gp_Pnt (aVerts[6].X(), aVerts[6].Y(), aVerts[6].Z()));
+  aWireBldrs[1].Add (gp_Pnt (aVerts[4].X(), aVerts[4].Y(), aVerts[4].Z()));
+
+  aWireBldrs[2].Add (gp_Pnt (aVerts[1].X(), aVerts[1].Y(), aVerts[1].Z()));
+  aWireBldrs[2].Add (gp_Pnt (aVerts[5].X(), aVerts[5].Y(), aVerts[5].Z()));
+  aWireBldrs[2].Add (gp_Pnt (aVerts[7].X(), aVerts[7].Y(), aVerts[7].Z()));
+  aWireBldrs[2].Add (gp_Pnt (aVerts[3].X(), aVerts[3].Y(), aVerts[3].Z()));
+  aWireBldrs[2].Add (gp_Pnt (aVerts[1].X(), aVerts[1].Y(), aVerts[1].Z()));
+
+  aWireBldrs[3].Add (gp_Pnt (aVerts[0].X(), aVerts[0].Y(), aVerts[0].Z()));
+  aWireBldrs[3].Add (gp_Pnt (aVerts[1].X(), aVerts[1].Y(), aVerts[1].Z()));
+  aWireBldrs[3].Add (gp_Pnt (aVerts[3].X(), aVerts[3].Y(), aVerts[3].Z()));
+  aWireBldrs[3].Add (gp_Pnt (aVerts[2].X(), aVerts[2].Y(), aVerts[2].Z()));
+  aWireBldrs[3].Add (gp_Pnt (aVerts[0].X(), aVerts[0].Y(), aVerts[0].Z()));
+
+  TopoDS_Compound aComp;
+  BRep_Builder    aCompBuilder;
+  aCompBuilder.MakeCompound (aComp);
+  for (Standard_Integer aWireIdx = 0; aWireIdx < 4; ++aWireIdx)
+  {
+    aCompBuilder.Add (aComp, aWireBldrs[aWireIdx].Shape());
+  }
+  DBRep::Set ("c", aComp);
+
+  Handle(AIS_InteractiveObject) aCmp = new AIS_Shape (aComp);
+  aCmp->SetColor (Quantity_NOC_GREEN);
+  ViewerTest::Display ("c", aCmp, Standard_True, Standard_True);
+
+  Handle(Geom_CartesianPoint) aPnt1 = new Geom_CartesianPoint (aNearPnt);
+  Handle(Geom_CartesianPoint) aPnt2 = new Geom_CartesianPoint (aFarPnt);
+
+  Handle(AIS_Line) aLine = new AIS_Line (aPnt1, aPnt2);
+  ViewerTest::Display ("l", aLine, Standard_True, Standard_True);
+
+  if (toPrint)
+  {
+    theDI << "Near: " << aNearPnt.X() << " " << aNearPnt.Y() << " " << aNearPnt.Z() << "\n";
+    theDI << "Far: " << aFarPnt.X() << " " << aFarPnt.Y() << " " << aFarPnt.Z() << "\n";
+  }
+
+  return 0;
+}
+
+//=======================================================================
+//function : OCC26462
+//purpose  :
+//=======================================================================
+static Standard_Integer OCC26462 (Draw_Interpretor& theDI, Standard_Integer /*theArgNb*/, const char** /*theArgVec*/)
+{
+  if (ViewerTest::GetAISContext().IsNull())
+  {
+    std::cerr << "Error: No opened context!\n";
+    return 1;
+  }
+
+  BRepPrimAPI_MakeBox aBuilder1 (gp_Pnt (10.0, 10.0, 0.0), 10.0, 10.0, 10.0);
+  BRepPrimAPI_MakeBox aBuilder2 (10.0, 10.0, 10.0);
+  Handle(AIS_InteractiveObject) aBox1 = new AIS_Shape (aBuilder1.Shape());
+  Handle(AIS_InteractiveObject) aBox2 = new AIS_Shape (aBuilder2.Shape());
+
+  const Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
+  aCtx->Display (aBox1, 0, 2, Standard_False);
+  aCtx->Display (aBox2, 0, 2, Standard_False);
+  ViewerTest::CurrentView()->FitAll();
+  aCtx->SetWidth (aBox1, 3, Standard_False);
+  aCtx->SetWidth (aBox2, 3, Standard_False);
+
+  aCtx->MoveTo (305, 322, ViewerTest::CurrentView(), Standard_False);
+  aCtx->ShiftSelect (Standard_False);
+  aCtx->MoveTo (103, 322, ViewerTest::CurrentView(), Standard_False);
+  aCtx->ShiftSelect (Standard_False);
+  if (aCtx->NbSelected() != 0)
+  {
+    theDI << "ERROR: no boxes must be selected!\n";
+    return 1;
+  }
+
+  aCtx->SetSelectionSensitivity (aBox1, 2, 5);
+
+  aCtx->MoveTo (305, 322, ViewerTest::CurrentView(), Standard_False);
+  aCtx->ShiftSelect (Standard_False);
+  if (aCtx->NbSelected() != 1)
+  {
+    theDI << "ERROR: b1 was not selected\n";
+    return 1;
+  }
+  aCtx->MoveTo (103, 322, ViewerTest::CurrentView(), Standard_False);
+  aCtx->ShiftSelect (Standard_True);
+  if (aCtx->NbSelected() != 1)
+  {
+    theDI << "ERROR: b2 is selected after b1's tolerance increased\n";
+    return 1;
+  }
+
+  return 0;
+}
+
+
+#include <BRepBuilderAPI_GTransform.hxx>
+static Standard_Integer OCC26313(Draw_Interpretor& di,Standard_Integer n,const char** a)
+{
+  if (n <= 1) return 1;
+  
+  gp_Trsf T;
+  gp_GTrsf GT(T);
+  
+  gp_Mat rot( 1.0, 0.0, 0.0,
+              0.0, 2.0, 0.0,
+              0.0, 0.0, 3.0);
+  
+  GT.SetVectorialPart(rot);
+  BRepBuilderAPI_GTransform gtrf(GT);
+
+  TopoDS_Shape aSrcShape = DBRep::Get(a[2]);
+  if (aSrcShape.IsNull()) {
+    di << a[2] << " is not a valid shape\n";
+    return 1;
+  }
+
+  
+  gtrf.Perform(aSrcShape);
+  if (gtrf.IsDone())
+  {
+    try
+    {
+      DBRep::Set(a[1], gtrf.ModifiedShape(aSrcShape));
+    }
+    catch(Standard_Failure)
+    {
+      di << "Error: Exception is thrown\n";
+    }
+  }
+  else
+  {
+    di << "Error: Result is not done\n";
+    return 1;
+  }
+  
+  return 0;
+}
+
+//=======================================================================
+//function : OCC26525
+//purpose  : check number of intersection points
+//=======================================================================
+#include <BRepAdaptor_Curve.hxx>
+#include <BRepAdaptor_Surface.hxx>
+#include <BRepAdaptor_HCurve.hxx>
+#include <BRepAdaptor_HSurface.hxx>
+#include <IntCurveSurface_HInter.hxx>
+Standard_Integer OCC26525 (Draw_Interpretor& di, 
+                           Standard_Integer n, 
+                           const char** a)
+{
+  TopoDS_Shape aS1, aS2;
+  TopoDS_Edge aE; 
+  TopoDS_Face aF;
+
+  if (n<4)
+  {
+    di << " use OCC26525 r edge face \n";
+    return 1;
+  }
+
+  aS1 = DBRep::Get(a[2]);
+  aS2 = DBRep::Get(a[3]);
+
+  if (aS1.IsNull() || aS2.IsNull())
+  {
+    di << " Null shapes are not allowed \n";
+    return 0;
+  }
+  if (aS1.ShapeType()!=TopAbs_EDGE)
+  {
+    di << " Shape" << a[2] << " should be of type EDGE\n";
+    return 0;
+  }
+  if (aS2.ShapeType()!=TopAbs_FACE)
+  {
+    di << " Shape" << a[3] << " should be of type FACE\n";
+    return 0;
+  }
+
+  aE=TopoDS::Edge(aS1);
+  aF=TopoDS::Face(aS2);
+
+  char buf[128];
+  Standard_Boolean bIsDone;
+  Standard_Integer i, aNbPoints;
+  Standard_Real aU, aV, aT;
+  gp_Pnt aP;
+  BRepAdaptor_Curve aBAC;
+  BRepAdaptor_Surface aBAS;
+  IntCurveSurface_TransitionOnCurve aTC;
+  IntCurveSurface_HInter aHInter;
+
+  aBAC.Initialize(aE);
+  aBAS.Initialize(aF);
+
+  Handle(BRepAdaptor_HCurve) aHBAC=new BRepAdaptor_HCurve(aBAC);
+  Handle(BRepAdaptor_HSurface) aHBAS = new BRepAdaptor_HSurface(aBAS);
+
+  aHInter.Perform(aHBAC, aHBAS);
+  bIsDone=aHInter.IsDone();
+  if (!bIsDone)
+  {
+    di << " intersection is not done\n";
+    return 0;
+  }
+
+  aNbPoints=aHInter.NbPoints();
+  sprintf (buf, " Number of intersection points found: %d", aNbPoints);
+  di <<  buf << "\n";
+  for (i=1; i<=aNbPoints; ++i)
+  {
+    const IntCurveSurface_IntersectionPoint& aIP=aHInter.Point(i);
+    aIP.Values(aP, aU, aV, aT, aTC);
+    //
+    sprintf (buf, "point %s_%d %lg %lg %lg  ", a[1], i, aP.X(), aP.Y(), aP.Z());
+    di << buf << "\n";
+  }
+
+  return 0;
+}
+
+//=======================================================================
+//function : OCC24537
+//purpose  : Puts inverted numbers (in the sense of little/big endian inversion)
+//           from predefined arrays.
+//=======================================================================
+#include <FSD_BinaryFile.hxx>
+
+template<int size>
+inline const unsigned char* SizeRef ();
+
+template<>
+inline const unsigned char* SizeRef <8> ()
+{
+  static const unsigned char aSizeRef[] = {
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
+  return aSizeRef;
+}
+
+template<>
+inline const unsigned char* SizeRef <4> ()
+{
+  static const unsigned char aSizeRef[] = {
+    0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,
+    0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x04,
+    0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x06,
+    0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x08,
+    0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x00};
+  return aSizeRef;
+}
+
+static Standard_Integer OCC24537(
+  Draw_Interpretor& theDI, 
+  Standard_Integer  argc, 
+  const char **     argv)
+{
+  std::ofstream aF;
+  if (argc > 1)
+  {
+    aF.open(argv[1]);
+    if (!aF.is_open())
+    {
+      cout << "cannot create file " << argv[1] << endl;
+      return 1;
+    }
+  }
+  Standard_Boolean isErr = Standard_False;
+  // 1. InverseInt
+  const unsigned char anIntRef[] = {
+    0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,
+    0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x04,
+    0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x06,
+    0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x08,
+    0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x00};
+  Standard_Integer anIntArr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
+  if (aF.is_open())
+  {
+    for(int i = 0; i < 10; ++i)
+    {
+      Standard_Integer anInv = FSD_BinaryFile::InverseInt(anIntArr[i]);
+      aF.write(reinterpret_cast<char*>(&anInv), sizeof(anInv));
+    }
+  }
+  else
+  {
+    Standard_Integer anInv[10];
+    for(int i = 0; i < 10; ++i)
+      anInv[i] = FSD_BinaryFile::InverseInt(anIntArr[i]);
+    if (memcmp(anInv, anIntRef, sizeof(anIntRef)) != 0)
+    {
+      theDI << "Error: incorrect conversion of an integer value\n";
+      isErr = Standard_True;
+    }
+  }
+  
+  // 1a. Random InverseInt
+  const unsigned char aRndIntRef[] = {
+    0xFF,0xC2,0xF7,0x00,0xFF,0xFF,0xFB,0x2E,
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+    0x00,0x00,0x04,0xD2,0x00,0x00,0x04,0xD3,
+    0xFF,0xFF,0xFD,0x1E,0xFF,0xFF,0xFF,0xFB,
+    0x00,0x00,0x03,0x8D,0x00,0x3D,0x09,0x00};
+  Standard_Integer aRndIntArr[] = {-4000000, -1234, 0, 1, 1234, 1235, -738, -5, 909, 4000000};
+  if (aF.is_open())
+  {
+    for(int i = 0; i < 10; ++i)
+    {
+      Standard_Integer anInv = FSD_BinaryFile::InverseInt(aRndIntArr[i]);
+      aF.write(reinterpret_cast<char*>(&anInv), sizeof(anInv));
+    }
+  }
+  else
+  {
+    Standard_Integer anInv[10];
+    for(int i = 0; i < 10; ++i)
+      anInv[i] = FSD_BinaryFile::InverseInt(aRndIntArr[i]);
+    if (memcmp(anInv, aRndIntRef, sizeof(aRndIntRef)) != 0)
+    {
+      theDI << "Error: incorrect conversion of a dispersed integer value\n";
+      isErr = Standard_True;
+    }
+  }
+  
+  // 2. InverseReal
+  const unsigned char aRealRef[] = {
+    0x3F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,
+    0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+    0x40,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
+    0x40,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
+    0x40,0x14,0x00,0x00,0x00,0x00,0x00,0x00,
+    0x40,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
+    0x40,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,
+    0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,
+    0x40,0x22,0x00,0x00,0x00,0x00,0x00,0x00,
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
+  const Standard_Real aRealArr[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 0.0};
+  if (aF.is_open())
+  {
+    for(int i = 0; i < 10; ++i)
+    {
+      Standard_Real anInv = FSD_BinaryFile::InverseReal(aRealArr[i]);
+      aF.write(reinterpret_cast<char*>(&anInv), sizeof(anInv));
+    }
+  }
+  else
+  {
+    Standard_Real anInv[10];
+    for(int i = 0; i < 10; ++i)
+      anInv[i] = FSD_BinaryFile::InverseReal(aRealArr[i]);
+    if (memcmp(anInv, aRealRef, sizeof(aRealRef)) != 0)
+    {
+      theDI << "Error: incorrect conversion of a real value\n";
+      isErr = Standard_True;
+    }
+  }
+
+  // 2a. Random InverseReal
+  const unsigned char aRndRealRef[] = {
+    0xFE,0x37,0xE4,0x3C,0x88,0x00,0x75,0x9C,
+    0xBE,0x11,0x2E,0x0B,0xE8,0x26,0xD6,0x95,
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+    0x3E,0x11,0x2E,0x0B,0xE8,0x26,0xD6,0x95,
+    0x3F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,
+    0x40,0x09,0x21,0xDA,0x45,0x5B,0x53,0xE4,
+    0x54,0xB2,0x49,0xAD,0x25,0x94,0xC3,0x7D,
+    0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,
+    0xC0,0x23,0xCC,0xCC,0xCC,0xCC,0xCC,0xCD,
+    0x40,0x23,0xCC,0xCC,0xCC,0xCC,0xCC,0xCD};
+  const Standard_Real aRndRealArr[] = {-1e300, -1.e-9, 0., 1.e-9, 1., 3.1415296, 1.e100, 8.0, -9.9, 9.9};
+  if (aF.is_open())
+  {
+    for(int i = 0; i < 10; ++i)
+    {
+      Standard_Real anInv = FSD_BinaryFile::InverseReal(aRndRealArr[i]);
+      aF.write(reinterpret_cast<char*>(&anInv), sizeof(anInv));
+    }
+  }
+  else
+  {
+    Standard_Real anInv[10];
+    for(int i = 0; i < 10; ++i)
+      anInv[i] = FSD_BinaryFile::InverseReal(aRndRealArr[i]);
+    if (memcmp(anInv, aRndRealRef, sizeof(aRndRealRef)) != 0)
+    {
+      theDI << "Error: incorrect conversion of a dispersed real value\n";
+      isErr = Standard_True;
+    }
+  }
+
+  // 3. InverseShortReal
+  const unsigned char aShortRealRef[] = {
+    0x3F,0x80,0x00,0x00,0x40,0x00,0x00,0x00,
+    0x40,0x40,0x00,0x00,0x40,0x80,0x00,0x00,
+    0x40,0xA0,0x00,0x00,0x40,0xC0,0x00,0x00,
+    0x40,0xE0,0x00,0x00,0x41,0x00,0x00,0x00,
+    0x41,0x10,0x00,0x00,0x00,0x00,0x00,0x00};
+  const Standard_ShortReal aShortRealArr[] = {
+    1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 0.0f};
+  if (aF.is_open())
+  {
+    for(int i = 0; i < 10; ++i)
+    {
+      Standard_ShortReal anInv = FSD_BinaryFile::InverseShortReal(aShortRealArr[i]);
+      aF.write(reinterpret_cast<char*>(&anInv), sizeof(anInv));
+    }
+  }
+  else
+  {
+    Standard_ShortReal anInv[10];
+    for(int i = 0; i < 10; ++i)
+      anInv[i] = FSD_BinaryFile::InverseShortReal(aShortRealArr[i]);
+    if (memcmp(anInv, aShortRealRef, sizeof(aShortRealRef)) != 0)
+    {
+      theDI << "Error: incorrect conversion of a short real value\n";
+      isErr = Standard_True;
+    }
+  }
+
+  // 3a. Random InverseShortReal
+  const unsigned char aRndShortRealRef[] = {
+    0xB0,0x89,0x70,0x5F,0x00,0x00,0x00,0x00,
+    0x30,0x89,0x70,0x5F,0x3F,0x80,0x00,0x00,
+    0x40,0x49,0x0E,0x56,0xC0,0xD6,0x66,0x66,
+    0x40,0xD6,0x66,0x66,0x42,0xC5,0xCC,0xCD,
+    0xC2,0xC7,0xCC,0xCD,0x42,0xC7,0xCC,0xCD};
+  const Standard_ShortReal aRndShortRealArr[] = {
+    -1.e-9f, 0.f, 1.e-9f, 1.f, 3.1415f, -6.7f, 6.7f, 98.9f, -99.9f, 99.9f};
+  if (aF.is_open())
+  {
+    for(int i = 0; i < 10; ++i)
+    {
+      Standard_ShortReal anInv = FSD_BinaryFile::InverseShortReal(aRndShortRealArr[i]);
+      aF.write(reinterpret_cast<char*>(&anInv), sizeof(anInv));
+    }
+  }
+  else
+  {
+    Standard_ShortReal anInv[10];
+    for(int i = 0; i < 10; ++i)
+      anInv[i] = FSD_BinaryFile::InverseShortReal(aRndShortRealArr[i]);
+    if (memcmp(anInv, aRndShortRealRef, sizeof(aRndShortRealRef)) != 0)
+    {
+      theDI << "Error: incorrect conversion of a dispersed short real value\n";
+      isErr = Standard_True;
+    }
+  }
+
+  // 4. InverseSize
+  const Standard_Size aSizeArr[] = {1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, 8ul, 9ul, 0ul};
+  if (aF.is_open())
+  {
+    for(int i = 0; i < 10; ++i)
+    {
+      Standard_Size anInv = FSD_BinaryFile::InverseSize(aSizeArr[i]);
+      aF.write(reinterpret_cast<char*>(&anInv), sizeof(anInv));
+    }
+  }
+  else
+  {
+    Standard_Size anInv[10];
+    const unsigned char* aSizeRef = SizeRef<sizeof(Standard_Size)>();
+    for(int i = 0; i < 10; ++i)
+      anInv[i] = FSD_BinaryFile::InverseSize(aSizeArr[i]);
+    if (memcmp(anInv, aSizeRef, sizeof(Standard_Size)*10) != 0)
+    {
+      theDI << "Error: incorrect conversion of a size value\n";
+      isErr = Standard_True;
+    }
+  }
+
+  if (!aF.is_open() && !isErr)
+    theDI << "Conversion was done OK";
+  if (aF.is_open())
+  {
+    cout << "the file " << argv[1] << " has been created" << endl;
+    aF.close();
+  }
+  return 0;
+}
+
+
+#include <TopExp.hxx>
+#include <BRepOffsetAPI_DraftAngle.hxx>
+#include <vector>
+static TopoDS_Shape taper(const TopoDS_Shape &shape, const TopoDS_Face &face_a, const TopoDS_Face &face_b, Standard_Real angle)
+{
+  // Use maximum face-to-taper z-offset.
+  const gp_Pln neutral_plane(gp_Ax3(gp_Pnt(0.0, 0.0, 140.0), gp_Dir(0.0, 0.0, 1.0)));
+
+  // Draft angle needs to be in radians, and flipped to adhere to our own (arbitrary) draft
+  // angle definition.
+  const Standard_Real draft_angle = -(angle / 180.0) * M_PI;
+
+  // Add face to draft. The first argument indicates that all material added/removed during
+  // drafting is located below the neutral plane
+  BRepOffsetAPI_DraftAngle drafter(shape);
+  drafter.Add(face_a, gp_Dir(0.0, 0.0, -1.0), draft_angle, neutral_plane);
+  drafter.Add(face_b, gp_Dir(0.0, 0.0, -1.0), draft_angle, neutral_plane);
+  drafter.Build();
+
+  return drafter.Shape();
+}
+
+static void dumpShapeVertices(const TopoDS_Shape &shape, std::vector<Standard_Real>& coords)
+{
+  TopTools_IndexedMapOfShape shape_vertices;
+  TopExp::MapShapes(shape, TopAbs_VERTEX, shape_vertices);
+
+  for (Standard_Integer i = 1; i <= shape_vertices.Extent(); i++)
+  {
+    gp_Pnt p = BRep_Tool::Pnt(TopoDS::Vertex(shape_vertices(i)));
+    coords.push_back(p.X());
+    coords.push_back(p.Y());
+    coords.push_back(p.Z());
+  }
+}
+
+static void GetCoords(const Standard_CString& path_to_file, std::vector<Standard_Real>& coords)
+{
+  TopoDS_Shape shape;
+  BRep_Builder builder;
+  BRepTools::Read(shape, path_to_file, builder);
+  TopTools_IndexedMapOfShape shape_faces;
+  TopExp::MapShapes(shape, TopAbs_FACE, shape_faces);
+  TopoDS_Face face_a = TopoDS::Face(shape_faces(1));
+  TopoDS_Face face_b = TopoDS::Face(shape_faces(5));
+  dumpShapeVertices(taper(shape, face_a, face_b, 5.0), coords);
+}
+
+static Standard_Integer OCC26396 (Draw_Interpretor& theDI, Standard_Integer theArgc, const char** theArgv)
+{
+  if (theArgc < 2)
+  {
+    theDI << "Error: path to file is missing\n";
+    return 1;
+  }
+
+  const int maxInd = 50;
+
+  std::vector<Standard_Real> ref_coords;
+  ref_coords.reserve(100);
+  Standard_Boolean Stat = Standard_True;
+
+  GetCoords(theArgv[1], ref_coords);
+
+  std::vector<Standard_Real> coords;
+  coords.reserve(100);
+  for (int i = 1; i < maxInd; i++)
+  {
+    GetCoords(theArgv[1], coords);
+    if (coords.size() != ref_coords.size())
+    {
+      Stat = Standard_False;
+      break;
+    }
+    for (size_t j = 0; j < coords.size(); j++)
+      if (Abs(ref_coords[j] - coords[j]) > RealEpsilon())
+      {
+        Stat = Standard_False;
+        break;
+      }
+    coords.clear();
+  }
+  if (!Stat)
+    theDI << "Error: unstable results";
+  else
+    theDI << "test OK";
+
+  return 0;
+}
+
+//=======================================================================
+//function : OCC26750 
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC26750( Draw_Interpretor& theDI,
+                                  Standard_Integer  /*theNArg*/,
+                                  const char ** /*theArgVal*/)
+{
+  const gp_Vec2d aVec1(1.0, 0.0);
+  const gp_Vec2d aVec2(0.0, -1.0);
+
+  if(aVec1.IsNormal(aVec2, Precision::Angular()))
+  {
+    theDI << "gp_Vec2d OK. Vectors are normal.\n";
+  }
+  else
+  {
+    theDI << "Error in gp_Vec2d. Vectors should be normal.\n";
+  }
+
+  const gp_Dir2d aD1(1.0, 0.0);
+  const gp_Dir2d aD2(0.0, -1.0);
+
+  if(aD1.IsNormal(aD2, Precision::Angular()))
+  {
+    theDI << "gp_Dir2d OK. Vectors are normal.\n";
+  }
+  else
+  {
+    theDI << "Error in gp_Dir2d. Vectors should be normal.\n";
+  }
+  
+  return 0;
+}
+
+//=======================================================================
+//function : OCC26746 
+//purpose  : Checks if coefficients of the torus are computed properly.
+//=======================================================================
+#include <Geom_ToroidalSurface.hxx>
+#include <Geom_BSplineCurve.hxx>
+static Standard_Integer OCC26746(
+  Draw_Interpretor& theDI, 
+  Standard_Integer  theNArg, 
+  const char **     theArgVal)
+{
+  if(theNArg < 2)
+  {
+    theDI << "Use: OCC26746 torus [toler NbCheckedPoints]\n";
+    return 1;
+  }
+
+  const Handle(Geom_ToroidalSurface) aGtor = 
+    Handle(Geom_ToroidalSurface)::DownCast(DrawTrSurf::GetSurface(theArgVal[1]));
+
+  const Standard_Real aToler = (theNArg >= 3)? Draw::Atof(theArgVal[2]) : 1.0e-7;
+  const Standard_Integer aNbPntsMax = (theNArg >= 4)? Draw::Atoi(theArgVal[3]) : 5;
+
+  const Standard_Integer aLowIndex = 5;
+  const Standard_Real aStep = 2.0*M_PI/aNbPntsMax;
+
+  TColStd_Array1OfReal anArrCoeffs(aLowIndex, aLowIndex+34);
+  aGtor->Torus().Coefficients(anArrCoeffs);
+
+  Standard_Real aUpar = 0.0, aVpar = 0.0;
+  for(Standard_Integer aUind = 0; aUind <= aNbPntsMax; aUind++)
+  {
+    for(Standard_Integer aVind = 0; aVind <= aNbPntsMax; aVind++)
+    {
+      const gp_Pnt aPt(aGtor->Value(aUpar, aVpar));
+      const Standard_Real aX1 = aPt.X();
+      const Standard_Real aX2 = aX1*aX1;
+      const Standard_Real aX3 = aX2*aX1;
+      const Standard_Real aX4 = aX2*aX2;
+      const Standard_Real aY1 = aPt.Y();
+      const Standard_Real aY2 = aY1*aY1;
+      const Standard_Real aY3 = aY2*aY1;
+      const Standard_Real aY4 = aY2*aY2;
+      const Standard_Real aZ1 = aPt.Z();
+      const Standard_Real aZ2 = aZ1*aZ1;
+      const Standard_Real aZ3 = aZ2*aZ1;
+      const Standard_Real aZ4 = aZ2*aZ2;
+
+      Standard_Integer i = aLowIndex;
+
+      Standard_Real aDelta =  anArrCoeffs(i++) * aX4;  //1
+      aDelta+= anArrCoeffs(i++) * aY4;                 //2
+      aDelta+= anArrCoeffs(i++) * aZ4;                 //3
+      aDelta+= anArrCoeffs(i++) * aX3 * aY1;           //4
+      aDelta+= anArrCoeffs(i++) * aX3 * aZ1;           //5
+      aDelta+= anArrCoeffs(i++) * aY3 * aX1;           //6
+      aDelta+= anArrCoeffs(i++) * aY3 * aZ1;           //7
+      aDelta+= anArrCoeffs(i++) * aZ3 * aX1;           //8
+      aDelta+= anArrCoeffs(i++) * aZ3 * aY1;           //9
+      aDelta+= anArrCoeffs(i++) * aX2 * aY2;           //10
+      aDelta+= anArrCoeffs(i++) * aX2 * aZ2;           //11
+      aDelta+= anArrCoeffs(i++) * aY2 * aZ2;           //12
+      aDelta+= anArrCoeffs(i++) * aX2 * aY1 * aZ1;     //13
+      aDelta+= anArrCoeffs(i++) * aX1 * aY2 * aZ1;     //14
+      aDelta+= anArrCoeffs(i++) * aX1 * aY1 * aZ2;     //15
+      aDelta+= anArrCoeffs(i++) * aX3;                 //16
+      aDelta+= anArrCoeffs(i++) * aY3;                 //17
+      aDelta+= anArrCoeffs(i++) * aZ3;                 //18
+      aDelta+= anArrCoeffs(i++) * aX2 * aY1;           //19
+      aDelta+= anArrCoeffs(i++) * aX2 * aZ1;           //20
+      aDelta+= anArrCoeffs(i++) * aY2 * aX1;           //21
+      aDelta+= anArrCoeffs(i++) * aY2 * aZ1;           //22
+      aDelta+= anArrCoeffs(i++) * aZ2 * aX1;           //23
+      aDelta+= anArrCoeffs(i++) * aZ2 * aY1;           //24
+      aDelta+= anArrCoeffs(i++) * aX1 * aY1 * aZ1;     //25
+      aDelta+= anArrCoeffs(i++) * aX2;                 //26
+      aDelta+= anArrCoeffs(i++) * aY2;                 //27
+      aDelta+= anArrCoeffs(i++) * aZ2;                 //28
+      aDelta+= anArrCoeffs(i++) * aX1 * aY1;           //29
+      aDelta+= anArrCoeffs(i++) * aX1 * aZ1;           //30
+      aDelta+= anArrCoeffs(i++) * aY1 * aZ1;           //31
+      aDelta+= anArrCoeffs(i++) * aX1;                 //32
+      aDelta+= anArrCoeffs(i++) * aY1;                 //33
+      aDelta+= anArrCoeffs(i++) * aZ1;                 //34
+      aDelta+= anArrCoeffs(i++);                       //35
+
+      if(Abs(aDelta) > aToler)
+      {
+        theDI << "(" << aUpar << ", " << aVpar << "): Error in torus coefficients computation (Delta = " << aDelta << ").\n";
+      }
+      else
+      {
+        theDI << "(" << aUpar << ", " << aVpar << "): OK (Delta = " << aDelta << ").\n";
+      }
+
+      aVpar = (aVind == aNbPntsMax)? 2.0*M_PI : aVpar + aStep;
+    }
+
+    aVpar = 0.0;
+    aUpar = (aUind == aNbPntsMax)? 2.0*M_PI : aUpar + aStep;
+  }
+
+  return 0;     
+}
+
+DEFINE_STANDARD_HANDLE(QABugs_VertexFilter, SelectMgr_Filter)
+class QABugs_VertexFilter: public SelectMgr_Filter
+{
+public:
+  Standard_EXPORT QABugs_VertexFilter() : SelectMgr_Filter() {}
+
+  Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)&) const
+  {
+    return Standard_False;
+  }
+};
+
+//=======================================================================
+//function : BUC26658 
+//purpose  : Checks selection in the context after using a selection filter
+//=======================================================================
+static Standard_Integer BUC26658 (Draw_Interpretor& theDI,
+                                  Standard_Integer  /*theNArg*/,
+                                  const char ** theArgVal)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) {
+    theDI << "use 'vinit' command before " << theArgVal[0] << "\n";
+    return 1;
+  }
+
+  TopoDS_Shape aBoxShape = BRepPrimAPI_MakeBox(20,20,20).Shape();
+  Handle(AIS_Shape) anAISIO = new AIS_Shape(aBoxShape);
+
+  // visualization of the box in the local mode with possibility to
+  // select box vertices
+  Standard_DISABLE_DEPRECATION_WARNINGS
+  aContext->OpenLocalContext();
+  Standard_ENABLE_DEPRECATION_WARNINGS
+
+  int aDispMode = 0;// wireframe
+  anAISIO->SetDisplayMode(aDispMode);
+  aContext->Display(anAISIO, aDispMode, 0, false, true, AIS_DS_Displayed); 
+  theDI.Eval(" vfit");
+
+  aContext->Load(anAISIO, -1, true); /// load allowing decomposition
+  aContext->Deactivate(anAISIO);
+  aContext->Activate(anAISIO, AIS_Shape::SelectionMode(TopAbs_VERTEX), false);
+  aContext->UpdateCurrentViewer();
+
+  // select a point on the box
+  Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
+  double Xv,Yv;
+  myV3dView->Project(20,20,0,Xv,Yv);
+  Standard_Integer Xp,Yp;
+  myV3dView->Convert(Xv,Yv,Xp,Yp);
+
+  aContext->MoveTo (Xp, Yp, myV3dView, Standard_False);
+  aContext->Select (Standard_False);
+  bool aHasSelected = false;
+  for (aContext->InitSelected(); aContext->MoreSelected() && !aHasSelected; aContext->NextSelected()) {
+    Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive();
+    if (!anIO.IsNull()) {
+      const TopoDS_Shape aShape = aContext->SelectedShape();
+      if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX)
+        aHasSelected = true;
+    }
+  }
+  if (aHasSelected)
+     cout << "has selected vertex : OK"   << endl;
+  else {
+    theDI << "has selected vertex : bugged - Faulty\n";
+    return 1;
+  }
+  // filter to deny any selection in the viewer
+  Handle(QABugs_VertexFilter) aFilter = new QABugs_VertexFilter();
+  aContext->AddFilter(aFilter);
+
+  // update previous selection by hand
+  Standard_DISABLE_DEPRECATION_WARNINGS
+  aContext->LocalContext()->ClearOutdatedSelection(anAISIO, true);
+  Standard_ENABLE_DEPRECATION_WARNINGS
+
+  // check that there are no selected vertices
+  aContext->Select (Standard_True);
+  aHasSelected = false;
+  for (aContext->InitSelected(); aContext->MoreSelected() && !aHasSelected; aContext->NextSelected()) {
+    Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive();
+    if (!anIO.IsNull()) {
+      const TopoDS_Shape aShape = aContext->SelectedShape();
+      if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX)
+        aHasSelected = true;
+    }
+  }
+  if (!aHasSelected) cout << "has no selected vertex after filter : OK"   << endl;
+  else {
+    theDI << "has no selected vertex after filter : bugged - Faulty\n";
+    return 1;
+  }
+
+  return 0;
+}
+
+//=======================================================================
+//function : OCC26945_open
+//purpose  : Opens local context and activates given standard selection mode
+//=======================================================================
+static Standard_Integer OCC26945_open (Draw_Interpretor& theDI, Standard_Integer theArgc, const char** theArgv)
+{
+  const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
+  if (aCtx.IsNull())
+  {
+    std::cout << "No interactive context. Use 'vinit' command before " << theArgv[0] << "\n";
+    return 1;
+  }
+
+  if (theArgc < 2)
+  {
+    std::cout << "Not enough arguments. See usage:\n";
+    theDI.PrintHelp (theArgv[0]);
+    return 1;
+  }
+
+  const TopAbs_ShapeEnum aSelType = AIS_Shape::SelectionType (Draw::Atoi (theArgv[1]));
+  Standard_DISABLE_DEPRECATION_WARNINGS
+  Standard_Integer aLocalCtxIdx = aCtx->OpenLocalContext();
+  aCtx->ActivateStandardMode (aSelType);
+  Standard_ENABLE_DEPRECATION_WARNINGS
+  theDI << aLocalCtxIdx;
+
+  return 0;
+}
+
+//=======================================================================
+//function : OCC26945_close
+//purpose  : Closes local context with the id given
+//=======================================================================
+static Standard_Integer OCC26945_close (Draw_Interpretor& theDI, Standard_Integer theArgc, const char** theArgv)
+{
+  const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
+  if (aCtx.IsNull())
+  {
+    std::cout << "No interactive context. Use 'vinit' command before " << theArgv[0] << "\n";
+    return 1;
+  }
+
+  if (theArgc < 2)
+  {
+    std::cout << "Not enough arguments. See usage:\n";
+    theDI.PrintHelp (theArgv[0]);
+    return 1;
+  }
+
+  const Standard_Integer aCtxToClose = Draw::Atoi (theArgv[1]);
+  Standard_DISABLE_DEPRECATION_WARNINGS
+  aCtx->CloseLocalContext (aCtxToClose);
+  Standard_ENABLE_DEPRECATION_WARNINGS
+
+  return 0;
+}
+
+//=======================================================================
+//function : OCC27048
+//purpose  : Calculate value of B-spline surface N times
+//=======================================================================
+static Standard_Integer OCC27048(Draw_Interpretor& theDI, Standard_Integer theArgc, const char** theArgv)
+{
+  if (theArgc != 5)
+  {
+    std::cout << "Incorrect number of arguments. See usage:" << std::endl;
+    theDI.PrintHelp(theArgv[0]);
+    return 1;
+  }
+
+  Handle(Geom_Surface) aSurf = DrawTrSurf::GetSurface(theArgv[1]);
+  GeomAdaptor_Surface anAdaptor(aSurf);
+
+  Standard_Real aU = Draw::Atof(theArgv[2]);
+  Standard_Real aV = Draw::Atof(theArgv[3]);
+  Standard_Integer aN = Draw::Atoi(theArgv[4]);
+
+  for (; aN > 0; --aN)
+    anAdaptor.Value(aU, aV);
+
+  return 0;
+}
+
+//========================================================================
+//function : OCC27065
+//purpose  : Tests overloaded method "Generated" of BRepOffsetAPI_MakePipe
+//========================================================================
+static Standard_Integer OCC27065(Draw_Interpretor& di,
+                                 Standard_Integer n, const char** a)
+{
+  if (n < 3) return 1;
+  BRep_Builder BB;
+
+  TopoDS_Shape SpineShape = DBRep::Get(a[1],TopAbs_WIRE);
+  if ( SpineShape.IsNull()) return 1;
+  TopoDS_Wire Spine = TopoDS::Wire(SpineShape);
+
+  TopoDS_Shape Profile = DBRep::Get(a[2]);
+  if ( Profile.IsNull()) return 1;
+
+  BRepOffsetAPI_MakePipe aPipeBuilder(Spine, Profile);
+  if (!aPipeBuilder.IsDone())
+  {
+    di << "Error: failed to create pipe\n";
+    return 1;
+  }
+
+  TopExp_Explorer Explo(Profile, TopAbs_SHELL);
+  TopoDS_Shape aShape;
+  TopTools_ListIteratorOfListOfShape itl;
+  if (Explo.More())
+  {
+    aShape = Explo.Current();
+    TopoDS_Compound res1;
+    BB.MakeCompound(res1);
+    itl.Initialize(aPipeBuilder.Generated(aShape));
+    for (; itl.More(); itl.Next())
+      BB.Add(res1, itl.Value());
+    DBRep::Set("res_shell", res1);
+  }
+
+  Explo.Init(Profile, TopAbs_FACE);
+  if (Explo.More())
+  {
+    aShape = Explo.Current();
+    TopoDS_Compound res2;
+    BB.MakeCompound(res2);
+    itl.Initialize(aPipeBuilder.Generated(aShape));
+    for (; itl.More(); itl.Next())
+      BB.Add(res2, itl.Value());
+    DBRep::Set("res_face", res2);
+  }
+  
+  Explo.Init(Profile, TopAbs_WIRE);
+  if (Explo.More())
+  {
+    aShape = Explo.Current();
+    TopoDS_Compound res3;
+    BB.MakeCompound(res3);
+    itl.Initialize(aPipeBuilder.Generated(aShape));
+    for (; itl.More(); itl.Next())
+      BB.Add(res3, itl.Value());
+    DBRep::Set("res_wire", res3);
+  }
+  
+  Explo.Init(Profile, TopAbs_EDGE);
+  if (Explo.More())
+  {
+    aShape = Explo.Current();
+    TopoDS_Compound res4;
+    BB.MakeCompound(res4);
+    itl.Initialize(aPipeBuilder.Generated(aShape));
+    for (; itl.More(); itl.Next())
+      BB.Add(res4, itl.Value());
+    DBRep::Set("res_edge", res4);
+  }
+  
+  Explo.Init(Profile, TopAbs_VERTEX);
+  if (Explo.More())
+  {
+    aShape = Explo.Current();
+    TopoDS_Compound res5;
+    BB.MakeCompound(res5);
+    itl.Initialize(aPipeBuilder.Generated(aShape));
+    for (; itl.More(); itl.Next())
+      BB.Add(res5, itl.Value());
+    DBRep::Set("res_vertex", res5);
+  }
+  
+  return 0;
+}
+
+//========================================================================
+//function : OCC27318
+//purpose  : Creates a box that is not listed in map of AIS objects of ViewerTest
+//========================================================================
+static Standard_Integer OCC27318 (Draw_Interpretor& /*theDI*/, Standard_Integer /*theArgc*/, const char** theArgv)
+{
+  const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
+  if (aCtx.IsNull())
+  {
+    std::cout << "No interactive context. Use 'vinit' command before " << theArgv[0] << "\n";
+    return 1;
+  }
+
+  TopoDS_Shape aBox = BRepPrimAPI_MakeBox (20, 20, 20).Shape();
+  Handle(AIS_Shape) aBoxObj = new AIS_Shape (aBox);
+  aCtx->Display (aBoxObj, Standard_True);
+
+  return 0;
+}
+
+//========================================================================
+//function : OCC27523
+//purpose  : Checks recomputation of deactivated selection mode after object's redisplaying
+//========================================================================
+static Standard_Integer OCC27523 (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
+{
+  if (theArgNb != 1)
+  {
+    std::cerr << "Error: wrong number of arguments! See usage:\n";
+    theDI.PrintHelp (theArgVec[0]);
+    return 1;
+  }
+
+  Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext();
+  if(anAISContext.IsNull())
+  {
+    std::cerr << "Error: no active view. Please call vinit.\n";
+    return 1;
+  }
+
+  gp_Pnt aStart (100, 100, 100);
+  gp_Pnt anEnd (300, 400, 600);
+  BRepBuilderAPI_MakeEdge anEdgeBuilder (aStart, anEnd);
+  TopoDS_Edge anEdge = anEdgeBuilder.Edge();
+  Handle(AIS_InteractiveObject) aTestAISShape = new AIS_Shape (anEdge);
+  anAISContext->Display (aTestAISShape, Standard_False);
+
+  // activate it in selection modes
+  TColStd_SequenceOfInteger aModes;
+  aModes.Append (AIS_Shape::SelectionMode ((TopAbs_ShapeEnum) TopAbs_VERTEX));
+
+  anAISContext->Deactivate (aTestAISShape);
+  anAISContext->Load (aTestAISShape, -1, true);
+  anAISContext->Activate (aTestAISShape, 0);
+  anAISContext->Deactivate (aTestAISShape, 0);
+
+  // activate in vertices mode
+  for (Standard_Integer anIt = 1; anIt <= aModes.Length(); ++anIt)
+  {
+    anAISContext->Activate (aTestAISShape, aModes (anIt));
+  }
+
+  TopoDS_Shape aVertexShape = BRepBuilderAPI_MakeVertex (gp_Pnt (75, 0, 0));
+  TopAbs_ShapeEnum aVertexShapeType = aVertexShape.ShapeType();
+  Handle(AIS_Shape)::DownCast (aTestAISShape)->Set (aVertexShape);
+  aTestAISShape->Redisplay();
+
+  anAISContext->AddOrRemoveSelected (aTestAISShape, Standard_True);
+
+  bool aValidShapeType = false;
+  for (anAISContext->InitSelected(); anAISContext->MoreSelected(); anAISContext->NextSelected())
+  {
+    Handle(SelectMgr_EntityOwner) anOwner = anAISContext->SelectedOwner();
+    Handle(StdSelect_BRepOwner) aBRO = Handle(StdSelect_BRepOwner)::DownCast (anOwner);
+    if (!aBRO.IsNull() && aBRO->HasShape())
+    {
+      TopoDS_Shape aShape = aBRO->Shape();
+
+      aValidShapeType = aShape.ShapeType() == aVertexShapeType;
+    }
+  }
+
+  if (!aValidShapeType)
+  {
+    std::cerr << "Error: shape type is invalid.\n";
+    return 1;
+  }
+
+  return 0;
+}
+
+//========================================================================
+//function : OCC27700
+//purpose  : glPolygonMode() used for frame drawing affects label text shading
+//========================================================================
+
+class OCC27700_Text : public AIS_InteractiveObject
+{
+public:
+
+  DEFINE_STANDARD_RTTI_INLINE (OCC27700_Text, AIS_InteractiveObject)
+
+  virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePresentationManager*/,
+                        const Handle(Prs3d_Presentation)& thePresentation,
+                        const Standard_Integer /*theMode*/) Standard_OVERRIDE
+  {
+    Handle(Graphic3d_ArrayOfTriangles) aFrame = new Graphic3d_ArrayOfTriangles (6, 6);
+    aFrame->AddVertex (gp_Pnt (-1, 0, 0));
+    aFrame->AddVertex (gp_Pnt (-1, 1, 0));
+    aFrame->AddVertex (gp_Pnt ( 3, 1, 0));
+    aFrame->AddVertex (gp_Pnt ( 3, 0, 0));
+
+    aFrame->AddEdge (1);
+    aFrame->AddEdge (2);
+    aFrame->AddEdge (3);
+
+    aFrame->AddEdge (2);
+    aFrame->AddEdge (3);
+    aFrame->AddEdge (4);
+
+    Handle(Graphic3d_AspectFillArea3d) aFillAspect =
+      new Graphic3d_AspectFillArea3d (*myDrawer->ShadingAspect()->Aspect().get());
+    aFillAspect->SetInteriorStyle (Aspect_IS_POINT);
+
+    // create separate group for frame elements
+    Handle(Graphic3d_Group) aFrameGroup = Prs3d_Root::NewGroup (thePresentation);
+    aFrameGroup->AddPrimitiveArray (aFrame);
+    aFrameGroup->SetGroupPrimitivesAspect (aFillAspect);
+
+    // create separate group for text elements
+    Handle(Graphic3d_Group) aTextGroup = Prs3d_Root::NewGroup (thePresentation);
+    TCollection_ExtendedString aString ("YOU SHOULD SEE THIS TEXT", Standard_True);
+    Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (thePresentation), myDrawer->TextAspect(), aString, gp_Ax2 (gp::Origin(), gp::DZ()));
+  }
+
+  virtual void ComputeSelection (const Handle(SelectMgr_Selection)& /*theSelection*/,
+                                 const Standard_Integer /*theMode*/) Standard_OVERRIDE {}
+};
+
+static Standard_Integer OCC27700 (Draw_Interpretor& /*theDI*/, Standard_Integer /*theArgNb*/, const char** /*theArgVec*/)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if (aContext.IsNull())
+  {
+    std::cout << "Error: no view available, call 'vinit' before!" << std::endl;
+    return 1;
+  }
+  Handle(OCC27700_Text) aPresentation = new OCC27700_Text();
+  aContext->Display (aPresentation, Standard_True);
+  return 0;
+}
+
+//========================================================================
+//function : OCC27757
+//purpose  : Creates a box that has a sphere as child object and displays it
+//========================================================================
+static Standard_Integer OCC27757 (Draw_Interpretor& /*theDI*/, Standard_Integer /*theArgc*/, const char** theArgv)
+{
+  const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
+  if (aCtx.IsNull())
+  {
+    std::cout << "No interactive context. Use 'vinit' command before " << theArgv[0] << "\n";
+    return 1;
+  }
+
+  TopoDS_Shape aBox = BRepPrimAPI_MakeBox (20.0, 20.0, 20.0).Shape();
+  TopoDS_Shape aSphere = BRepPrimAPI_MakeSphere (10.0).Shape();
+  gp_Trsf aTrsf;
+  aTrsf.SetTranslationPart (gp_Vec (20.0, 20.0, 0.0));
+  aSphere.Located (TopLoc_Location (aTrsf));
+
+
+  Handle(AIS_Shape) aBoxObj = new AIS_Shape (aBox);
+  Handle(AIS_Shape) aSphereObj = new AIS_Shape (aSphere);
+  aBoxObj->AddChild (aSphereObj);
+  aCtx->Display (aBoxObj, 1, 0, Standard_False);
+  aCtx->UpdateCurrentViewer();
+
+  return 0;
+}
+
+//========================================================================
+//function : OCC27818
+//purpose  : Creates three boxes and highlights one of them with own style
+//========================================================================
+static Standard_Integer OCC27818 (Draw_Interpretor& /*theDI*/, Standard_Integer /*theArgc*/, const char** theArgv)
+{
+  const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
+  if (aCtx.IsNull())
+  {
+    std::cout << "No interactive context. Use 'vinit' command before " << theArgv[0] << "\n";
+    return 1;
+  }
+
+  Handle(AIS_Shape) aBoxObjs[3];
+  for (Standard_Integer aBoxIdx = 0; aBoxIdx < 3; ++aBoxIdx)
+  {
+    TopoDS_Shape aBox = BRepPrimAPI_MakeBox (20.0, 20.0, 20.0).Shape();
+    aBoxObjs[aBoxIdx] = new AIS_Shape (aBox);
+    gp_Trsf aTrsf;
+    aTrsf.SetTranslationPart (gp_Vec (30.0 * aBoxIdx, 30.0 * aBoxIdx, 0.0));
+    aBoxObjs[aBoxIdx]->SetLocalTransformation (aTrsf);
+    aBoxObjs[aBoxIdx]->SetHilightMode (AIS_Shaded);
+  }
+
+  {
+    Handle(Prs3d_Drawer) aHiStyle = new Prs3d_Drawer();
+    aBoxObjs[1]->SetDynamicHilightAttributes (aHiStyle);
+    aHiStyle->SetDisplayMode (AIS_Shaded);
+    aHiStyle->SetColor (Quantity_NOC_RED);
+    aHiStyle->SetTransparency (0.8f);
+  }
+  {
+    Handle(Prs3d_Drawer) aSelStyle = new Prs3d_Drawer();
+    aBoxObjs[2]->SetHilightAttributes (aSelStyle);
+    aSelStyle->SetDisplayMode (AIS_Shaded);
+    aSelStyle->SetColor (Quantity_NOC_RED);
+    aSelStyle->SetTransparency (0.0f);
+    aSelStyle->SetZLayer (Graphic3d_ZLayerId_Topmost);
+  }
+
+  for (Standard_Integer aBoxIdx = 0; aBoxIdx < 3; ++aBoxIdx)
+  {
+    aCtx->Display (aBoxObjs[aBoxIdx], AIS_Shaded, 0, Standard_False);
+  }
+
+  aCtx->UpdateCurrentViewer();
+
+  return 0;
+}
+
+//========================================================================
+//function : OCC27893
+//purpose  : Creates a box and selects it via AIS_InteractiveContext API
+//========================================================================
+static Standard_Integer OCC27893 (Draw_Interpretor& /*theDI*/, Standard_Integer /*theArgc*/, const char** theArgv)
+{
+  const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
+  if (aCtx.IsNull())
+  {
+    std::cout << "No interactive context. Use 'vinit' command before " << theArgv[0] << "\n";
+    return 1;
+  }
+
+  TopoDS_Shape aBox = BRepPrimAPI_MakeBox (10.0, 10.0, 10.0).Shape();
+  Handle(AIS_InteractiveObject) aBoxObj = new AIS_Shape (aBox);
+  aCtx->Display (aBoxObj, AIS_Shaded, 0, Standard_False);
+  aCtx->SetSelected (aBoxObj, Standard_True);
+
+  return 0;
+}
+
+//========================================================================
+//function : OCC28310
+//purpose  : Tests validness of iterator in AIS_InteractiveContext after
+// an removing object from it
+//========================================================================
+static Standard_Integer OCC28310 (Draw_Interpretor& /*theDI*/, Standard_Integer /*theArgc*/, const char** theArgv)
+{
+  const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
+  if (aCtx.IsNull())
+  {
+    std::cout << "No interactive context. Use 'vinit' command before " << theArgv[0] << "\n";
+    return 1;
+  }
+
+  TopoDS_Shape aBox = BRepPrimAPI_MakeBox (10.0, 10.0, 10.0).Shape();
+  Handle(AIS_InteractiveObject) aBoxObj = new AIS_Shape (aBox);
+  aCtx->Display (aBoxObj, AIS_Shaded, 0, Standard_False);
+  ViewerTest::CurrentView()->FitAll();
+  aCtx->MoveTo (200, 200, ViewerTest::CurrentView(), Standard_True);
+  aCtx->Select(Standard_True);
+
+  aCtx->Remove (aBoxObj, Standard_True);
+  // nullify the object explicitly to simulate situation in project,
+  // when ::Remove is called from another method and the object is destroyed
+  // before ::DetectedInteractive is called
+  aBoxObj.Nullify();
+
+  for (aCtx->InitDetected(); aCtx->MoreDetected(); aCtx->NextDetected())
+  {
+    Handle(AIS_InteractiveObject) anObj = aCtx->DetectedInteractive();
+  }
+
+  return 0;
+}
+
+// repetitive display and removal of multiple small objects in the viewer for 
+// test of memory leak in visualization (OCCT 6.9.0 - 7.0.0)
+static Standard_Integer OCC29412 (Draw_Interpretor& /*theDI*/, Standard_Integer theArgNb, const char** theArgVec)
+{
+  Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
+  if (aCtx.IsNull())
+  {
+    std::cout << "Error: no active view.\n";
+    return 1;
+  }
+
+  const int aNbIters = (theArgNb <= 1 ? 10000 : Draw::Atoi (theArgVec[1]));
+  int aProgressPrev = -1;
+  for (int m_loopIndex = 0; m_loopIndex < aNbIters; m_loopIndex++)
+  {
+    gp_Pnt pos;
+    gp_Vec dir(0, 0,1);
+
+    gp_Ax2 center (pos, dir);
+    gp_Circ circle (center, 1);
+    Handle(AIS_Shape) feature;
+
+    BRepBuilderAPI_MakeEdge builder( circle );
+
+    if( builder.Error() == BRepBuilderAPI_EdgeDone )
+    {
+      TopoDS_Edge E1 = builder.Edge();
+      TopoDS_Shape W2 = BRepBuilderAPI_MakeWire(E1).Wire();
+      feature = new AIS_Shape(W2);
+      aCtx->Display (feature, true);
+    }
+
+    aCtx->CurrentViewer()->Update();
+    ViewerTest::CurrentView()->FitAll();
+    aCtx->Remove (feature, true);
+
+    const int aProgress = (m_loopIndex * 100) / aNbIters;
+    if (aProgress != aProgressPrev)
+    {
+      std::cerr << aProgress << "%\r";
+      aProgressPrev = aProgress;
+    }
+  }
+  return 0;
+}
+
+//========================================================================
+//function : Commands_19
+//purpose  :
+//========================================================================
+
+void QABugs::Commands_19(Draw_Interpretor& theCommands) {
+  const char *group = "QABugs";
+
+  Handle(QABugs_HandleClass) aClassPtr = new QABugs_HandleClass();
+  theCommands.Add ("OCC24202_1", "Test Handle-based procedure",
+                   __FILE__, aClassPtr, &QABugs_HandleClass::HandleProc, group);
+  NCollection_Handle<QABugs_NHandleClass> aNClassPtr = new QABugs_NHandleClass();
+  theCommands.Add ("OCC24202_2", "Test NCollection_Handle-based procedure",
+                   __FILE__, aNClassPtr, &QABugs_NHandleClass::NHandleProc, group);
+
+  theCommands.Add ("OCC230", "OCC230 TrimmedCurve Pnt2d Pnt2d", __FILE__, OCC230, group);
+  theCommands.Add ("OCC23361", "OCC23361", __FILE__, OCC23361, group);
+  theCommands.Add ("OCC23237", "OCC23237", __FILE__, OCC23237, group); 
+  theCommands.Add ("OCC22980", "OCC22980", __FILE__, OCC22980, group);
+  theCommands.Add ("OCC23595", "OCC23595", __FILE__, OCC23595, group);
+  theCommands.Add ("OCC22611", "OCC22611 string nb", __FILE__, OCC22611, group);
+  theCommands.Add ("OCC22595", "OCC22595", __FILE__, OCC22595, group);
+  theCommands.Add ("OCC23774", "OCC23774 shape1 shape2", __FILE__, OCC23774, group);
+  theCommands.Add ("OCC23683", "OCC23683 shape", __FILE__, OCC23683, group);
+  theCommands.Add ("OCC23952sweep", "OCC23952sweep nbupoles shape", __FILE__, OCC23952sweep, group);
+  theCommands.Add ("OCC23952intersect", "OCC23952intersect nbsol shape1 shape2", __FILE__, OCC23952intersect, group);
+  theCommands.Add ("test_offset", "test_offset", __FILE__, test_offset, group);
+  theCommands.Add ("OCC23945", "OCC23945 surfname U V X Y Z [DUX DUY DUZ DVX DVY DVZ [D2UX D2UY D2UZ D2VX D2VY D2VZ D2UVX D2UVY D2UVZ]]", __FILE__, OCC23945,group);
+  theCommands.Add ("OCC24008", "OCC24008 curve surface", __FILE__, OCC24008, group);
+  theCommands.Add ("OCC11758", "OCC11758", __FILE__, OCC11758, group);
+  theCommands.Add ("OCC24005", "OCC24005 result", __FILE__, OCC24005, group);
+  theCommands.Add ("OCC24137", "OCC24137 face vertex U V [N]", __FILE__, OCC24137, group);
+  theCommands.Add ("OCC24271", "Boolean operations on NCollection_Map", __FILE__, OCC24271, group);
+  theCommands.Add ("OCC23972", "OCC23972", __FILE__, OCC23972, group);
+  theCommands.Add ("OCC24370", "OCC24370 edge pcurve surface prec", __FILE__, OCC24370, group);
+  theCommands.Add ("OCC24533", "OCC24533", __FILE__, OCC24533, group);
+  theCommands.Add ("OCC24012", "OCC24012 face edge", __FILE__, OCC24012, group);
+  theCommands.Add ("OCC24086", "OCC24086 face wire", __FILE__, OCC24086, group);
+  theCommands.Add ("OCC24667", "OCC24667 result Wire_spine Profile [Mode [Approx]], no args to get help", __FILE__, OCC24667, group);
+  theCommands.Add ("OCC24755", "OCC24755", __FILE__, OCC24755, group);
+  theCommands.Add ("OCC24834", "OCC24834", __FILE__, OCC24834, group);
+  theCommands.Add ("OCC24889", "OCC24889", __FILE__, OCC24889, group);
+  theCommands.Add ("OCC23951", "OCC23951 path to saved step file", __FILE__, OCC23951, group);
+  theCommands.Add ("OCC24931", "OCC24931 path to saved xml file", __FILE__, OCC24931, group);
+  theCommands.Add ("OCC24945", "OCC24945", __FILE__, OCC24945, group);
+  theCommands.Add ("OCC23950", "OCC23950 step_file", __FILE__, OCC23950, group);
+  theCommands.Add ("OCC25004", "OCC25004", __FILE__, OCC25004, group);
+  theCommands.Add ("OCC24925",
+                   "OCC24925 filename [pluginLib=TKXml storageGuid retrievalGuid]"
+                   "\nOCAF persistence without setting environment variables",
+                   __FILE__, OCC24925, group);
+  theCommands.Add ("OCC25043", "OCC25043 shape", __FILE__, OCC25043, group);
+  theCommands.Add ("OCC24826,", "This test performs simple saxpy test.\n Usage: OCC24826 length", __FILE__, OCC24826, group);
+  theCommands.Add ("OCC24606", "OCC24606 : Tests ::FitAll for V3d view ('vfit' is for NIS view)", __FILE__, OCC24606, group);
+  theCommands.Add ("OCC25202", "OCC25202 res shape numF1 face1 numF2 face2", __FILE__, OCC25202, group);
+  theCommands.Add ("OCC7570", "OCC7570 shape", __FILE__, OCC7570, group);
+  theCommands.Add ("OCC25100", "OCC25100 shape", __FILE__, OCC25100, group);
+  theCommands.Add ("OCC25340", "OCC25340", __FILE__, OCC25340, group);
+  theCommands.Add ("OCC25348", "OCC25348", __FILE__, OCC25348, group);
+  theCommands.Add ("OCC25413", "OCC25413 shape", __FILE__, OCC25413, group);
+  theCommands.Add ("OCC25446", "OCC25446 res b1 b2 op", __FILE__, OCC25446, group);
+  theCommands.Add ("OCC25545", 
+                   "no args; tests data race when concurrently accessing \n"
+                   "\t\tTopLoc_Location::Transformation()",
+                   __FILE__, OCC25545, group);
+  theCommands.Add ("OCC25547", "OCC25547", __FILE__, OCC25547, group);
+  theCommands.Add ("OCC24881", "OCC24881 shape", __FILE__, OCC24881, group);
+  theCommands.Add ("OCC26172", "OCC26172", __FILE__, OCC26172, group);
+  theCommands.Add ("xprojponf", "xprojponf p f", __FILE__, xprojponf, group);
+  theCommands.Add ("OCC24923", "OCC24923", __FILE__, OCC24923, group);
+  theCommands.Add ("OCC26139", "OCC26139 [-boxsize value] [-boxgrid value] [-compgrid value]", __FILE__, OCC26139, group);
+  theCommands.Add ("OCC26284", "OCC26284", __FILE__, OCC26284, group);
+  theCommands.Add ("OCC26446", "OCC26446 r c1 c2", __FILE__, OCC26446, group);
+  theCommands.Add ("OCC26448", "OCC26448: check method Prepend() of sequence", __FILE__, OCC26448, group);
+  theCommands.Add ("OCC26407", "OCC26407 result_name", __FILE__, OCC26407, group);
+  theCommands.Add ("OCC26485", "OCC26485 shape", __FILE__, OCC26485, group);
+  theCommands.Add ("OCC26553", "OCC26553 file_path", __FILE__, OCC26553, group);
+  theCommands.Add ("OCC26195",
+                   "OCC26195: x1_pix y1_pix [x2_pix y2_pix] [toPrintPixelCoord 0|1]"
+                   "\n\t\t: Draws rectangular selecting frustum defined by point selection in pixel coordinates"
+                   "\n\t\t: [x1_pix, y1_pix] or rectangular selection in pixel coordinates [x1_pix, y1_pix,"
+                   "\n\t\t: x2_pix, y2_pix]."
+                   "\n\t\t: [toPrintPixelCoord 0|1] - prints 3d projection of pixel coordinate or center of"
+                   "\n\t\t: selecting rectangle onto near and far view frustum planes",
+                   __FILE__, OCC26195, group);
+  theCommands.Add ("OCC26462",
+                   "OCC26462: Checks the ability to manage sensitivity of a particular selection mode in local context",
+                   __FILE__, OCC26462, group);
+
+  theCommands.Add ("OCC26313", "OCC26313 result shape", __FILE__, OCC26313, group);
+  theCommands.Add ("OCC26396", "OCC26396 shape_file_path", __FILE__, OCC26396, group);
+  theCommands.Add ("OCC26525", "OCC26525 result edge face ", __FILE__, OCC26525, group);
+
+  theCommands.Add ("OCC24537", "OCC24537 [file]", __FILE__, OCC24537, group);
+  theCommands.Add ("OCC26750", "OCC26750", __FILE__, OCC26750, group);
+  theCommands.Add ("OCC25574", "OCC25574", __FILE__, OCC25574, group);
+  theCommands.Add ("OCC26746", "OCC26746 torus [toler NbCheckedPoints] ", __FILE__, OCC26746, group);
+
+  theCommands.Add ("BUC26658", "BUC26658 unexpected selection in the context using a selection filter", __FILE__, BUC26658, group);
+  theCommands.Add ("OCC26945_open",
+                   "OCC26945 selectionModeToActivate"
+                   "\n\t\t: Opens a new local context with selectionModeToActivate activated."
+                   "\n\t\t: Prints the ID of newely opened local context in case of success.",
+                   __FILE__, OCC26945_open, group);
+  theCommands.Add ("OCC26945_close",
+                   "OCC26945 localCtxToClose"
+                   "\n\t\t: Closes local context with the ID localCtxToClose",
+                   __FILE__, OCC26945_close, group);
+
+  theCommands.Add ("OCC27048",
+                   "OCC27048 surf U V N\nCalculate value of surface N times in the point (U, V)",
+                   __FILE__, OCC27048, group);
+  
+  theCommands.Add ("OCC27065",
+                   "OCC27065 spine profile",
+                   __FILE__, OCC27065, group);
+
+  theCommands.Add ("OCC27318",
+                   "OCC27318: Creates a box that is not listed in map of AIS objects of ViewerTest",
+                   __FILE__, OCC27318, group);
+  theCommands.Add ("OCC27523",
+                   "OCC27523: Checks recomputation of deactivated selection mode after object's redisplaying",
+                   __FILE__, OCC27523, group);
+  theCommands.Add ("OCC27700",
+                   "OCC27700: Checks drawing text after setting interior style",
+                   __FILE__, OCC27700, group);
+  theCommands.Add ("OCC27757",
+                   "OCC27757: Creates a box that has a sphere as child object and displays it",
+                   __FILE__, OCC27757, group);
+  theCommands.Add ("OCC27818",
+                   "OCC27818: Creates three boxes and highlights one of them with own style",
+                   __FILE__, OCC27818, group);
+  theCommands.Add ("OCC27893",
+                   "OCC27893: Creates a box and selects it via AIS_InteractiveContext API",
+                   __FILE__, OCC27893, group);
+  theCommands.Add("OCC28310",
+                  "OCC28310: Tests validness of iterator in AIS_InteractiveContext after an removing object from it",
+                  __FILE__, OCC28310, group);
+  theCommands.Add("OCC29412", "OCC29412 [nb cycles]: test display / remove of many small objects", __FILE__, OCC29412, group);
   return;
 }