$Application ExitOnReturnOn

set kw(vtkTemp1) [$Application GetMainWindow]
set kw(vtkTemp22) [$kw(vtkTemp1) GetMainView]

if {[info exists argc]} { 
    set argcm1 [expr $argc - 1]
    for {set i 0} {$i < $argcm1} {incr i} {
        if {[lindex $argv $i] == "-D" && $i < $argcm1} {
		set DataDir [lindex $argv [expr $i + 1]]
        }
        if {[lindex $argv $i] == "-UC" && $i < $argcm1} {
            set rmui [$kw(vtkTemp22) GetRenderModuleUI]
            puts [$rmui GetClassName]
#            catch {$rmui SetCompositeThreshold 0}
        }
    }
} 


# This test is to see if the array menu gets updated properly
# when the input menu is changed.


set kw(vtkTemp273) [$kw(vtkTemp1) CreatePVSource SphereSource]
set kw(vtkTemp290) [$kw(vtkTemp273) GetPVWidget {Theta Resolution}]
$kw(vtkTemp290) SetValue 16
set kw(vtkTemp299) [$kw(vtkTemp273) GetPVWidget {Phi Resolution}]
$kw(vtkTemp299) SetValue 16
$kw(vtkTemp273) AcceptCallback
$kw(vtkTemp22) SetBackgroundColor 0.000000 0.000000 0.000000
set kw(vtkTemp327) [$kw(vtkTemp1) CreatePVSource SphereSource]
set kw(vtkTemp336) [$kw(vtkTemp327) GetPVWidget {Center}]
$kw(vtkTemp336) SetValue 2 0 0
set kw(vtkTemp344) [$kw(vtkTemp327) GetPVWidget {Theta Resolution}]
$kw(vtkTemp344) SetValue 8
set kw(vtkTemp353) [$kw(vtkTemp327) GetPVWidget {Phi Resolution}]
$kw(vtkTemp353) SetValue 6
$kw(vtkTemp327) AcceptCallback
$kw(vtkTemp1) ResetCameraCallback
set kw(vtkTemp381) [$kw(vtkTemp1) CreatePVSource ElevationFilter]
set kw(vtkTemp394) [$kw(vtkTemp381) GetPVWidget {Line}]
$kw(vtkTemp394) SetPoint1 0.00000 0.00000 0.00000
$kw(vtkTemp394) SetPoint2 0.00000 0.00000 1.00000
$kw(vtkTemp394) SetResolution 20
$kw(vtkTemp381) AcceptCallback
set kw(vtkTemp428) [$kw(vtkTemp1) CreatePVSource Calculator]
set kw(vtkTemp668) [$kw(vtkTemp428) GetPVWidget {Equation}]
$kw(vtkTemp668) AddScalarVariable Normals_0 Normals 0
$kw(vtkTemp668) SetFunctionLabel {Normals_0}
$kw(vtkTemp428) AcceptCallback
set kw(vtkTemp482) [$kw(vtkTemp1) CreatePVSource WarpScalar]
set kw(vtkTemp491) [$kw(vtkTemp482) GetPVWidget {Scalars}]
$kw(vtkTemp491) SetValue {resultArray}
$kw(vtkTemp482) AcceptCallback
set kw(vtkTemp452) [$kw(vtkTemp428) GetPVOutput]
$kw(vtkTemp452) SetVisibility 1
set kw(vtkTemp506) [$kw(vtkTemp482) GetPVWidget {Input}]
$kw(vtkTemp506) SetCurrentValue $kw(vtkTemp381)
$kw(vtkTemp491) SetValue {Elevation}
$kw(vtkTemp482) AcceptCallback
set kw(vtkTemp509) [$kw(vtkTemp482) GetPVOutput]
$kw(vtkTemp509) SetVisibility 0
$kw(vtkTemp509) SetVisibility 1
$kw(vtkTemp509) ColorByProperty



set kw(vtkTemp309) [$kw(vtkTemp273) GetPVOutput]
$kw(vtkTemp309) ColorByPointField {Normals} 3



# Lets see if the array menu has the correct value.
# Create a text files with the current menu value.
# out.txt is a special name
if { [catch {set fp [open "out.txt" w]}] == 0 } {
  puts $fp [$kw(vtkTemp491) GetValue]
}
close $fp

source $DataDir/Utility/rtText.tcl
pvFileTest $DataDir/Baseline/ArrayMenuChangeInput.txt
file delete -force out.txt
if {[$Application GetExitStatus]} {
  $Application Exit
}


# Continue with the rest of the test.
 
#$kw(vtkTemp482) AcceptCallback

# Fix the size of the image.
set RenWin1 [[[$Application GetMainWindow] GetMainView] GetRenderWindow]
$RenWin1 SetSize 300 300
$RenWin1 Render
update

for {set i  1} {$i < [expr $argc - 1]} {incr i} {
	if {[lindex $argv $i] == "-C"} {
	    source [lindex $argv [expr $i + 1]]
	    $Application SetExitStatus [CompareImage [[$Application GetMainWindow] GetMainView]]
	}
}

$Application Exit





