
TESTS
     A test consists of a condition and two sets of actions.  The
     syntax is:
     test={  condition="command string"
          true={ action=... action=.... test={ ... }  }
          false={ action=... action=.... }
     }

     The string specified in the condition  is  expanded  in  the
     usual  way.  It is then passed to the system as a command to
     be executed. The return code from  running  the  command  is
     then examined. If the return code is zero then the action[s]
     specified in the true construct are executed. If the  return
     code  is  non-zero then the action[s] specified in the false
     construct are executed.  The actions  within  the  true  and
     false objects may be simple actions or more test objects.

     The system command "test" is very useful for use  in  condi-
     tions.  It  will  evaluate  its arguments and return zero if
     they evaluate to true and one if they are  false.  See  "man
     test" for more details.

     This example compares the values of two sliders:
     button={ name=QUIT action=QUIT }
     slider={ name=val1 min=0 max=100 format="%.0f" }
     slider={ name=val2 min=0 max=100 format="%.0f" }
     button={ label=testme
          test={ condition=" test $val1 -eq $val2 "
                 true={ action="PRINT values are equal 0 }
                 false={ action="PRINT values are not equal 0 }
          }
     }

     Here is a more complicated example. It  uses  a  test  in  a
     timer object to check on the status of a background task. In
     this example the background task just sleeps but it could be
     performing a time consuming sequnce of actions. Pressing the
     button starts the timer and runs a task in  the  background.
     If  the  lockfile is present the test condition in the timer
     will evaluate to true. In this case the button will  be  set
     to  an  insensitive  state with a red background and a label
     that says "RUNNING". When the lock file disappears the  but-
     ton  will be reset to its original state, and the timer will
     turn itself off.

     button={ name=QUIT action=QUIT }
     button={ name=doit
         action="SET lockcheck running 1"
         action="( touch busy.lck; sleep 6; rm busy.lck )& "
     }

     timer={
         name=lockcheck
         interval=1
         running=0
         test={
             condition="test -f busy.lck"
             true={
                     action="SET doit label RUNNING"
                     action="SET doit sensitive 0"
                     action="SET doit background red"
             }
             false={
                     action="SET doit label doit"
                     action="SET doit sensitive 1"
                     action="SET doit background white"
                     action="SET lockcheck running 0"
             }
         }
     }
