Ignore:
Timestamp:
Dec 16, 2010, 8:58:11 AM (14 years ago)
Author:
braffert
Message:

Developing regression tester

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tester/testview.tcl

    r2008 r2009  
    2929    inherit itk::Widget
    3030
    31     public method clear {}
    32     public method showTest {testxml}
    33     public method showResult {runfile}
    34     public method showText {text}
     31    private method clear {}
     32    private method showTest {testxml}
     33    private method showResult {runfile}
     34    private method showStatus {text}
     35    private method showDescription {text}
    3536    public method update {datapairs}
    3637
     
    4849         [file dirname $toolxml]]
    4950 
    50     itk_component add txt {
    51         text $itk_interior.txt -height 1
     51    itk_component add status {
     52        label $itk_interior.status
    5253    }
    53     pack $itk_component(txt) -expand no -fill x -side top
     54    pack $itk_component(status) -expand no -fill none -side top -anchor w
     55
     56    itk_component add scroller {
     57        Rappture::Scroller $itk_interior.scroller \
     58            -xscrollmode auto -yscrollmode auto
     59    }
     60
     61    itk_component add description {
     62        text $itk_interior.scroller.description -height 0 -wrap word \
     63            -relief flat
     64    }
     65    $itk_component(scroller) contents $itk_component(description)
     66    pack $itk_component(scroller) -expand no -fill x -side top
    5467
    5568    itk_component add analyzer1 {
     
    8194    catch {destroy $itk_component(analyzer1)}
    8295    catch {destroy $itk_component(analyzer2)}
    83     $itk_component(txt) delete 0.0 end
     96    showStatus ""
     97    showDescription ""
    8498}
    8599
     
    96110        Rappture::Tester::TestAnalyzer $itk_interior.analyzer1 $_toolobj
    97111    }
    98     pack $itk_component(analyzer1) -expand no -fill both -side top
     112    pack $itk_component(analyzer1) -expand no -fill both -side top \
     113        -after $itk_component(scroller)
    99114    $itk_component(analyzer1) display $testxml
    100115}
     
    112127        Rappture::Tester::TestAnalyzer $itk_interior.analyzer2 $_toolobj
    113128    }
    114     pack $itk_component(analyzer2) -expand no -fill both -side top
     129    pack $itk_component(analyzer2) -expand no -fill both -side top \
     130        -after $itk_component(analyzer1)
    115131    $itk_component(analyzer2) display $runfile
    116132}
    117133
    118134# ----------------------------------------------------------------------
    119 # USAGE: showText <text>
     135# USAGE: showStatus <text>
    120136#
    121 # Displays a string in the text space at the top of the widget.
     137# Displays a string in the status info space at the top of the widget.
    122138# ----------------------------------------------------------------------
    123 itcl::body Rappture::Tester::TestView::showText {text} {
    124     $itk_component(txt) configure -state normal
    125     $itk_component(txt) delete 0.0 end
    126     $itk_component(txt) insert end "$text"
    127     $itk_component(txt) configure -state disabled
     139itcl::body Rappture::Tester::TestView::showStatus {text} {
     140    $itk_component(status) configure -text "$text"
     141}
     142
     143# ----------------------------------------------------------------------
     144# USAGE: showDescription <text>
     145#
     146# Displays a string in the description text space near the top of the
     147# widget.  If given an empty string, disable the sunken relief effect
     148# to partially hide the text box.
     149# ----------------------------------------------------------------------
     150itcl::body Rappture::Tester::TestView::showDescription {text} {
     151    $itk_component(description) configure -state normal
     152    $itk_component(description) delete 0.0 end
     153    $itk_component(description) insert end "$text"
     154    $itk_component(description) configure -state disabled
     155    if {$text == ""} {
     156        $itk_component(description) configure -relief flat
     157    } else {
     158        $itk_component(description) configure -relief sunken
     159    }
    128160}
    129161
     
    145177        if {$data(ran)} {
    146178            switch $data(result) {
    147                 Pass {showText "Test passed."}
    148                 Fail {showText "Diffs: $data(diffs)"}
    149                 Error {showText "Error while running test."}
     179                Pass {showStatus "Test passed."}
     180                Fail {showStatus "Test failed."}
     181                Error {showStatus "Error while running test."}
    150182            }
    151183            if {$data(runfile) != ""} {
     
    154186            }
    155187        } else {
    156             showText "Test has not yet ran."
     188            showStatus "Test has not yet ran."
    157189        }
     190        set descr [[Rappture::library $data(testxml)] get test.description]
     191        if {$descr == ""} {
     192            set descr "No description."
     193        }
     194        showDescription $descr
    158195    }
    159196}
Note: See TracChangeset for help on using the changeset viewer.