From 4e7bb263012500152e70b14d61bb004f7ce9e081 Mon Sep 17 00:00:00 2001
From: szv <szv@opencascade.com>
Date: Thu, 12 Dec 2013 12:32:51 +0400
Subject: [PATCH] 0024440: Regressions in products test group sat/doc_1

Check for closed shell is corrected
---
 src/ShapeFix/ShapeFix_Shell.cxx | 13 ++++++++-----
 tests/de/step_4/C9              |  2 --
 tests/de/step_4/D1              |  2 --
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/ShapeFix/ShapeFix_Shell.cxx b/src/ShapeFix/ShapeFix_Shell.cxx
index e8d98bb154..e6cd54fb71 100755
--- a/src/ShapeFix/ShapeFix_Shell.cxx
+++ b/src/ShapeFix/ShapeFix_Shell.cxx
@@ -873,14 +873,17 @@ Standard_Boolean ShapeFix_Shell::FixFaceOrientation(const TopoDS_Shell& shell,co
   TopTools_MapOfShape aMapMultiConnectEdges;
   Standard_Boolean isFreeBoundaries = Standard_False;
   for(Standard_Integer k = 1; k <= aMapEdgeFaces.Extent(); k++) {
-    Standard_Integer aFaceCount = aMapEdgeFaces.FindFromIndex(k).Extent();
+    const Standard_Integer aFaceCount = aMapEdgeFaces.FindFromIndex(k).Extent();
+    if (!isFreeBoundaries && aFaceCount == 1) {
+      TopoDS_Edge E = TopoDS::Edge(aMapEdgeFaces.FindKey(k));
+      if (!BRep_Tool::Degenerated(E))
+        isFreeBoundaries = Standard_True;
+    }
     //Finds multishared edges
-    if (isAccountMultiConex && aFaceCount > 2)
+    else if (isAccountMultiConex && aFaceCount > 2)
       aMapMultiConnectEdges.Add(aMapEdgeFaces.FindKey(k));
-    if (aFaceCount == 1)
-      isFreeBoundaries = Standard_True; 
   }
-  if (BRep_Tool::IsClosed (myShell) == isFreeBoundaries)
+  if (BRep_Tool::IsClosed(myShell)? isFreeBoundaries : !isFreeBoundaries)
   {
     myShell.Closed (!isFreeBoundaries);
     SendWarning (Message_Msg ("FixAdvShell.FixClosedFlag.MSG0"));//Shell has incorrect flag isClosed
diff --git a/tests/de/step_4/C9 b/tests/de/step_4/C9
index 2e9f31df44..df1b00cd26 100644
--- a/tests/de/step_4/C9
+++ b/tests/de/step_4/C9
@@ -1,6 +1,4 @@
 # !!!! This file is generated automatically, do not edit manually! See end script
-puts "TODO CR23096 ALL: TPSTAT : Faulty" 
-
 
 set filename db_exhaust-A.stp
 
diff --git a/tests/de/step_4/D1 b/tests/de/step_4/D1
index e0af3cb439..2a233170e2 100644
--- a/tests/de/step_4/D1
+++ b/tests/de/step_4/D1
@@ -1,6 +1,4 @@
 # !!!! This file is generated automatically, do not edit manually! See end script
-puts "TODO CR23096 ALL: TPSTAT : Faulty" 
-
 
 set filename db_exhaust-B.stp