394 if {[
winfo exists .bistwin]} {
399 set data(images,unchecked) [
image create photo -file [
file join $::tke_dir lib images unchecked.gif]]
400 set data(images,checked) [
image create photo -file [
file join $::tke_dir lib images checked.gif]]
404 wm title .bistwin [msgcat::mc "Built-In Self Test"]
407 set data(widgets,nb) [ttk::notebook .bistwin.nb]
410 .bistwin.nb add [
set sf [ttk::frame .bistwin.nb.sf]] -text [msgcat::mc "Setup"]
413 set data(widgets,tbl) [tablelist::tablelist $sf.tf.tl -columns [list 0 {} 0 [msgcat::mc "Name"] 0 [msgcat::mc "Run Count"] 0 [msgcat::mc "Pass Count"] 0 [msgcat::mc "Fail Count"] 0 {}] \
414 -treecolumn 1 -exportselection 0 -stretch all \
415 -borderwidth 0 -highlightthickness 0 \
416 -selectbackground blue -selectforeground white \
417 -xscrollcommand [list $sf.tf.hb set] -yscrollcommand [list $sf.tf.vb set]]
418 scroller::scroller $sf.tf.hb -orient horizontal -background white -foreground black -command [list $sf.tf.tl xview]
419 scroller::scroller $sf.tf.vb -orient vertical -background white -foreground black -command [list $sf.tf.tl yview]
421 $sf.tf.tl columnconfigure 0 -name selected -editable 0 -resizable 0 -editwindow checkbutton \
422 -formatcommand [list bist::format_cell] -labelimage $data(images,unchecked) -labelcommand [list bist::label_clicked]
423 $sf.tf.tl columnconfigure 1 -name name -editable 0 -resizable 0 -formatcommand [list bist::format_cell]
424 $sf.tf.tl columnconfigure 2 -name count -editable 0 -resizable 0
425 $sf.tf.tl columnconfigure 3 -name pass -editable 0 -resizable 0
426 $sf.tf.tl columnconfigure 4 -name fail -editable 0 -resizable 0
427 $sf.tf.tl columnconfigure 5 -name test -hide 1
429 bind [$data(widgets,tbl) bodytag] <Button-$::right_click> [list bist::handle_right_click %W %x %y %X %Y]
431 grid rowconfigure $sf.tf 0 -weight 1
432 grid columnconfigure $sf.tf 0 -weight 1
433 grid $sf.tf.tl -row 0 -column 0 -sticky news
434 grid $sf.tf.vb -row 0 -column 1 -sticky ns
435 grid $sf.tf.hb -row 1 -column 0 -sticky ew
437 pack $sf.tf -fill both -expand yes
440 .bistwin.nb add [
set of [ttk::frame .bistwin.nb.of]] -text [msgcat::mc "Options"]
442 ttk::radiobutton $of.lrb -text [msgcat::mc "Run loops"] -variable bist::data(run_mode) -value "loop" -command {
443 bist::set_state .bistwin.nb.of.if disabled
444 bist::set_state .bistwin.nb.of.lf normal
448 ttk::label $of.lf.lcl -text [
format "%s: " [msgcat::mc "Loop count"]]
449 set data(widgets,loops) [ttk::spinbox $of.lf.lcsb -from 1 -to 1000 -increment 1.0]
450 ttk::label $of.lf.ltl -text [
format "%s: " [msgcat::mc "Loop type"]]
451 ttk::menubutton $of.lf.ltmb -menu [
menu .bistwin.ltPopup -tearoff 0]
453 grid rowconfigure $of.lf 5 -weight 1
454 grid columnconfigure $of.lf 0 -minsize 20
455 grid columnconfigure $of.lf 1 -minsize 150
456 grid columnconfigure $of.lf 3 -weight 1
457 grid $of.lf.lcl -row 0 -column 1 -sticky news -padx 2 -pady 2
458 grid $of.lf.lcsb -row 0 -column 2 -sticky news -padx 2 -pady 2
459 grid $of.lf.ltl -row 1 -column 1 -sticky news -padx 2 -pady 2
460 grid $of.lf.ltmb -row 1 -column 2 -sticky news -padx 2 -pady 2
462 ttk::radiobutton $of.irb -text [msgcat::mc "Run iterations"] -variable bist::data(run_mode) -value "iter" -command {
463 bist::set_state .bistwin.nb.of.lf disabled
464 bist::set_state .bistwin.nb.of.if normal
468 ttk::label $of.if.icl -text [
format "%s: " [msgcat::mc "Iteration count"]]
469 set data(widgets,iters) [ttk::spinbox $of.if.icsb -from 1 -to 1000 -increment 1.0]
470 ttk::label $of.if.itl -text [
format "%s: " [msgcat::mc "Selection method"]]
471 ttk::menubutton $of.if.itmb -menu [
menu .bistwin.itPopup -tearoff 0]
473 grid rowconfigure $of.if 5 -weight 1
474 grid columnconfigure $of.if 0 -minsize 20
475 grid columnconfigure $of.if 1 -minsize 150
476 grid columnconfigure $of.if 3 -weight 1
477 grid $of.if.icl -row 0 -column 1 -sticky news -padx 2 -pady 2
478 grid $of.if.icsb -row 0 -column 2 -sticky news -padx 2 -pady 2
479 grid $of.if.itl -row 1 -column 1 -sticky news -padx 2 -pady 2
480 grid $of.if.itmb -row 1 -column 2 -sticky news -padx 2 -pady 2
482 pack $of.lrb -fill x -padx 2 -pady 2
483 pack $of.lf -fill x -padx 2 -pady 2
484 pack $of.irb -fill x -padx 2 -pady 2
485 pack $of.if -fill x -padx 2 -pady 2
488 foreach {val lbl} [list \
489 "random" [msgcat::mc "Random"] \
490 "increment" [msgcat::mc "Incrementing order"] \
491 "decrement" [msgcat::mc "Decrementing order"]] {
492 set cmd [list bist::set_mode .bistwin.nb.of.lf.ltmb $lbl $val loop_mode]
493 .bistwin.ltPopup add radiobutton -label $lbl -variable bist::data(loop_mode) -value $val -command $cmd
497 foreach {val lbl} [list \
498 "random" [msgcat::mc "Random"] \
499 "increment" [msgcat::mc "Incrementing order"] \
500 "decrement" [msgcat::mc "Decrementing order"]] {
501 set cmd [list bist::set_mode .bistwin.nb.of.if.itmb $lbl $val iter_mode]
502 .bistwin.itPopup add radiobutton -label $lbl -variable bist::data(iter_mode) -value $val -command $cmd
506 set data(run_mode) "iter"
507 set data(loop_mode) "random"
508 set data(iter_mode) "random"
509 $data(widgets,loops) set 1
510 $of.lf.ltmb configure -text [msgcat::mc "Random"]
511 $data(widgets,iters) set 50
512 $of.if.itmb configure -text [msgcat::mc "Random"]
516 .bistwin.nb add [
set rf [ttk::frame .bistwin.nb.rf]] -text [msgcat::mc "Results"]
518 ttk::labelframe $rf.of -text [msgcat::mc "Output"]
519 set data(widgets,output) [text $rf.of.t -state disabled -wrap none \
520 -relief flat -borderwidth 0 -highlightthickness 0 \
521 -xscrollcommand [list $rf.of.hb set] \
522 -yscrollcommand [list $rf.of.vb set]]
523 scroller::scroller $rf.of.hb -orient horizontal -background white -foreground black -command [list $rf.of.t xview]
524 scroller::scroller $rf.of.vb -orient vertical -background white -foreground black -command [list $rf.of.t yview]
526 bind $rf.of.t <ButtonPress-$::right_click> [list bist::text_select_test %x %y]
527 bind $rf.of.t <ButtonRelease-$::right_click> [list bist::text_jump_to_test %x %y]
529 grid rowconfigure $rf.of 0 -weight 1
530 grid columnconfigure $rf.of 0 -weight 1
531 grid $rf.of.t -row 0 -column 0 -sticky news
532 grid $rf.of.vb -row 0 -column 1 -sticky ns
533 grid $rf.of.hb -row 1 -column 0 -sticky ew
535 pack $rf.of -fill both -expand yes
538 ttk::frame .bistwin.bf
539 set data(widgets,filter) [ttk::menubutton .bistwin.bf.filter -text [msgcat::mc "Filter"] -width 12 -menu .bistwin.filterPopup]
540 set data(widgets,refresh) [ttk::button .bistwin.bf.refresh -style BButton -text [msgcat::mc "Refresh"] -width 7 -command [list bist::refresh]]
541 set data(widgets,run) [ttk::button .bistwin.bf.run -style BButton -text [msgcat::mc "Run"] -width 7 -command [list bist::run]]
542 set data(widgets,runtype) [ttk::menubutton .bistwin.bf.runtype -menu .bistwin.runPopup -state disabled]
545 ttk::label .bistwin.bf.l0 -text [
format "%s: " [msgcat::mc "Total"]]
546 set data(widgets,total) [ttk::label .bistwin.bf.tot -text "" -width 5]
547 ttk::label .bistwin.bf.l1 -text [
format "%s: " [msgcat::mc "Passed"]]
548 set data(widgets,pass) [ttk::label .bistwin.bf.pass -text "" -width 5]
549 ttk::label .bistwin.bf.l2 -text [
format "%s: " [msgcat::mc "Failed"]]
550 set data(widgets,fail) [ttk::label .bistwin.bf.fail -text "" -width 5]
552 pack .bistwin.bf.l0 -side left -padx 2 -pady 2
553 pack .bistwin.bf.tot -side left -padx 2 -pady 2
554 pack .bistwin.bf.l1 -side left -padx 2 -pady 2
555 pack .bistwin.bf.pass -side left -padx 2 -pady 2
556 pack .bistwin.bf.l2 -side left -padx 2 -pady 2
557 pack .bistwin.bf.fail -side left -padx 2 -pady 2
558 pack .bistwin.bf.runtype -side right -padx 2 -pady 2
559 pack .bistwin.bf.run -side right -padx 2 -pady 2
560 pack .bistwin.bf.refresh -side right -padx 2 -pady 2
561 pack .bistwin.bf.filter -side right -padx 2 -pady 2
564 pack .bistwin.nb -fill both -expand yes
565 pack .bistwin.bf -fill x
568 $data(widgets,output) tag configure passed -elide 0
569 $data(widgets,output) tag configure failed -elide 0
572 bind [$data(widgets,tbl) bodytag] <Button-1> [list bist::on_select %W %x %y]
575 menu .bistwin.filePopup -tearoff 0
576 .bistwin.filePopup add command -label [msgcat::mc "New Test File"] -command [list bist::create_file]
577 .bistwin.filePopup add command -label [msgcat::mc "New Test"] -command [list bist::create_test]
578 .bistwin.filePopup add separator
579 .bistwin.filePopup add command -label [msgcat::mc "Edit Test File"] -command [list bist::edit_file]
581 menu .bistwin.testPopup -tearoff 0
582 .bistwin.testPopup add command -label [msgcat::mc "Edit Test"] -command [list bist::edit_test]
584 menu .bistwin.filterPopup -tearoff 0
585 .bistwin.filterPopup add radiobutton -label [msgcat::mc "All"] -variable bist::data(filter) -value all -command [list bist::filter]
586 .bistwin.filterPopup add separator
587 .bistwin.filterPopup add radiobutton -label [msgcat::mc "Fail"] -variable bist::data(filter) -value fail -command [list bist::filter]
588 .bistwin.filterPopup add radiobutton -label [msgcat::mc "Pass"] -variable bist::data(filter) -value pass -command [list bist::filter]
590 menu .bistwin.runPopup -tearoff 0
591 .bistwin.runPopup add radiobutton -label [msgcat::mc "Selected"] -variable bist::data(runtype) -value selected
592 .bistwin.runPopup add radiobutton -label [msgcat::mc "Failed"] -variable bist::data(runtype) -value failed
595 wm protocol .bistwin WM_DELETE_WINDOW [list bist::on_destroy]