1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/test/unit/**/*.rb: Removed :nodoc: directives (many were

generating warnings, many were on private methods).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
gsinclair 2004-05-16 04:16:39 +00:00
parent c62564616d
commit e4ac02cd8d
17 changed files with 150 additions and 177 deletions

View file

@ -1,3 +1,8 @@
Sun May 16 13:10:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* lib/test/unit/**/*.rb: Removed :nodoc: directives (many were
generating warnings, many were on private methods).
Sat May 15 01:41:34 2004 Yukihiro Matsumoto <matz@ruby-lang.org> Sat May 15 01:41:34 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (eval): forgot to restore $SAFE value before evaluating * eval.c (eval): forgot to restore $SAFE value before evaluating

View file

@ -1,5 +1,3 @@
# :nodoc:
#
# Author:: Nathaniel Talbott. # Author:: Nathaniel Talbott.
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
# License:: Ruby license. # License:: Ruby license.

View file

@ -1,5 +1,3 @@
# :nodoc:
#
# Author:: Nathaniel Talbott. # Author:: Nathaniel Talbott.
# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved. # Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
# License:: Ruby license. # License:: Ruby license.
@ -7,8 +5,8 @@
require 'test/unit/assertionfailederror' require 'test/unit/assertionfailederror'
require 'test/unit/util/backtracefilter' require 'test/unit/util/backtracefilter'
module Test # :nodoc: module Test
module Unit # :nodoc: module Unit
# Contains all of the standard Test::Unit assertions. Mixed in # Contains all of the standard Test::Unit assertions. Mixed in
# to Test::Unit::TestCase. To mix it in and use its # to Test::Unit::TestCase. To mix it in and use its
@ -341,13 +339,13 @@ EOT
end end
public public
def build_message(head, template=nil, *arguments) # :nodoc: def build_message(head, template=nil, *arguments)
template &&= template.chomp template &&= template.chomp
return AssertionMessage.new(head, template, arguments) return AssertionMessage.new(head, template, arguments)
end end
private private
def _wrap_assertion # :nodoc: def _wrap_assertion
@_assertion_wrapped ||= false @_assertion_wrapped ||= false
unless (@_assertion_wrapped) unless (@_assertion_wrapped)
@_assertion_wrapped = true @_assertion_wrapped = true
@ -375,7 +373,7 @@ EOT
AssertionMessage.use_pp = value AssertionMessage.use_pp = value
end end
class AssertionMessage # :nodoc: all class AssertionMessage all
@use_pp = true @use_pp = true
class << self class << self
attr_accessor :use_pp attr_accessor :use_pp

View file

@ -1,5 +1,3 @@
# :nodoc:
#
# Author:: Nathaniel Talbott. # Author:: Nathaniel Talbott.
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
# License:: Ruby license. # License:: Ruby license.

View file

@ -1,5 +1,3 @@
# :nodoc:
#
# Author:: Nathaniel Talbott. # Author:: Nathaniel Talbott.
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
# License:: Ruby license. # License:: Ruby license.

View file

@ -1,5 +1,3 @@
# :nodoc:
#
# Author:: Nathaniel Talbott. # Author:: Nathaniel Talbott.
# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved. # Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
# License:: Ruby license. # License:: Ruby license.
@ -109,22 +107,22 @@ module Test
end end
private :passed? private :passed?
def size # :nodoc: def size
1 1
end end
def add_assertion # :nodoc: def add_assertion
@_result.add_assertion @_result.add_assertion
end end
private :add_assertion private :add_assertion
def add_failure(message, all_locations=caller()) # :nodoc: def add_failure(message, all_locations=caller())
@test_passed = false @test_passed = false
@_result.add_failure(Failure.new(name, filter_backtrace(all_locations), message)) @_result.add_failure(Failure.new(name, filter_backtrace(all_locations), message))
end end
private :add_failure private :add_failure
def add_error(exception) # :nodoc: def add_error(exception)
@test_passed = false @test_passed = false
@_result.add_error(Error.new(name, exception)) @_result.add_error(Error.new(name, exception))
end end

View file

@ -1,5 +1,3 @@
# :nodoc:
#
# Author:: Nathaniel Talbott. # Author:: Nathaniel Talbott.
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
# License:: Ruby license. # License:: Ruby license.

View file

@ -1,5 +1,3 @@
# :nodoc:
#
# Author:: Nathaniel Talbott. # Author:: Nathaniel Talbott.
# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved. # Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
# License:: Ruby license. # License:: Ruby license.

View file

@ -1,5 +1,3 @@
# :nodoc:
#
# Author:: Nathaniel Talbott. # Author:: Nathaniel Talbott.
# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved. # Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
# License:: Ruby license. # License:: Ruby license.
@ -10,7 +8,7 @@ require 'test/unit/ui/testrunnerutilities'
module Test module Test
module Unit module Unit
module UI module UI
module Console # :nodoc: module Console
# Runs a Test::Unit::TestSuite on the console. # Runs a Test::Unit::TestSuite on the console.
class TestRunner class TestRunner
@ -42,7 +40,7 @@ module Test
end end
private private
def setup_mediator # :nodoc: def setup_mediator
@mediator = create_mediator(@suite) @mediator = create_mediator(@suite)
suite_name = @suite.to_s suite_name = @suite.to_s
if ( @suite.kind_of?(Module) ) if ( @suite.kind_of?(Module) )
@ -51,11 +49,11 @@ module Test
output("Loaded suite #{suite_name}") output("Loaded suite #{suite_name}")
end end
def create_mediator(suite) # :nodoc: def create_mediator(suite)
return TestRunnerMediator.new(suite) return TestRunnerMediator.new(suite)
end end
def attach_to_mediator # :nodoc: def attach_to_mediator
@mediator.add_listener(TestResult::FAULT, &method(:add_fault)) @mediator.add_listener(TestResult::FAULT, &method(:add_fault))
@mediator.add_listener(TestRunnerMediator::STARTED, &method(:started)) @mediator.add_listener(TestRunnerMediator::STARTED, &method(:started))
@mediator.add_listener(TestRunnerMediator::FINISHED, &method(:finished)) @mediator.add_listener(TestRunnerMediator::FINISHED, &method(:finished))
@ -63,11 +61,11 @@ module Test
@mediator.add_listener(TestCase::FINISHED, &method(:test_finished)) @mediator.add_listener(TestCase::FINISHED, &method(:test_finished))
end end
def start_mediator # :nodoc: def start_mediator
return @mediator.run_suite return @mediator.run_suite
end end
def add_fault(fault) # :nodoc: def add_fault(fault)
@faults << fault @faults << fault
output_single(fault.single_character_display, PROGRESS_ONLY) output_single(fault.single_character_display, PROGRESS_ONLY)
@already_outputted = true @already_outputted = true

View file

@ -1,5 +1,3 @@
# :nodoc:
#
# Author:: Nathaniel Talbott. # Author:: Nathaniel Talbott.
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
# License:: Ruby license. # License:: Ruby license.
@ -13,7 +11,7 @@ include Fox
module Test module Test
module Unit module Unit
module UI module UI
module Fox # :nodoc: module Fox
# Runs a Test::Unit::TestSuite in a Fox UI. Obviously, # Runs a Test::Unit::TestSuite in a Fox UI. Obviously,
# this one requires you to have Fox # this one requires you to have Fox
@ -49,7 +47,7 @@ module Test
@result @result
end end
def setup_mediator # :nodoc: def setup_mediator
@mediator = TestRunnerMediator.new(@suite) @mediator = TestRunnerMediator.new(@suite)
suite_name = @suite.to_s suite_name = @suite.to_s
if ( @suite.kind_of?(Module) ) if ( @suite.kind_of?(Module) )
@ -58,7 +56,7 @@ module Test
@suite_name_entry.text = suite_name @suite_name_entry.text = suite_name
end end
def attach_to_mediator # :nodoc: def attach_to_mediator
@mediator.add_listener(TestRunnerMediator::RESET, &method(:reset_ui)) @mediator.add_listener(TestRunnerMediator::RESET, &method(:reset_ui))
@mediator.add_listener(TestResult::FAULT, &method(:add_fault)) @mediator.add_listener(TestResult::FAULT, &method(:add_fault))
@mediator.add_listener(TestResult::CHANGED, &method(:result_changed)) @mediator.add_listener(TestResult::CHANGED, &method(:result_changed))
@ -67,7 +65,7 @@ module Test
@mediator.add_listener(TestRunnerMediator::FINISHED, &method(:finished)) @mediator.add_listener(TestRunnerMediator::FINISHED, &method(:finished))
end end
def start_ui # :nodoc: def start_ui
@application.create @application.create
@window.show(PLACEMENT_SCREEN) @window.show(PLACEMENT_SCREEN)
@application.addTimeout(1) do @application.addTimeout(1) do
@ -76,11 +74,11 @@ module Test
@application.run @application.run
end end
def stop # :nodoc: def stop
@application.exit(0) @application.exit(0)
end end
def reset_ui(count) # :nodoc: def reset_ui(count)
@test_progress_bar.barColor = GREEN_STYLE @test_progress_bar.barColor = GREEN_STYLE
@test_progress_bar.total = count @test_progress_bar.total = count
@test_progress_bar.progress = 0 @test_progress_bar.progress = 0
@ -94,7 +92,7 @@ module Test
@fault_list.clearItems @fault_list.clearItems
end end
def add_fault(fault) # :nodoc: def add_fault(fault)
if ( ! @red ) if ( ! @red )
@test_progress_bar.barColor = RED_STYLE @test_progress_bar.barColor = RED_STYLE
@red = true @red = true
@ -103,19 +101,19 @@ module Test
@fault_list.appendItem(item) @fault_list.appendItem(item)
end end
def show_fault(fault) # :nodoc: def show_fault(fault)
raw_show_fault(fault.long_display) raw_show_fault(fault.long_display)
end end
def raw_show_fault(string) # :nodoc: def raw_show_fault(string)
@detail_text.setText(string) @detail_text.setText(string)
end end
def clear_fault # :nodoc: def clear_fault
raw_show_fault("") raw_show_fault("")
end end
def result_changed(result) # :nodoc: def result_changed(result)
@test_progress_bar.progress = result.run_count @test_progress_bar.progress = result.run_count
@test_count_label.text = result.run_count.to_s @test_count_label.text = result.run_count.to_s
@ -128,7 +126,7 @@ module Test
@application.flush @application.flush
end end
def started(result) # :nodoc: def started(result)
@result = result @result = result
output_status("Started...") output_status("Started...")
end end
@ -146,7 +144,7 @@ module Test
@status_entry.repaint @status_entry.repaint
end end
def setup_ui # :nodoc: def setup_ui
@application = create_application @application = create_application
create_tooltip(@application) create_tooltip(@application)
@ -180,7 +178,7 @@ module Test
@detail_text = create_text(detail_panel) @detail_text = create_text(detail_panel)
end end
def create_application # :nodoc: def create_application
app = FXApp.new("TestRunner", "Test::Unit") app = FXApp.new("TestRunner", "Test::Unit")
app.init([]) app.init([])
app app
@ -194,25 +192,25 @@ module Test
FXTooltip.new(app) FXTooltip.new(app)
end end
def create_main_panel(parent) # :nodoc: def create_main_panel(parent)
panel = FXVerticalFrame.new(parent, LAYOUT_FILL_X | LAYOUT_FILL_Y) panel = FXVerticalFrame.new(parent, LAYOUT_FILL_X | LAYOUT_FILL_Y)
panel.vSpacing = 10 panel.vSpacing = 10
panel panel
end end
def create_suite_panel(parent) # :nodoc: def create_suite_panel(parent)
FXHorizontalFrame.new(parent, LAYOUT_SIDE_LEFT | LAYOUT_FILL_X) FXHorizontalFrame.new(parent, LAYOUT_SIDE_LEFT | LAYOUT_FILL_X)
end end
def create_button(parent, text, action) # :nodoc: def create_button(parent, text, action)
FXButton.new(parent, text).connect(SEL_COMMAND, &action) FXButton.new(parent, text).connect(SEL_COMMAND, &action)
end end
def create_progress_bar(parent) # :nodoc: def create_progress_bar(parent)
FXProgressBar.new(parent, nil, 0, PROGRESSBAR_NORMAL | LAYOUT_FILL_X) FXProgressBar.new(parent, nil, 0, PROGRESSBAR_NORMAL | LAYOUT_FILL_X)
end end
def create_info_panel(parent) # :nodoc: def create_info_panel(parent)
FXMatrix.new(parent, 1, MATRIX_BY_ROWS | LAYOUT_FILL_X) FXMatrix.new(parent, 1, MATRIX_BY_ROWS | LAYOUT_FILL_X)
end end
@ -220,11 +218,11 @@ module Test
FXLabel.new(parent, text, nil, JUSTIFY_CENTER_X | LAYOUT_FILL_COLUMN) FXLabel.new(parent, text, nil, JUSTIFY_CENTER_X | LAYOUT_FILL_COLUMN)
end end
def create_list_panel(parent) # :nodoc: def create_list_panel(parent)
FXHorizontalFrame.new(parent, LAYOUT_FILL_X | FRAME_SUNKEN | FRAME_THICK) FXHorizontalFrame.new(parent, LAYOUT_FILL_X | FRAME_SUNKEN | FRAME_THICK)
end end
def create_fault_list(parent) # :nodoc: def create_fault_list(parent)
list = FXList.new(parent, 10, nil, 0, LIST_SINGLESELECT | LAYOUT_FILL_X) #, 0, 0, 0, 150) list = FXList.new(parent, 10, nil, 0, LIST_SINGLESELECT | LAYOUT_FILL_X) #, 0, 0, 0, 150)
list.connect(SEL_COMMAND) do |sender, sel, ptr| list.connect(SEL_COMMAND) do |sender, sel, ptr|
if sender.retrieveItem(sender.currentItem).selected? if sender.retrieveItem(sender.currentItem).selected?
@ -236,22 +234,22 @@ module Test
list list
end end
def create_detail_panel(parent) # :nodoc: def create_detail_panel(parent)
FXHorizontalFrame.new(parent, LAYOUT_FILL_X | LAYOUT_FILL_Y | FRAME_SUNKEN | FRAME_THICK) FXHorizontalFrame.new(parent, LAYOUT_FILL_X | LAYOUT_FILL_Y | FRAME_SUNKEN | FRAME_THICK)
end end
def create_text(parent) # :nodoc: def create_text(parent)
FXText.new(parent, nil, 0, TEXT_READONLY | LAYOUT_FILL_X | LAYOUT_FILL_Y) FXText.new(parent, nil, 0, TEXT_READONLY | LAYOUT_FILL_X | LAYOUT_FILL_Y)
end end
def create_entry(parent) # :nodoc: def create_entry(parent)
entry = FXTextField.new(parent, 30, nil, 0, TEXTFIELD_NORMAL | LAYOUT_SIDE_BOTTOM | LAYOUT_FILL_X) entry = FXTextField.new(parent, 30, nil, 0, TEXTFIELD_NORMAL | LAYOUT_SIDE_BOTTOM | LAYOUT_FILL_X)
entry.disable entry.disable
entry entry
end end
end end
class FaultListItem < FXListItem # :nodoc: all class FaultListItem < FXListItem all
attr_reader(:fault) attr_reader(:fault)
def initialize(fault) def initialize(fault)
super(fault.short_display) super(fault.short_display)

View file

@ -1,5 +1,3 @@
# :nodoc:
#
# Author:: Nathaniel Talbott. # Author:: Nathaniel Talbott.
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
# License:: Ruby license. # License:: Ruby license.
@ -11,7 +9,7 @@ require 'test/unit/ui/testrunnerutilities'
module Test module Test
module Unit module Unit
module UI module UI
module GTK # :nodoc: module GTK
# Runs a Test::Unit::TestSuite in a Gtk UI. Obviously, # Runs a Test::Unit::TestSuite in a Gtk UI. Obviously,
# this one requires you to have Gtk # this one requires you to have Gtk
@ -49,7 +47,7 @@ module Test
end end
private private
def setup_mediator # :nodoc: def setup_mediator
@mediator = TestRunnerMediator.new(@suite) @mediator = TestRunnerMediator.new(@suite)
suite_name = @suite.to_s suite_name = @suite.to_s
if ( @suite.kind_of?(Module) ) if ( @suite.kind_of?(Module) )
@ -58,7 +56,7 @@ module Test
suite_name_entry.set_text(suite_name) suite_name_entry.set_text(suite_name)
end end
def attach_to_mediator # :nodoc: def attach_to_mediator
run_button.signal_connect("clicked", nil, &method(:run_test)) run_button.signal_connect("clicked", nil, &method(:run_test))
@mediator.add_listener(TestRunnerMediator::RESET, &method(:reset_ui)) @mediator.add_listener(TestRunnerMediator::RESET, &method(:reset_ui))
@mediator.add_listener(TestResult::FAULT, &method(:add_fault)) @mediator.add_listener(TestResult::FAULT, &method(:add_fault))
@ -73,7 +71,7 @@ module Test
@runner.raise(@restart_signal) @runner.raise(@restart_signal)
end end
def start_ui # :nodoc: def start_ui
@viewer.run @viewer.run
running = false running = false
begin begin
@ -93,11 +91,11 @@ module Test
end end
end end
def stop(*) # :nodoc: def stop(*)
Gtk.main_quit Gtk.main_quit
end end
def reset_ui(count) # :nodoc: def reset_ui(count)
test_progress_bar.set_style(green_style) test_progress_bar.set_style(green_style)
test_progress_bar.configure(0, 0, count) test_progress_bar.configure(0, 0, count)
@red = false @red = false
@ -110,7 +108,7 @@ module Test
fault_list.remove_items(fault_list.children) fault_list.remove_items(fault_list.children)
end end
def add_fault(fault) # :nodoc: def add_fault(fault)
if ( ! @red ) if ( ! @red )
test_progress_bar.set_style(red_style) test_progress_bar.set_style(red_style)
@red = true @red = true
@ -120,27 +118,27 @@ module Test
fault_list.append_items([item]) fault_list.append_items([item])
end end
def show_fault(fault) # :nodoc: def show_fault(fault)
raw_show_fault(fault.long_display) raw_show_fault(fault.long_display)
end end
def raw_show_fault(string) # :nodoc: def raw_show_fault(string)
fault_detail_label.set_text(string) fault_detail_label.set_text(string)
outer_detail_sub_panel.queue_resize outer_detail_sub_panel.queue_resize
end end
def clear_fault # :nodoc: def clear_fault
raw_show_fault("") raw_show_fault("")
end end
def result_changed(result) # :nodoc: def result_changed(result)
run_count_label.set_text(result.run_count.to_s) run_count_label.set_text(result.run_count.to_s)
assertion_count_label.set_text(result.assertion_count.to_s) assertion_count_label.set_text(result.assertion_count.to_s)
failure_count_label.set_text(result.failure_count.to_s) failure_count_label.set_text(result.failure_count.to_s)
error_count_label.set_text(result.error_count.to_s) error_count_label.set_text(result.error_count.to_s)
end end
def started(result) # :nodoc: def started(result)
@result = result @result = result
output_status("Started...") output_status("Started...")
end end
@ -157,11 +155,11 @@ module Test
output_status("Finished in #{elapsed_time} seconds") output_status("Finished in #{elapsed_time} seconds")
end end
def output_status(string) # :nodoc: def output_status(string)
status_entry.set_text(string) status_entry.set_text(string)
end end
def setup_ui # :nodoc: def setup_ui
main_window.signal_connect("destroy", nil, &method(:stop)) main_window.signal_connect("destroy", nil, &method(:stop))
main_window.show_all main_window.show_all
fault_list.signal_connect("select-child", nil) { fault_list.signal_connect("select-child", nil) {
@ -174,7 +172,7 @@ module Test
@red = false @red = false
end end
def main_window # :nodoc: def main_window
lazy_initialize(:main_window) { lazy_initialize(:main_window) {
@main_window = Gtk::Window.new(Gtk::WINDOW_TOPLEVEL) @main_window = Gtk::Window.new(Gtk::WINDOW_TOPLEVEL)
@main_window.set_title("Test::Unit TestRunner") @main_window.set_title("Test::Unit TestRunner")
@ -185,7 +183,7 @@ module Test
} }
end end
def main_panel # :nodoc: def main_panel
lazy_initialize(:main_panel) { lazy_initialize(:main_panel) {
@main_panel = Gtk::VBox.new(false, 0) @main_panel = Gtk::VBox.new(false, 0)
@main_panel.pack_start(suite_panel, false, false, 0) @main_panel.pack_start(suite_panel, false, false, 0)
@ -197,7 +195,7 @@ module Test
} }
end end
def suite_panel # :nodoc: def suite_panel
lazy_initialize(:suite_panel) { lazy_initialize(:suite_panel) {
@suite_panel = Gtk::HBox.new(false, 10) @suite_panel = Gtk::HBox.new(false, 10)
@suite_panel.border_width(10) @suite_panel.border_width(10)
@ -207,20 +205,20 @@ module Test
} }
end end
def suite_name_entry # :nodoc: def suite_name_entry
lazy_initialize(:suite_name_entry) { lazy_initialize(:suite_name_entry) {
@suite_name_entry = Gtk::Entry.new @suite_name_entry = Gtk::Entry.new
@suite_name_entry.set_editable(false) @suite_name_entry.set_editable(false)
} }
end end
def run_button # :nodoc: def run_button
lazy_initialize(:run_button) { lazy_initialize(:run_button) {
@run_button = Gtk::Button.new("Run") @run_button = Gtk::Button.new("Run")
} }
end end
def progress_panel # :nodoc: def progress_panel
lazy_initialize(:progress_panel) { lazy_initialize(:progress_panel) {
@progress_panel = Gtk::HBox.new(false, 10) @progress_panel = Gtk::HBox.new(false, 10)
@progress_panel.border_width(10) @progress_panel.border_width(10)
@ -228,7 +226,7 @@ module Test
} }
end end
def test_progress_bar # :nodoc: def test_progress_bar
lazy_initialize(:test_progress_bar) { lazy_initialize(:test_progress_bar) {
@test_progress_bar = EnhancedProgressBar.new @test_progress_bar = EnhancedProgressBar.new
@test_progress_bar.set_usize(@test_progress_bar.allocation.width, @test_progress_bar.set_usize(@test_progress_bar.allocation.width,
@ -237,21 +235,21 @@ module Test
} }
end end
def green_style # :nodoc: def green_style
lazy_initialize(:green_style) { lazy_initialize(:green_style) {
@green_style = Gtk::Style.new @green_style = Gtk::Style.new
@green_style.set_bg(Gtk::STATE_PRELIGHT, 0x0000, 0xFFFF, 0x0000) @green_style.set_bg(Gtk::STATE_PRELIGHT, 0x0000, 0xFFFF, 0x0000)
} }
end end
def red_style # :nodoc: def red_style
lazy_initialize(:red_style) { lazy_initialize(:red_style) {
@red_style = Gtk::Style.new @red_style = Gtk::Style.new
@red_style.set_bg(Gtk::STATE_PRELIGHT, 0xFFFF, 0x0000, 0x0000) @red_style.set_bg(Gtk::STATE_PRELIGHT, 0xFFFF, 0x0000, 0x0000)
} }
end end
def info_panel # :nodoc: def info_panel
lazy_initialize(:info_panel) { lazy_initialize(:info_panel) {
@info_panel = Gtk::HBox.new(false, 0) @info_panel = Gtk::HBox.new(false, 0)
@info_panel.border_width(10) @info_panel.border_width(10)
@ -266,35 +264,35 @@ module Test
} }
end end
def run_count_label # :nodoc: def run_count_label
lazy_initialize(:run_count_label) { lazy_initialize(:run_count_label) {
@run_count_label = Gtk::Label.new("0") @run_count_label = Gtk::Label.new("0")
@run_count_label.set_justify(Gtk::JUSTIFY_LEFT) @run_count_label.set_justify(Gtk::JUSTIFY_LEFT)
} }
end end
def assertion_count_label # :nodoc: def assertion_count_label
lazy_initialize(:assertion_count_label) { lazy_initialize(:assertion_count_label) {
@assertion_count_label = Gtk::Label.new("0") @assertion_count_label = Gtk::Label.new("0")
@assertion_count_label.set_justify(Gtk::JUSTIFY_LEFT) @assertion_count_label.set_justify(Gtk::JUSTIFY_LEFT)
} }
end end
def failure_count_label # :nodoc: def failure_count_label
lazy_initialize(:failure_count_label) { lazy_initialize(:failure_count_label) {
@failure_count_label = Gtk::Label.new("0") @failure_count_label = Gtk::Label.new("0")
@failure_count_label.set_justify(Gtk::JUSTIFY_LEFT) @failure_count_label.set_justify(Gtk::JUSTIFY_LEFT)
} }
end end
def error_count_label # :nodoc: def error_count_label
lazy_initialize(:error_count_label) { lazy_initialize(:error_count_label) {
@error_count_label = Gtk::Label.new("0") @error_count_label = Gtk::Label.new("0")
@error_count_label.set_justify(Gtk::JUSTIFY_LEFT) @error_count_label.set_justify(Gtk::JUSTIFY_LEFT)
} }
end end
def list_panel # :nodoc: def list_panel
lazy_initialize(:list_panel) { lazy_initialize(:list_panel) {
@list_panel = Gtk::HBox.new @list_panel = Gtk::HBox.new
@list_panel.border_width(10) @list_panel.border_width(10)
@ -302,7 +300,7 @@ module Test
} }
end end
def list_scrolled_window # :nodoc: def list_scrolled_window
lazy_initialize(:list_scrolled_window) { lazy_initialize(:list_scrolled_window) {
@list_scrolled_window = Gtk::ScrolledWindow.new @list_scrolled_window = Gtk::ScrolledWindow.new
@list_scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) @list_scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
@ -311,13 +309,13 @@ module Test
} }
end end
def fault_list # :nodoc: def fault_list
lazy_initialize(:fault_list) { lazy_initialize(:fault_list) {
@fault_list = Gtk::List.new @fault_list = Gtk::List.new
} }
end end
def detail_panel # :nodoc: def detail_panel
lazy_initialize(:detail_panel) { lazy_initialize(:detail_panel) {
@detail_panel = Gtk::HBox.new @detail_panel = Gtk::HBox.new
@detail_panel.border_width(10) @detail_panel.border_width(10)
@ -325,7 +323,7 @@ module Test
} }
end end
def detail_scrolled_window # :nodoc: def detail_scrolled_window
lazy_initialize(:detail_scrolled_window) { lazy_initialize(:detail_scrolled_window) {
@detail_scrolled_window = Gtk::ScrolledWindow.new @detail_scrolled_window = Gtk::ScrolledWindow.new
@detail_scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) @detail_scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
@ -334,21 +332,21 @@ module Test
} }
end end
def outer_detail_sub_panel # :nodoc: def outer_detail_sub_panel
lazy_initialize(:outer_detail_sub_panel) { lazy_initialize(:outer_detail_sub_panel) {
@outer_detail_sub_panel = Gtk::VBox.new @outer_detail_sub_panel = Gtk::VBox.new
@outer_detail_sub_panel.pack_start(inner_detail_sub_panel, false, false, 0) @outer_detail_sub_panel.pack_start(inner_detail_sub_panel, false, false, 0)
} }
end end
def inner_detail_sub_panel # :nodoc: def inner_detail_sub_panel
lazy_initialize(:inner_detail_sub_panel) { lazy_initialize(:inner_detail_sub_panel) {
@inner_detail_sub_panel = Gtk::HBox.new @inner_detail_sub_panel = Gtk::HBox.new
@inner_detail_sub_panel.pack_start(fault_detail_label, false, false, 0) @inner_detail_sub_panel.pack_start(fault_detail_label, false, false, 0)
} }
end end
def fault_detail_label # :nodoc: def fault_detail_label
lazy_initialize(:fault_detail_label) { lazy_initialize(:fault_detail_label) {
@fault_detail_label = EnhancedLabel.new("") @fault_detail_label = EnhancedLabel.new("")
style = Gtk::Style.new style = Gtk::Style.new
@ -362,7 +360,7 @@ module Test
} }
end end
def status_panel # :nodoc: def status_panel
lazy_initialize(:status_panel) { lazy_initialize(:status_panel) {
@status_panel = Gtk::HBox.new @status_panel = Gtk::HBox.new
@status_panel.border_width(10) @status_panel.border_width(10)
@ -370,14 +368,14 @@ module Test
} }
end end
def status_entry # :nodoc: def status_entry
lazy_initialize(:status_entry) { lazy_initialize(:status_entry) {
@status_entry = Gtk::Entry.new @status_entry = Gtk::Entry.new
@status_entry.set_editable(false) @status_entry.set_editable(false)
} }
end end
def lazy_initialize(symbol) # :nodoc: def lazy_initialize(symbol)
if (!instance_eval("defined?(@#{symbol.to_s})")) if (!instance_eval("defined?(@#{symbol.to_s})"))
yield yield
end end
@ -385,7 +383,7 @@ module Test
end end
end end
class EnhancedProgressBar < Gtk::ProgressBar # :nodoc: all class EnhancedProgressBar < Gtk::ProgressBar all
def set_style(style) def set_style(style)
super super
hide hide
@ -393,13 +391,13 @@ module Test
end end
end end
class EnhancedLabel < Gtk::Label # :nodoc: all class EnhancedLabel < Gtk::Label all
def set_text(text) def set_text(text)
super(text.gsub(/\n\t/, "\n" + (" " * 4))) super(text.gsub(/\n\t/, "\n" + (" " * 4)))
end end
end end
class FaultListItem < Gtk::ListItem # :nodoc: all class FaultListItem < Gtk::ListItem all
attr_reader(:fault) attr_reader(:fault)
def initialize(fault) def initialize(fault)
super(fault.short_display) super(fault.short_display)

View file

@ -1,5 +1,3 @@
# :nodoc:
#
# Author:: Kenta MURATA. # Author:: Kenta MURATA.
# Copyright:: Copyright (c) 2000-2002 Kenta MURATA. All rights reserved. # Copyright:: Copyright (c) 2000-2002 Kenta MURATA. All rights reserved.
# License:: Ruby license. # License:: Ruby license.
@ -11,17 +9,17 @@ require "test/unit/ui/testrunnerutilities"
module Test module Test
module Unit module Unit
module UI module UI
module GTK2 # :nodoc: all module GTK2 all
Gtk.init Gtk.init
class EnhancedLabel < Gtk::Label # :nodoc: all class EnhancedLabel < Gtk::Label all
def set_text(text) def set_text(text)
super(text.gsub(/\n\t/, "\n ")) super(text.gsub(/\n\t/, "\n "))
end end
end end
class FaultList < Gtk::TreeView # :nodoc: all class FaultList < Gtk::TreeView all
def initialize def initialize
@faults = [] @faults = []
@model = Gtk::ListStore.new(String, String) @model = Gtk::ListStore.new(String, String)
@ -56,7 +54,7 @@ module Test
class TestRunner class TestRunner
extend TestRunnerUtilities extend TestRunnerUtilities
def lazy_initialize(symbol) # :nodoc: def lazy_initialize(symbol)
if !instance_eval("defined?(@#{symbol})") then if !instance_eval("defined?(@#{symbol})") then
yield yield
end end
@ -64,7 +62,7 @@ module Test
end end
private :lazy_initialize private :lazy_initialize
def status_entry # :nodoc: def status_entry
lazy_initialize(:status_entry) do lazy_initialize(:status_entry) do
@status_entry = Gtk::Entry.new @status_entry = Gtk::Entry.new
@status_entry.editable = false @status_entry.editable = false
@ -72,7 +70,7 @@ module Test
end end
private :status_entry private :status_entry
def status_panel # :nodoc: def status_panel
lazy_initialize(:status_panel) do lazy_initialize(:status_panel) do
@status_panel = Gtk::HBox.new @status_panel = Gtk::HBox.new
@status_panel.border_width = 10 @status_panel.border_width = 10
@ -81,7 +79,7 @@ module Test
end end
private :status_panel private :status_panel
def fault_detail_label # :nodoc: def fault_detail_label
lazy_initialize(:fault_detail_label) do lazy_initialize(:fault_detail_label) do
@fault_detail_label = EnhancedLabel.new("") @fault_detail_label = EnhancedLabel.new("")
# style = Gtk::Style.new # style = Gtk::Style.new
@ -95,7 +93,7 @@ module Test
end end
private :fault_detail_label private :fault_detail_label
def inner_detail_sub_panel # :nodoc: def inner_detail_sub_panel
lazy_initialize(:inner_detail_sub_panel) do lazy_initialize(:inner_detail_sub_panel) do
@inner_detail_sub_panel = Gtk::HBox.new @inner_detail_sub_panel = Gtk::HBox.new
@inner_detail_sub_panel.pack_start(fault_detail_label, false, false, 0) @inner_detail_sub_panel.pack_start(fault_detail_label, false, false, 0)
@ -103,7 +101,7 @@ module Test
end end
private :inner_detail_sub_panel private :inner_detail_sub_panel
def outer_detail_sub_panel # :nodoc: def outer_detail_sub_panel
lazy_initialize(:outer_detail_sub_panel) do lazy_initialize(:outer_detail_sub_panel) do
@outer_detail_sub_panel = Gtk::VBox.new @outer_detail_sub_panel = Gtk::VBox.new
@outer_detail_sub_panel.pack_start(inner_detail_sub_panel, false, false, 0) @outer_detail_sub_panel.pack_start(inner_detail_sub_panel, false, false, 0)
@ -111,7 +109,7 @@ module Test
end end
private :outer_detail_sub_panel private :outer_detail_sub_panel
def detail_scrolled_window # :nodoc: def detail_scrolled_window
lazy_initialize(:detail_scrolled_window) do lazy_initialize(:detail_scrolled_window) do
@detail_scrolled_window = Gtk::ScrolledWindow.new @detail_scrolled_window = Gtk::ScrolledWindow.new
@detail_scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) @detail_scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
@ -122,7 +120,7 @@ module Test
end end
private :detail_scrolled_window private :detail_scrolled_window
def detail_panel # :nodoc: def detail_panel
lazy_initialize(:detail_panel) do lazy_initialize(:detail_panel) do
@detail_panel = Gtk::HBox.new @detail_panel = Gtk::HBox.new
@detail_panel.border_width = 10 @detail_panel.border_width = 10
@ -131,14 +129,14 @@ module Test
end end
private :detail_panel private :detail_panel
def fault_list # :nodoc: def fault_list
lazy_initialize(:fault_list) do lazy_initialize(:fault_list) do
@fault_list = FaultList.new @fault_list = FaultList.new
end end
end end
private :fault_list private :fault_list
def list_scrolled_window # :nodoc: def list_scrolled_window
lazy_initialize(:list_scrolled_window) do lazy_initialize(:list_scrolled_window) do
@list_scrolled_window = Gtk::ScrolledWindow.new @list_scrolled_window = Gtk::ScrolledWindow.new
@list_scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) @list_scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
@ -149,7 +147,7 @@ module Test
end end
private :list_scrolled_window private :list_scrolled_window
def list_panel # :nodoc: def list_panel
lazy_initialize(:list_panel) do lazy_initialize(:list_panel) do
@list_panel = Gtk::HBox.new @list_panel = Gtk::HBox.new
@list_panel.border_width = 10 @list_panel.border_width = 10
@ -158,7 +156,7 @@ module Test
end end
private :list_panel private :list_panel
def error_count_label # :nodoc: def error_count_label
lazy_initialize(:error_count_label) do lazy_initialize(:error_count_label) do
@error_count_label = Gtk::Label.new("0") @error_count_label = Gtk::Label.new("0")
@error_count_label.justify = Gtk::JUSTIFY_LEFT @error_count_label.justify = Gtk::JUSTIFY_LEFT
@ -166,7 +164,7 @@ module Test
end end
private :error_count_label private :error_count_label
def failure_count_label # :nodoc: def failure_count_label
lazy_initialize(:failure_count_label) do lazy_initialize(:failure_count_label) do
@failure_count_label = Gtk::Label.new("0") @failure_count_label = Gtk::Label.new("0")
@failure_count_label.justify = Gtk::JUSTIFY_LEFT @failure_count_label.justify = Gtk::JUSTIFY_LEFT
@ -174,7 +172,7 @@ module Test
end end
private :failure_count_label private :failure_count_label
def assertion_count_label # :nodoc: def assertion_count_label
lazy_initialize(:assertion_count_label) do lazy_initialize(:assertion_count_label) do
@assertion_count_label = Gtk::Label.new("0") @assertion_count_label = Gtk::Label.new("0")
@assertion_count_label.justify = Gtk::JUSTIFY_LEFT @assertion_count_label.justify = Gtk::JUSTIFY_LEFT
@ -182,7 +180,7 @@ module Test
end end
private :assertion_count_label private :assertion_count_label
def run_count_label # :nodoc: def run_count_label
lazy_initialize(:run_count_label) do lazy_initialize(:run_count_label) do
@run_count_label = Gtk::Label.new("0") @run_count_label = Gtk::Label.new("0")
@run_count_label.justify = Gtk::JUSTIFY_LEFT @run_count_label.justify = Gtk::JUSTIFY_LEFT
@ -190,7 +188,7 @@ module Test
end end
private :run_count_label private :run_count_label
def info_panel # :nodoc: def info_panel
lazy_initialize(:info_panel) do lazy_initialize(:info_panel) do
@info_panel = Gtk::HBox.new(false, 0) @info_panel = Gtk::HBox.new(false, 0)
@info_panel.border_width = 10 @info_panel.border_width = 10
@ -206,7 +204,7 @@ module Test
end # def info_panel end # def info_panel
private :info_panel private :info_panel
def green_style # :nodoc: def green_style
lazy_initialize(:green_style) do lazy_initialize(:green_style) do
@green_style = Gtk::Style.new @green_style = Gtk::Style.new
@green_style.set_bg(Gtk::STATE_PRELIGHT, 0x0000, 0xFFFF, 0x0000) @green_style.set_bg(Gtk::STATE_PRELIGHT, 0x0000, 0xFFFF, 0x0000)
@ -214,7 +212,7 @@ module Test
end # def green_style end # def green_style
private :green_style private :green_style
def red_style # :nodoc: def red_style
lazy_initialize(:red_style) do lazy_initialize(:red_style) do
@red_style = Gtk::Style.new @red_style = Gtk::Style.new
@red_style.set_bg(Gtk::STATE_PRELIGHT, 0xFFFF, 0x0000, 0x0000) @red_style.set_bg(Gtk::STATE_PRELIGHT, 0xFFFF, 0x0000, 0x0000)
@ -222,7 +220,7 @@ module Test
end # def red_style end # def red_style
private :red_style private :red_style
def test_progress_bar # :nodoc: def test_progress_bar
lazy_initialize(:test_progress_bar) { lazy_initialize(:test_progress_bar) {
@test_progress_bar = Gtk::ProgressBar.new @test_progress_bar = Gtk::ProgressBar.new
@test_progress_bar.fraction = 0.0 @test_progress_bar.fraction = 0.0
@ -234,7 +232,7 @@ module Test
end # def test_progress_bar end # def test_progress_bar
private :test_progress_bar private :test_progress_bar
def progress_panel # :nodoc: def progress_panel
lazy_initialize(:progress_panel) do lazy_initialize(:progress_panel) do
@progress_panel = Gtk::HBox.new(false, 10) @progress_panel = Gtk::HBox.new(false, 10)
@progress_panel.border_width = 10 @progress_panel.border_width = 10
@ -242,13 +240,13 @@ module Test
end end
end # def progress_panel end # def progress_panel
def run_button # :nodoc: def run_button
lazy_initialize(:run_button) do lazy_initialize(:run_button) do
@run_button = Gtk::Button.new("Run") @run_button = Gtk::Button.new("Run")
end end
end # def run_button end # def run_button
def suite_name_entry # :nodoc: def suite_name_entry
lazy_initialize(:suite_name_entry) do lazy_initialize(:suite_name_entry) do
@suite_name_entry = Gtk::Entry.new @suite_name_entry = Gtk::Entry.new
@suite_name_entry.editable = false @suite_name_entry.editable = false
@ -256,7 +254,7 @@ module Test
end # def suite_name_entry end # def suite_name_entry
private :suite_name_entry private :suite_name_entry
def suite_panel # :nodoc: def suite_panel
lazy_initialize(:suite_panel) do lazy_initialize(:suite_panel) do
@suite_panel = Gtk::HBox.new(false, 10) @suite_panel = Gtk::HBox.new(false, 10)
@suite_panel.border_width = 10 @suite_panel.border_width = 10
@ -267,7 +265,7 @@ module Test
end # def suite_panel end # def suite_panel
private :suite_panel private :suite_panel
def main_panel # :nodoc: def main_panel
lazy_initialize(:main_panel) do lazy_initialize(:main_panel) do
@main_panel = Gtk::VBox.new(false, 0) @main_panel = Gtk::VBox.new(false, 0)
@main_panel.pack_start(suite_panel, false, false, 0) @main_panel.pack_start(suite_panel, false, false, 0)
@ -280,7 +278,7 @@ module Test
end # def main_panel end # def main_panel
private :main_panel private :main_panel
def main_window # :nodoc: def main_window
lazy_initialize(:main_window) do lazy_initialize(:main_window) do
@main_window = Gtk::Window.new(Gtk::Window::TOPLEVEL) @main_window = Gtk::Window.new(Gtk::Window::TOPLEVEL)
@main_window.set_title("Test::Unit TestRunner") @main_window.set_title("Test::Unit TestRunner")
@ -291,7 +289,7 @@ module Test
end # def main_window end # def main_window
private :main_window private :main_window
def setup_ui # :nodoc: def setup_ui
main_window.signal_connect("destroy", nil) { stop } main_window.signal_connect("destroy", nil) { stop }
main_window.show_all main_window.show_all
fault_list.selection.signal_connect("changed", nil) do fault_list.selection.signal_connect("changed", nil) do
@ -305,33 +303,33 @@ module Test
end # def setup_ui end # def setup_ui
private :setup_ui private :setup_ui
def output_status(string) # :nodoc: def output_status(string)
status_entry.set_text(string) status_entry.set_text(string)
end # def output_status(string) end # def output_status(string)
private :output_status private :output_status
def finished(elapsed_time) # :nodoc: def finished(elapsed_time)
test_progress_bar.fraction = 1.0 test_progress_bar.fraction = 1.0
output_status("Finished in #{elapsed_time} seconds") output_status("Finished in #{elapsed_time} seconds")
end # def finished(elapsed_time) end # def finished(elapsed_time)
private :finished private :finished
def test_started(test_name) # :nodoc: def test_started(test_name)
output_status("Running #{test_name}...") output_status("Running #{test_name}...")
end # def test_started(test_name) end # def test_started(test_name)
private :test_started private :test_started
def started(result) # :nodoc: def started(result)
@result = result @result = result
output_status("Started...") output_status("Started...")
end # def started(result) end # def started(result)
private :started private :started
def test_finished(result) # :nodoc: def test_finished(result)
test_progress_bar.fraction += 1.0 / @count test_progress_bar.fraction += 1.0 / @count
end # def test_finished(result) end # def test_finished(result)
def result_changed(result) # :nodoc: def result_changed(result)
run_count_label.label = result.run_count.to_s run_count_label.label = result.run_count.to_s
assertion_count_label.label = result.assertion_count.to_s assertion_count_label.label = result.assertion_count.to_s
failure_count_label.label = result.failure_count.to_s failure_count_label.label = result.failure_count.to_s
@ -339,23 +337,23 @@ module Test
end # def result_changed(result) end # def result_changed(result)
private :result_changed private :result_changed
def clear_fault # :nodoc: def clear_fault
raw_show_fault("") raw_show_fault("")
end # def clear_fault end # def clear_fault
private :clear_fault private :clear_fault
def raw_show_fault(string) # :nodoc: def raw_show_fault(string)
fault_detail_label.set_text(string) fault_detail_label.set_text(string)
outer_detail_sub_panel.queue_resize outer_detail_sub_panel.queue_resize
end # def raw_show_fault(string) end # def raw_show_fault(string)
private :raw_show_fault private :raw_show_fault
def show_fault(fault) # :nodoc: def show_fault(fault)
raw_show_fault(fault.long_display) raw_show_fault(fault.long_display)
end # def show_fault(fault) end # def show_fault(fault)
private :show_fault private :show_fault
def add_fault(fault) # :nodoc: def add_fault(fault)
if not @red then if not @red then
test_progress_bar.style = red_style test_progress_bar.style = red_style
@red = true @red = true
@ -364,7 +362,7 @@ module Test
end # def add_fault(fault) end # def add_fault(fault)
private :add_fault private :add_fault
def reset_ui(count) # :nodoc: def reset_ui(count)
test_progress_bar.style = green_style test_progress_bar.style = green_style
test_progress_bar.fraction = 0.0 test_progress_bar.fraction = 0.0
@count = count + 1 @count = count + 1
@ -379,7 +377,7 @@ module Test
end # def reset_ui(count) end # def reset_ui(count)
private :reset_ui private :reset_ui
def stop # :nodoc: def stop
Gtk.main_quit Gtk.main_quit
end # def stop end # def stop
private :stop private :stop
@ -389,7 +387,7 @@ module Test
end end
private :run_test private :run_test
def start_ui # :nodoc def start_ui
@viewer.run @viewer.run
running = false running = false
begin begin

View file

@ -1,5 +1,3 @@
# :nodoc:
#
# Author:: Nathaniel Talbott. # Author:: Nathaniel Talbott.
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
# License:: Ruby license. # License:: Ruby license.
@ -10,7 +8,7 @@ require 'test/unit/testresult'
module Test module Test
module Unit module Unit
module UI # :nodoc: module UI
# Provides an interface to write any given UI against, # Provides an interface to write any given UI against,
# hopefully making it easy to write new UIs. # hopefully making it easy to write new UIs.

View file

@ -1,5 +1,3 @@
# :nodoc:
#
# Author:: Nathaniel Talbott. # Author:: Nathaniel Talbott.
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
# License:: Ruby license. # License:: Ruby license.

View file

@ -1,5 +1,3 @@
# :nodoc:
#
# Original Author:: Nathaniel Talbott. # Original Author:: Nathaniel Talbott.
# Author:: Kazuhiro NISHIYAMA. # Author:: Kazuhiro NISHIYAMA.
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
@ -13,7 +11,7 @@ require 'test/unit/ui/testrunnerutilities'
module Test module Test
module Unit module Unit
module UI module UI
module Tk # :nodoc: module Tk
# Runs a Test::Unit::TestSuite in a Tk UI. Obviously, # Runs a Test::Unit::TestSuite in a Tk UI. Obviously,
# this one requires you to have Tk # this one requires you to have Tk
@ -52,7 +50,7 @@ module Test
end end
private private
def setup_mediator # :nodoc: def setup_mediator
@mediator = TestRunnerMediator.new(@suite) @mediator = TestRunnerMediator.new(@suite)
suite_name = @suite.to_s suite_name = @suite.to_s
if ( @suite.kind_of?(Module) ) if ( @suite.kind_of?(Module) )
@ -61,7 +59,7 @@ module Test
@suite_name_entry.value = suite_name @suite_name_entry.value = suite_name
end end
def attach_to_mediator # :nodoc: def attach_to_mediator
@run_button.command(method(:run_test)) @run_button.command(method(:run_test))
@fault_list.bind('ButtonPress-1', proc{|y| @fault_list.bind('ButtonPress-1', proc{|y|
fault = @fault_detail_list[@fault_list.nearest(y)] fault = @fault_detail_list[@fault_list.nearest(y)]
@ -81,7 +79,7 @@ module Test
@runner.raise(@restart_signal) @runner.raise(@restart_signal)
end end
def start_ui # :nodoc: def start_ui
@viewer.run @viewer.run
running = false running = false
begin begin
@ -101,11 +99,11 @@ module Test
end end
end end
def stop # :nodoc: def stop
::Tk.exit ::Tk.exit
end end
def reset_ui(count) # :nodoc: def reset_ui(count)
@test_total_count = count.to_f @test_total_count = count.to_f
@test_progress_bar.configure('background'=>'green') @test_progress_bar.configure('background'=>'green')
@test_progress_bar.place('relwidth'=>(count.zero? ? 0 : 0/count)) @test_progress_bar.place('relwidth'=>(count.zero? ? 0 : 0/count))
@ -121,7 +119,7 @@ module Test
clear_fault clear_fault
end end
def add_fault(fault) # :nodoc: def add_fault(fault)
if ( ! @red ) if ( ! @red )
@test_progress_bar.configure('background'=>'red') @test_progress_bar.configure('background'=>'red')
@red = true @red = true
@ -130,19 +128,19 @@ module Test
@fault_list.insert('end', fault.short_display) @fault_list.insert('end', fault.short_display)
end end
def show_fault(fault) # :nodoc: def show_fault(fault)
raw_show_fault(fault.long_display) raw_show_fault(fault.long_display)
end end
def raw_show_fault(string) # :nodoc: def raw_show_fault(string)
@detail_text.value = string @detail_text.value = string
end end
def clear_fault # :nodoc: def clear_fault
raw_show_fault("") raw_show_fault("")
end end
def result_changed(result) # :nodoc: def result_changed(result)
@test_count_label.value = result.run_count @test_count_label.value = result.run_count
@test_progress_bar.place('relwidth'=>result.run_count/@test_total_count) @test_progress_bar.place('relwidth'=>result.run_count/@test_total_count)
@assertion_count_label.value = result.assertion_count @assertion_count_label.value = result.assertion_count
@ -150,7 +148,7 @@ module Test
@error_count_label.value = result.error_count @error_count_label.value = result.error_count
end end
def started(result) # :nodoc: def started(result)
@result = result @result = result
output_status("Started...") output_status("Started...")
end end
@ -163,11 +161,11 @@ module Test
output_status("Finished in #{elapsed_time} seconds") output_status("Finished in #{elapsed_time} seconds")
end end
def output_status(string) # :nodoc: def output_status(string)
@status_entry.value = string @status_entry.value = string
end end
def setup_ui # :nodoc: def setup_ui
@status_entry = TkVariable.new @status_entry = TkVariable.new
l = TkLabel.new(nil, 'textvariable'=>@status_entry, 'relief'=>'sunken') l = TkLabel.new(nil, 'textvariable'=>@status_entry, 'relief'=>'sunken')
l.pack('side'=>'bottom', 'fill'=>'x') l.pack('side'=>'bottom', 'fill'=>'x')
@ -243,7 +241,7 @@ module Test
end end
end end
def create_count_label(parent, label) # :nodoc: def create_count_label(parent, label)
TkLabel.new(parent, 'text'=>label).pack('side'=>'left', 'expand'=>true) TkLabel.new(parent, 'text'=>label).pack('side'=>'left', 'expand'=>true)
v = TkVariable.new(0) v = TkVariable.new(0)
TkLabel.new(parent, 'textvariable'=>v).pack('side'=>'left', 'expand'=>true) TkLabel.new(parent, 'textvariable'=>v).pack('side'=>'left', 'expand'=>true)

View file

@ -1,5 +1,3 @@
# :nodoc:
#
# Author:: Nathaniel Talbott. # Author:: Nathaniel Talbott.
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
# License:: Ruby license. # License:: Ruby license.
@ -8,7 +6,7 @@ require 'test/unit/util/procwrapper'
module Test module Test
module Unit module Unit
module Util # :nodoc: module Util
# This is a utility class that allows anything mixing # This is a utility class that allows anything mixing
# it in to notify a set of listeners about interesting # it in to notify a set of listeners about interesting
@ -80,7 +78,7 @@ module Test
end end
private private
def channels # :nodoc: def channels
@channels ||= {} @channels ||= {}
return @channels return @channels
end end

View file

@ -1,5 +1,3 @@
# :nodoc:
#
# Author:: Nathaniel Talbott. # Author:: Nathaniel Talbott.
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
# License:: Ruby license. # License:: Ruby license.
@ -25,11 +23,11 @@ module Test
@hash = a_proc.inspect.sub(/^(#<#{a_proc.class}:)/){''}.sub(/(>)$/){''}.hex @hash = a_proc.inspect.sub(/^(#<#{a_proc.class}:)/){''}.sub(/(>)$/){''}.hex
end end
def hash # :nodoc: def hash
return @hash return @hash
end end
def ==(other) # :nodoc: def ==(other)
case(other) case(other)
when ProcWrapper when ProcWrapper
return @a_proc == other.to_proc return @a_proc == other.to_proc
@ -39,7 +37,7 @@ module Test
end end
alias :eql? :== alias :eql? :==
def to_proc # :nodoc: def to_proc
return @a_proc return @a_proc
end end
end end