1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0023452: Couldn't catch results produced by commands "data" and "tpstat"

Add new printer
Improving of duplication of command's output
Simplification of removing duplication of command's output
Removing of brackets
improved version
Test correction
This commit is contained in:
mkv 2012-12-14 16:51:39 +04:00
parent c7e8fd777c
commit fa350ff051
4 changed files with 26 additions and 22 deletions

View File

@ -45,8 +45,9 @@ void Draw_Printer::Send (const TCollection_ExtendedString& theString,
if ( ! myTcl ) if ( ! myTcl )
return; return;
(*(Draw_Interpretor*)myTcl) << theString; (*(Draw_Interpretor*)myTcl) << theString;
if ( putEndl ) if ( putEndl ){
(*(Draw_Interpretor*)myTcl) << '\n'; (*(Draw_Interpretor*)myTcl) << "\n";
}
} }
//======================================================================= //=======================================================================
@ -61,8 +62,9 @@ void Draw_Printer::Send (const Standard_CString theString,
if ( ! myTcl ) if ( ! myTcl )
return; return;
(*(Draw_Interpretor*)myTcl) << theString; (*(Draw_Interpretor*)myTcl) << theString;
if ( putEndl ) if ( putEndl ){
(*(Draw_Interpretor*)myTcl) << '\n'; (*(Draw_Interpretor*)myTcl) << "\n";
}
} }
//======================================================================= //=======================================================================
@ -77,6 +79,7 @@ void Draw_Printer::Send (const TCollection_AsciiString& theString,
if ( ! myTcl ) if ( ! myTcl )
return; return;
(*(Draw_Interpretor*)myTcl) << theString; (*(Draw_Interpretor*)myTcl) << theString;
if ( putEndl ) if ( putEndl ){
(*(Draw_Interpretor*)myTcl) << '\n'; (*(Draw_Interpretor*)myTcl) << "\n";
}
} }

View File

@ -31,7 +31,7 @@ package XSDRAW
uses TCollection, TColStd, TopTools, uses TCollection, TColStd, TopTools,
gp, Geom, Geom2d, TopoDS, MoniTool, gp, Geom, Geom2d, TopoDS, MoniTool,
Interface, Transfer, IFSelect, XSControl, Draw, SWDRAW Interface, Transfer, IFSelect, XSControl, Draw, SWDRAW, Message
is is

View File

@ -39,6 +39,8 @@
#include <Message.hxx> #include <Message.hxx>
#include <Message_Messenger.hxx> #include <Message_Messenger.hxx>
#include <Message_PrinterOStream.hxx>
#include <Draw_Printer.hxx>
static int deja = 0, dejald = 0; static int deja = 0, dejald = 0;
//unused variable //unused variable
@ -109,6 +111,11 @@ void XSDRAW::LoadDraw (Draw_Interpretor& theCommands)
// performed not in IFSelect_SessionPilot but in standard Tcl interpretor // performed not in IFSelect_SessionPilot but in standard Tcl interpretor
XSDRAW::RemoveCommand("x"); XSDRAW::RemoveCommand("x");
XSDRAW::RemoveCommand("exit"); XSDRAW::RemoveCommand("exit");
const Handle(Message_Messenger) &sout = Message::DefaultMessenger();
if (!sout.IsNull()){
sout->RemovePrinters(STANDARD_TYPE(Message_PrinterOStream));
sout->AddPrinter(new Draw_Printer(theCommands));
}
// if (!getenv("WBHOSTTOP")) XSDRAW::RemoveCommand("xsnew"); // if (!getenv("WBHOSTTOP")) XSDRAW::RemoveCommand("xsnew");
Handle(TColStd_HSequenceOfAsciiString) list = Handle(TColStd_HSequenceOfAsciiString) list =
IFSelect_Activator::Commands(0); IFSelect_Activator::Commands(0);

24
tests/bugs/iges/buc60685 Normal file → Executable file
View File

@ -10,21 +10,15 @@ set l [igesbrep [locate_data_file buc60685a.igs] a xst-transferrable-roots]
tpcompound result tpcompound result
puts [checkshape result r] puts [checkshape result r]
set start [lindex $l 60] regexp {List given by xst-transferrable-roots : Nb entities selected : +([-0-9+eE]+)} ${l} full start
set bug_list_numb [ llength $l ] regexp {List given by xst-transferrable-roots : Nb entities selected : +([-0-9+eE]+)} ${l} full end
set bug_list_elem 0 puts "start = ${start}"
while { $bug_list_elem != $bug_list_numb } { puts "end = ${end}"
if { [ string compare "Nb" [ lindex $l $bug_list_elem ] ] == 0 && [ string compare "entities" [ lindex $l [ expr { $bug_list_elem + 1 } ] ] ] == 0 && [ string compare "selected" [ lindex $l [ expr { $bug_list_elem + 2 } ] ] ] == 0 && [ string compare ":" [ lindex $l [ expr { $bug_list_elem + 3 } ] ] ] == 0 } { if { ${start} == ${end} && ${start} == 19 } {
set start [ lindex $l [ expr { $bug_list_elem + 4 } ] ] puts "BUC60685: OK"
set bug_list_elem [ expr { $bug_list_numb - 1 } ] } else {
} puts "Faulty : wrong number of translated shapes. It is ${end} instead of ${start}"
set bug_list_elem [ expr { $bug_list_elem + 1 } ] puts "BUC60685: Faulty"
}
set n [llength $l]
set end [lindex $l [expr $n-1]]
if { $start != $end } {
puts "Error : wrong number of translated shapes. It is ${end} instead of ${start}"
} }
set 2dviewer 0 set 2dviewer 0