0030430: Draw - command testgrid in parallel mode hangs if DRAW is launched without GUI
[occt.git] / tests / demo / draw / dlog
CommitLineData
e05c25c1 1# Check functionality of dlog command (capturing of stdout)
2
3pload MODELING
4
5# activate logging
6set status [dlog status]
7dlog on
8
9# check that log does not fail at many executions
10# note that this makes sense only if we do not run by test command with
11# dlog already active, in which case puts is redefined
12if { $status == off } {
13 for {set i 0} {$i < 10000} {incr i} { box b 1 1 1 }
14 dlog off
15 puts "Try puts to check that channel is not broken"
16 dlog on
17}
18
19# check that logging works as expected
20dlog reset
21box b 1 1 1
22explode b f
23if { $status == off } {
24 # this will get to log if executed using "test" command instead of testgrid, as it redefines puts
25 puts "output of puts -- should not be in the log"
26}
27dlog add "output of dlog add"
28set log [dlog get]
29set expected "box b 1 1 1 \nexplode b f \nb_1 b_2 b_3 b_4 b_5 b_6\noutput of dlog add\n"
30if { $log != $expected } {
31 puts "Error: Logged text does not match expected"
32 puts "Value: \"$log\""
33 puts "Expected: \"$expected\""
34}
35
36# return original state of logging
37dlog $status
38
39puts "TEST COMPLETED"