Ignore:
Timestamp:
Dec 17, 2010, 2:50:25 PM (14 years ago)
Author:
braffert
Message:

Developing regression tester

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tester/testview.tcl

    r2011 r2012  
    1414# ======================================================================
    1515package require Itk
     16package require BLT
    1617
    1718namespace eval Rappture::Tester::TestView { #forward declaration }
     
    3031
    3132    protected method updateAnalyzer {args}
    32     protected method showResult {runfile}
     33    protected method updateResult {runfile}
    3334    protected method showStatus {text}
    3435    protected method showDescription {text}
     
    7374    }
    7475    $itk_component(tabs) insert end "Analyzer" -ipady 25 -fill both
    75     $itk_component(tabs) insert end "Result" -ipady 25 -fill both
     76    $itk_component(tabs) insert end "Result" -ipady 25 -fill both \
     77        -state disabled
    7678    pack $itk_component(tabs) -expand yes -fill both -side top
    7779
     
    100102# ----------------------------------------------------------------------
    101103itcl::body Rappture::Tester::TestView::clear {} {
    102     catch {
    103         $itk_component(analyzer) clear
    104         destroy $itk_component(analyzer)
    105     }
    106     $itk_component(tabs) invoke [$itk_component(tabs) index -name "Result"]
     104    updateAnalyzer
     105    updateResult
     106    # TODO: Switch back to analyzer tab when disabling result tab
     107    $itk_component(tabs) focus [$itk_component(tabs) index -name "Analyzer"]
    107108    $itk_component(tabs) tab configure "Result" -state disabled
    108109    showStatus ""
     
    114115#
    115116# Clears the analyzer and loads the given library objects.  Used to load
    116 # both the golden result as well as the test result.
     117# both the golden result as well as the test result.  Clears the
     118# analyzer space if no arguments are given.
    117119# Destroys the existing analyzer widget and creates a new one. 
    118120# Eventually this should be able to keep the same widget and swap in
     
    136138
    137139# ----------------------------------------------------------------------
    138 # TODO: fill this in
    139 # ----------------------------------------------------------------------
    140 itcl::body Rappture::Tester::TestView::showResult {runfile} {
    141     $itk_component(tabs) tab configure "Result" -state normal
    142     $itk_component(result) delete 0.0 end
    143     $itk_component(result) insert end $runfile
     140# USAGE: updateResult ?datapairs?
     141#
     142# Given a set of key value pairs from the test tree, update the result
     143# page of the testview widget.  If no arguments are given, disable the
     144# result page.
     145# ----------------------------------------------------------------------
     146itcl::body Rappture::Tester::TestView::updateResult {args} {
     147    if {[llength $args] == 0} {
     148        $itk_component(result) delete 0.0 end
     149        $itk_component(tabs) focus [$itk_component(tabs) index -name "Result"]
     150        $itk_component(tabs) tab configure "Result" -state disabled
     151        return
     152    } elseif {[llength $args] == 1} {
     153        array set data [lindex $args 0]
     154        $itk_component(tabs) tab configure "Result" -state normal
     155        $itk_component(result) delete 0.0 end
     156        $itk_component(result) insert end "Test xml: $data(testxml)\n"
     157        $itk_component(result) insert end "Runfile: $data(runfile)\n"
     158        if {$data(result) == "Fail"} {
     159            $itk_component(result) insert end "Diffs: $data(diffs)\n"
     160        }
     161    } else {
     162        error "wrong # args: should be \"updateResult ?datapairs?\""
     163    }
    144164}
    145165
     
    197217                $result put input.run.current "Test"
    198218                updateAnalyzer $golden $result
    199                 showResult $data(runfile)
     219                updateResult $datapairs
     220            } else {
     221                updateResult
    200222            }
    201223        } else {
    202224            showStatus "Test has not yet ran."
     225            updateResult
    203226            if {$data(testxml) != ""} {
    204227                updateAnalyzer [Rappture::library $data(testxml)]
     
    211234        showDescription $descr
    212235    } else {
    213        # clear entire screen if branch node selected
    214 #       clear
    215     }
    216 }
    217 
     236       # clear everything if branch node selected
     237       clear
     238    }
     239}
     240
Note: See TracChangeset for help on using the changeset viewer.