method

setup_ui

Importance_0
v1_8_6_287 - Show latest stable - 0 notes - Class: Test::Unit::UI::Tk::TestRunner
setup_ui() private

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/test/unit/ui/tk/testrunner.rb, line 170
          def setup_ui
            @status_entry = TkVariable.new
            l = TkLabel.new(nil, 'textvariable'=>@status_entry, 'relief'=>'sunken')
            l.pack('side'=>'bottom', 'fill'=>'x')

            suite_frame = TkFrame.new.pack('fill'=>'x')

            @run_button = TkButton.new(suite_frame, 'text'=>'Run')
            @run_button.pack('side'=>'right')

            TkLabel.new(suite_frame, 'text'=>'Suite:').pack('side'=>'left')
            @suite_name_entry = TkVariable.new
            l = TkLabel.new(suite_frame, 'textvariable'=>@suite_name_entry, 'relief'=>'sunken')
            l.pack('side'=>'left', 'fill'=>'x', 'expand'=>true)

            f = TkFrame.new(nil, 'relief'=>'sunken', 'borderwidth'=>3, 'height'=>20).pack('fill'=>'x', 'padx'=>1)
            @test_progress_bar = TkFrame.new(f, 'background'=>'green').place('anchor'=>'nw', 'relwidth'=>0.0, 'relheight'=>1.0)

            info_frame = TkFrame.new.pack('fill'=>'x')
            @test_count_label = create_count_label(info_frame, 'Tests:')
            @assertion_count_label = create_count_label(info_frame, 'Assertions:')
            @failure_count_label = create_count_label(info_frame, 'Failures:')
            @error_count_label = create_count_label(info_frame, 'Errors:')

            if (::Tk.info('command', TkPanedWindow::TkCommandNames[0]) != "")
              # use panedwindow
              paned_frame = TkPanedWindow.new("orient"=>"vertical").pack('fill'=>'both', 'expand'=>true)

              fault_list_frame = TkFrame.new(paned_frame)
              detail_frame = TkFrame.new(paned_frame)

              paned_frame.add(fault_list_frame, detail_frame)
            else
              # no panedwindow
              paned_frame = nil
              fault_list_frame = TkFrame.new.pack('fill'=>'both', 'expand'=>true)
              detail_frame = TkFrame.new.pack('fill'=>'both', 'expand'=>true)
            end

            TkGrid.rowconfigure(fault_list_frame, 0, 'weight'=>1, 'minsize'=>0)
            TkGrid.columnconfigure(fault_list_frame, 0, 'weight'=>1, 'minsize'=>0)

            fault_scrollbar_y = TkScrollbar.new(fault_list_frame)
            fault_scrollbar_x = TkScrollbar.new(fault_list_frame)
            @fault_list = TkListbox.new(fault_list_frame)
            @fault_list.yscrollbar(fault_scrollbar_y)
            @fault_list.xscrollbar(fault_scrollbar_x)

            TkGrid.rowconfigure(detail_frame, 0, 'weight'=>1, 'minsize'=>0)
            TkGrid.columnconfigure(detail_frame, 0, 'weight'=>1, 'minsize'=>0)

            ::Tk.grid(@fault_list, fault_scrollbar_y, 'sticky'=>'news')
            ::Tk.grid(fault_scrollbar_x, 'sticky'=>'news')

            detail_scrollbar_y = TkScrollbar.new(detail_frame)
            detail_scrollbar_x = TkScrollbar.new(detail_frame)
            @detail_text = TkText.new(detail_frame, 'height'=>10, 'wrap'=>'none') {
              bindtags(bindtags - [TkText])
            }
            @detail_text.yscrollbar(detail_scrollbar_y)
            @detail_text.xscrollbar(detail_scrollbar_x)

            ::Tk.grid(@detail_text, detail_scrollbar_y, 'sticky'=>'news')
            ::Tk.grid(detail_scrollbar_x, 'sticky'=>'news')

            # rubber-style pane
            if paned_frame
              ::Tk.update
              @height = paned_frame.winfo_height
              paned_frame.bind('Configure', proc{|h|
                paned_frame.sash_place(0, 0, paned_frame.sash_coord(0)[1] * h / @height)
                @height = h
              }, '%h')
            end
          end
Register or log in to add new notes.