rubysl-test-unit 1.0.1 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/lib/rubysl/test/unit/unit.rb +863 -267
- data/lib/rubysl/test/unit/version.rb +1 -1
- data/lib/test/unit/assertions.rb +281 -531
- data/lib/test/unit/parallel.rb +184 -0
- data/lib/test/unit/testcase.rb +17 -143
- data/rubysl-test-unit.gemspec +3 -1
- metadata +22 -39
- data/lib/test/unit/assertionfailederror.rb +0 -14
- data/lib/test/unit/autorunner.rb +0 -220
- data/lib/test/unit/collector.rb +0 -43
- data/lib/test/unit/collector/dir.rb +0 -107
- data/lib/test/unit/collector/objectspace.rb +0 -34
- data/lib/test/unit/error.rb +0 -56
- data/lib/test/unit/failure.rb +0 -51
- data/lib/test/unit/testresult.rb +0 -80
- data/lib/test/unit/testsuite.rb +0 -76
- data/lib/test/unit/ui/console/testrunner.rb +0 -127
- data/lib/test/unit/ui/fox/testrunner.rb +0 -268
- data/lib/test/unit/ui/gtk/testrunner.rb +0 -416
- data/lib/test/unit/ui/gtk2/testrunner.rb +0 -465
- data/lib/test/unit/ui/testrunnermediator.rb +0 -68
- data/lib/test/unit/ui/testrunnerutilities.rb +0 -46
- data/lib/test/unit/ui/tk/testrunner.rb +0 -260
- data/lib/test/unit/util/backtracefilter.rb +0 -40
- data/lib/test/unit/util/observable.rb +0 -90
- data/lib/test/unit/util/procwrapper.rb +0 -48
data/lib/test/unit/failure.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
#
|
3
|
-
# Author:: Nathaniel Talbott.
|
4
|
-
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
|
5
|
-
# License:: Ruby license.
|
6
|
-
|
7
|
-
module Test
|
8
|
-
module Unit
|
9
|
-
|
10
|
-
# Encapsulates a test failure. Created by Test::Unit::TestCase
|
11
|
-
# when an assertion fails.
|
12
|
-
class Failure
|
13
|
-
attr_reader :test_name, :location, :message
|
14
|
-
|
15
|
-
SINGLE_CHARACTER = 'F'
|
16
|
-
|
17
|
-
# Creates a new Failure with the given location and
|
18
|
-
# message.
|
19
|
-
def initialize(test_name, location, message)
|
20
|
-
@test_name = test_name
|
21
|
-
@location = location
|
22
|
-
@message = message
|
23
|
-
end
|
24
|
-
|
25
|
-
# Returns a single character representation of a failure.
|
26
|
-
def single_character_display
|
27
|
-
SINGLE_CHARACTER
|
28
|
-
end
|
29
|
-
|
30
|
-
# Returns a brief version of the error description.
|
31
|
-
def short_display
|
32
|
-
"#@test_name: #{@message.split("\n")[0]}"
|
33
|
-
end
|
34
|
-
|
35
|
-
# Returns a verbose version of the error description.
|
36
|
-
def long_display
|
37
|
-
location_display = if(location.size == 1)
|
38
|
-
location[0].sub(/\A(.+:\d+).*/, ' [\\1]')
|
39
|
-
else
|
40
|
-
"\n [#{location.join("\n ")}]"
|
41
|
-
end
|
42
|
-
"Failure:\n#@test_name#{location_display}:\n#@message"
|
43
|
-
end
|
44
|
-
|
45
|
-
# Overridden to return long_display.
|
46
|
-
def to_s
|
47
|
-
long_display
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
data/lib/test/unit/testresult.rb
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Author:: Nathaniel Talbott.
|
3
|
-
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
|
4
|
-
# License:: Ruby license.
|
5
|
-
|
6
|
-
require 'test/unit/util/observable'
|
7
|
-
|
8
|
-
module Test
|
9
|
-
module Unit
|
10
|
-
|
11
|
-
# Collects Test::Unit::Failure and Test::Unit::Error so that
|
12
|
-
# they can be displayed to the user. To this end, observers
|
13
|
-
# can be added to it, allowing the dynamic updating of, say, a
|
14
|
-
# UI.
|
15
|
-
class TestResult
|
16
|
-
include Util::Observable
|
17
|
-
|
18
|
-
CHANGED = "CHANGED"
|
19
|
-
FAULT = "FAULT"
|
20
|
-
|
21
|
-
attr_reader(:run_count, :assertion_count)
|
22
|
-
|
23
|
-
# Constructs a new, empty TestResult.
|
24
|
-
def initialize
|
25
|
-
@run_count, @assertion_count = 0, 0
|
26
|
-
@failures, @errors = Array.new, Array.new
|
27
|
-
end
|
28
|
-
|
29
|
-
# Records a test run.
|
30
|
-
def add_run
|
31
|
-
@run_count += 1
|
32
|
-
notify_listeners(CHANGED, self)
|
33
|
-
end
|
34
|
-
|
35
|
-
# Records a Test::Unit::Failure.
|
36
|
-
def add_failure(failure)
|
37
|
-
@failures << failure
|
38
|
-
notify_listeners(FAULT, failure)
|
39
|
-
notify_listeners(CHANGED, self)
|
40
|
-
end
|
41
|
-
|
42
|
-
# Records a Test::Unit::Error.
|
43
|
-
def add_error(error)
|
44
|
-
@errors << error
|
45
|
-
notify_listeners(FAULT, error)
|
46
|
-
notify_listeners(CHANGED, self)
|
47
|
-
end
|
48
|
-
|
49
|
-
# Records an individual assertion.
|
50
|
-
def add_assertion
|
51
|
-
@assertion_count += 1
|
52
|
-
notify_listeners(CHANGED, self)
|
53
|
-
end
|
54
|
-
|
55
|
-
# Returns a string contain the recorded runs, assertions,
|
56
|
-
# failures and errors in this TestResult.
|
57
|
-
def to_s
|
58
|
-
"#{run_count} tests, #{assertion_count} assertions, #{failure_count} failures, #{error_count} errors"
|
59
|
-
end
|
60
|
-
|
61
|
-
# Returns whether or not this TestResult represents
|
62
|
-
# successful completion.
|
63
|
-
def passed?
|
64
|
-
return @failures.empty? && @errors.empty?
|
65
|
-
end
|
66
|
-
|
67
|
-
# Returns the number of failures this TestResult has
|
68
|
-
# recorded.
|
69
|
-
def failure_count
|
70
|
-
return @failures.size
|
71
|
-
end
|
72
|
-
|
73
|
-
# Returns the number of errors this TestResult has
|
74
|
-
# recorded.
|
75
|
-
def error_count
|
76
|
-
return @errors.size
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
data/lib/test/unit/testsuite.rb
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
#
|
3
|
-
# Author:: Nathaniel Talbott.
|
4
|
-
# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
|
5
|
-
# License:: Ruby license.
|
6
|
-
|
7
|
-
module Test
|
8
|
-
module Unit
|
9
|
-
|
10
|
-
# A collection of tests which can be #run.
|
11
|
-
#
|
12
|
-
# Note: It is easy to confuse a TestSuite instance with
|
13
|
-
# something that has a static suite method; I know because _I_
|
14
|
-
# have trouble keeping them straight. Think of something that
|
15
|
-
# has a suite method as simply providing a way to get a
|
16
|
-
# meaningful TestSuite instance.
|
17
|
-
class TestSuite
|
18
|
-
attr_reader :name, :tests
|
19
|
-
|
20
|
-
STARTED = name + "::STARTED"
|
21
|
-
FINISHED = name + "::FINISHED"
|
22
|
-
|
23
|
-
# Creates a new TestSuite with the given name.
|
24
|
-
def initialize(name="Unnamed TestSuite")
|
25
|
-
@name = name
|
26
|
-
@tests = []
|
27
|
-
end
|
28
|
-
|
29
|
-
# Runs the tests and/or suites contained in this
|
30
|
-
# TestSuite.
|
31
|
-
def run(result, &progress_block)
|
32
|
-
yield(STARTED, name)
|
33
|
-
@tests.each do |test|
|
34
|
-
test.run(result, &progress_block)
|
35
|
-
end
|
36
|
-
yield(FINISHED, name)
|
37
|
-
end
|
38
|
-
|
39
|
-
# Adds the test to the suite.
|
40
|
-
def <<(test)
|
41
|
-
@tests << test
|
42
|
-
self
|
43
|
-
end
|
44
|
-
|
45
|
-
def delete(test)
|
46
|
-
@tests.delete(test)
|
47
|
-
end
|
48
|
-
|
49
|
-
# Retuns the rolled up number of tests in this suite;
|
50
|
-
# i.e. if the suite contains other suites, it counts the
|
51
|
-
# tests within those suites, not the suites themselves.
|
52
|
-
def size
|
53
|
-
total_size = 0
|
54
|
-
@tests.each { |test| total_size += test.size }
|
55
|
-
total_size
|
56
|
-
end
|
57
|
-
|
58
|
-
def empty?
|
59
|
-
tests.empty?
|
60
|
-
end
|
61
|
-
|
62
|
-
# Overridden to return the name given the suite at
|
63
|
-
# creation.
|
64
|
-
def to_s
|
65
|
-
@name
|
66
|
-
end
|
67
|
-
|
68
|
-
# It's handy to be able to compare TestSuite instances.
|
69
|
-
def ==(other)
|
70
|
-
return false unless(other.kind_of?(self.class))
|
71
|
-
return false unless(@name == other.name)
|
72
|
-
@tests == other.tests
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
@@ -1,127 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
#
|
3
|
-
# Author:: Nathaniel Talbott.
|
4
|
-
# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
|
5
|
-
# License:: Ruby license.
|
6
|
-
|
7
|
-
require 'test/unit/ui/testrunnermediator'
|
8
|
-
require 'test/unit/ui/testrunnerutilities'
|
9
|
-
|
10
|
-
module Test
|
11
|
-
module Unit
|
12
|
-
module UI
|
13
|
-
module Console
|
14
|
-
|
15
|
-
# Runs a Test::Unit::TestSuite on the console.
|
16
|
-
class TestRunner
|
17
|
-
extend TestRunnerUtilities
|
18
|
-
|
19
|
-
# Creates a new TestRunner for running the passed
|
20
|
-
# suite. If quiet_mode is true, the output while
|
21
|
-
# running is limited to progress dots, errors and
|
22
|
-
# failures, and the final result. io specifies
|
23
|
-
# where runner output should go to; defaults to
|
24
|
-
# STDOUT.
|
25
|
-
def initialize(suite, output_level=NORMAL, io=STDOUT)
|
26
|
-
if (suite.respond_to?(:suite))
|
27
|
-
@suite = suite.suite
|
28
|
-
else
|
29
|
-
@suite = suite
|
30
|
-
end
|
31
|
-
@output_level = output_level
|
32
|
-
@io = io
|
33
|
-
@already_outputted = false
|
34
|
-
@faults = []
|
35
|
-
end
|
36
|
-
|
37
|
-
# Begins the test run.
|
38
|
-
def start
|
39
|
-
setup_mediator
|
40
|
-
attach_to_mediator
|
41
|
-
return start_mediator
|
42
|
-
end
|
43
|
-
|
44
|
-
private
|
45
|
-
def setup_mediator
|
46
|
-
@mediator = create_mediator(@suite)
|
47
|
-
suite_name = @suite.to_s
|
48
|
-
if ( @suite.kind_of?(Module) )
|
49
|
-
suite_name = @suite.name
|
50
|
-
end
|
51
|
-
output("Loaded suite #{suite_name}")
|
52
|
-
end
|
53
|
-
|
54
|
-
def create_mediator(suite)
|
55
|
-
return TestRunnerMediator.new(suite)
|
56
|
-
end
|
57
|
-
|
58
|
-
def attach_to_mediator
|
59
|
-
@mediator.add_listener(TestResult::FAULT, &method(:add_fault))
|
60
|
-
@mediator.add_listener(TestRunnerMediator::STARTED, &method(:started))
|
61
|
-
@mediator.add_listener(TestRunnerMediator::FINISHED, &method(:finished))
|
62
|
-
@mediator.add_listener(TestCase::STARTED, &method(:test_started))
|
63
|
-
@mediator.add_listener(TestCase::FINISHED, &method(:test_finished))
|
64
|
-
end
|
65
|
-
|
66
|
-
def start_mediator
|
67
|
-
return @mediator.run_suite
|
68
|
-
end
|
69
|
-
|
70
|
-
def add_fault(fault)
|
71
|
-
@faults << fault
|
72
|
-
output_single(fault.single_character_display, PROGRESS_ONLY)
|
73
|
-
@already_outputted = true
|
74
|
-
end
|
75
|
-
|
76
|
-
def started(result)
|
77
|
-
@result = result
|
78
|
-
output("Started")
|
79
|
-
end
|
80
|
-
|
81
|
-
def finished(elapsed_time)
|
82
|
-
nl
|
83
|
-
output("Finished in #{elapsed_time} seconds.")
|
84
|
-
@faults.each_with_index do |fault, index|
|
85
|
-
nl
|
86
|
-
output("%3d) %s" % [index + 1, fault.long_display])
|
87
|
-
end
|
88
|
-
nl
|
89
|
-
output(@result)
|
90
|
-
end
|
91
|
-
|
92
|
-
def test_started(name)
|
93
|
-
output_single(name + ": ", VERBOSE)
|
94
|
-
end
|
95
|
-
|
96
|
-
def test_finished(name)
|
97
|
-
output_single(".", PROGRESS_ONLY) unless (@already_outputted)
|
98
|
-
nl(VERBOSE)
|
99
|
-
@already_outputted = false
|
100
|
-
end
|
101
|
-
|
102
|
-
def nl(level=NORMAL)
|
103
|
-
output("", level)
|
104
|
-
end
|
105
|
-
|
106
|
-
def output(something, level=NORMAL)
|
107
|
-
@io.puts(something) if (output?(level))
|
108
|
-
@io.flush
|
109
|
-
end
|
110
|
-
|
111
|
-
def output_single(something, level=NORMAL)
|
112
|
-
@io.write(something) if (output?(level))
|
113
|
-
@io.flush
|
114
|
-
end
|
115
|
-
|
116
|
-
def output?(level)
|
117
|
-
level <= @output_level
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
if __FILE__ == $0
|
126
|
-
Test::Unit::UI::Console::TestRunner.start_command_line_test
|
127
|
-
end
|
@@ -1,268 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
#
|
3
|
-
# Author:: Nathaniel Talbott.
|
4
|
-
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
|
5
|
-
# License:: Ruby license.
|
6
|
-
|
7
|
-
require 'fox'
|
8
|
-
require 'test/unit/ui/testrunnermediator'
|
9
|
-
require 'test/unit/ui/testrunnerutilities'
|
10
|
-
|
11
|
-
include Fox
|
12
|
-
|
13
|
-
module Test
|
14
|
-
module Unit
|
15
|
-
module UI
|
16
|
-
module Fox
|
17
|
-
|
18
|
-
# Runs a Test::Unit::TestSuite in a Fox UI. Obviously,
|
19
|
-
# this one requires you to have Fox
|
20
|
-
# (http://www.fox-toolkit.org/fox.html) and the Ruby
|
21
|
-
# Fox extension (http://fxruby.sourceforge.net/)
|
22
|
-
# installed.
|
23
|
-
class TestRunner
|
24
|
-
|
25
|
-
extend TestRunnerUtilities
|
26
|
-
|
27
|
-
RED_STYLE = FXRGBA(0xFF,0,0,0xFF) #0xFF000000
|
28
|
-
GREEN_STYLE = FXRGBA(0,0xFF,0,0xFF) #0x00FF0000
|
29
|
-
|
30
|
-
# Creates a new TestRunner for running the passed
|
31
|
-
# suite.
|
32
|
-
def initialize(suite, output_level = NORMAL)
|
33
|
-
if (suite.respond_to?(:suite))
|
34
|
-
@suite = suite.suite
|
35
|
-
else
|
36
|
-
@suite = suite
|
37
|
-
end
|
38
|
-
|
39
|
-
@result = nil
|
40
|
-
@red = false
|
41
|
-
end
|
42
|
-
|
43
|
-
# Begins the test run.
|
44
|
-
def start
|
45
|
-
setup_ui
|
46
|
-
setup_mediator
|
47
|
-
attach_to_mediator
|
48
|
-
start_ui
|
49
|
-
@result
|
50
|
-
end
|
51
|
-
|
52
|
-
def setup_mediator
|
53
|
-
@mediator = TestRunnerMediator.new(@suite)
|
54
|
-
suite_name = @suite.to_s
|
55
|
-
if ( @suite.kind_of?(Module) )
|
56
|
-
suite_name = @suite.name
|
57
|
-
end
|
58
|
-
@suite_name_entry.text = suite_name
|
59
|
-
end
|
60
|
-
|
61
|
-
def attach_to_mediator
|
62
|
-
@mediator.add_listener(TestRunnerMediator::RESET, &method(:reset_ui))
|
63
|
-
@mediator.add_listener(TestResult::FAULT, &method(:add_fault))
|
64
|
-
@mediator.add_listener(TestResult::CHANGED, &method(:result_changed))
|
65
|
-
@mediator.add_listener(TestRunnerMediator::STARTED, &method(:started))
|
66
|
-
@mediator.add_listener(TestCase::STARTED, &method(:test_started))
|
67
|
-
@mediator.add_listener(TestRunnerMediator::FINISHED, &method(:finished))
|
68
|
-
end
|
69
|
-
|
70
|
-
def start_ui
|
71
|
-
@application.create
|
72
|
-
@window.show(PLACEMENT_SCREEN)
|
73
|
-
@application.addTimeout(1) do
|
74
|
-
@mediator.run_suite
|
75
|
-
end
|
76
|
-
@application.run
|
77
|
-
end
|
78
|
-
|
79
|
-
def stop
|
80
|
-
@application.exit(0)
|
81
|
-
end
|
82
|
-
|
83
|
-
def reset_ui(count)
|
84
|
-
@test_progress_bar.barColor = GREEN_STYLE
|
85
|
-
@test_progress_bar.total = count
|
86
|
-
@test_progress_bar.progress = 0
|
87
|
-
@red = false
|
88
|
-
|
89
|
-
@test_count_label.text = "0"
|
90
|
-
@assertion_count_label.text = "0"
|
91
|
-
@failure_count_label.text = "0"
|
92
|
-
@error_count_label.text = "0"
|
93
|
-
|
94
|
-
@fault_list.clearItems
|
95
|
-
end
|
96
|
-
|
97
|
-
def add_fault(fault)
|
98
|
-
if ( ! @red )
|
99
|
-
@test_progress_bar.barColor = RED_STYLE
|
100
|
-
@red = true
|
101
|
-
end
|
102
|
-
item = FaultListItem.new(fault)
|
103
|
-
@fault_list.appendItem(item)
|
104
|
-
end
|
105
|
-
|
106
|
-
def show_fault(fault)
|
107
|
-
raw_show_fault(fault.long_display)
|
108
|
-
end
|
109
|
-
|
110
|
-
def raw_show_fault(string)
|
111
|
-
@detail_text.setText(string)
|
112
|
-
end
|
113
|
-
|
114
|
-
def clear_fault
|
115
|
-
raw_show_fault("")
|
116
|
-
end
|
117
|
-
|
118
|
-
def result_changed(result)
|
119
|
-
@test_progress_bar.progress = result.run_count
|
120
|
-
|
121
|
-
@test_count_label.text = result.run_count.to_s
|
122
|
-
@assertion_count_label.text = result.assertion_count.to_s
|
123
|
-
@failure_count_label.text = result.failure_count.to_s
|
124
|
-
@error_count_label.text = result.error_count.to_s
|
125
|
-
|
126
|
-
# repaint now!
|
127
|
-
@info_panel.repaint
|
128
|
-
@application.flush
|
129
|
-
end
|
130
|
-
|
131
|
-
def started(result)
|
132
|
-
@result = result
|
133
|
-
output_status("Started...")
|
134
|
-
end
|
135
|
-
|
136
|
-
def test_started(test_name)
|
137
|
-
output_status("Running #{test_name}...")
|
138
|
-
end
|
139
|
-
|
140
|
-
def finished(elapsed_time)
|
141
|
-
output_status("Finished in #{elapsed_time} seconds")
|
142
|
-
end
|
143
|
-
|
144
|
-
def output_status(string)
|
145
|
-
@status_entry.text = string
|
146
|
-
@status_entry.repaint
|
147
|
-
end
|
148
|
-
|
149
|
-
def setup_ui
|
150
|
-
@application = create_application
|
151
|
-
create_tooltip(@application)
|
152
|
-
|
153
|
-
@window = create_window(@application)
|
154
|
-
|
155
|
-
@status_entry = create_entry(@window)
|
156
|
-
|
157
|
-
main_panel = create_main_panel(@window)
|
158
|
-
|
159
|
-
suite_panel = create_suite_panel(main_panel)
|
160
|
-
create_label(suite_panel, "Suite:")
|
161
|
-
@suite_name_entry = create_entry(suite_panel)
|
162
|
-
create_button(suite_panel, "&Run\tRun the current suite", proc { @mediator.run_suite })
|
163
|
-
|
164
|
-
@test_progress_bar = create_progress_bar(main_panel)
|
165
|
-
|
166
|
-
@info_panel = create_info_panel(main_panel)
|
167
|
-
create_label(@info_panel, "Tests:")
|
168
|
-
@test_count_label = create_label(@info_panel, "0")
|
169
|
-
create_label(@info_panel, "Assertions:")
|
170
|
-
@assertion_count_label = create_label(@info_panel, "0")
|
171
|
-
create_label(@info_panel, "Failures:")
|
172
|
-
@failure_count_label = create_label(@info_panel, "0")
|
173
|
-
create_label(@info_panel, "Errors:")
|
174
|
-
@error_count_label = create_label(@info_panel, "0")
|
175
|
-
|
176
|
-
list_panel = create_list_panel(main_panel)
|
177
|
-
@fault_list = create_fault_list(list_panel)
|
178
|
-
|
179
|
-
detail_panel = create_detail_panel(main_panel)
|
180
|
-
@detail_text = create_text(detail_panel)
|
181
|
-
end
|
182
|
-
|
183
|
-
def create_application
|
184
|
-
app = FXApp.new("TestRunner", "Test::Unit")
|
185
|
-
app.init([])
|
186
|
-
app
|
187
|
-
end
|
188
|
-
|
189
|
-
def create_window(app)
|
190
|
-
FXMainWindow.new(app, "Test::Unit TestRunner", nil, nil, DECOR_ALL, 0, 0, 450)
|
191
|
-
end
|
192
|
-
|
193
|
-
def create_tooltip(app)
|
194
|
-
FXTooltip.new(app)
|
195
|
-
end
|
196
|
-
|
197
|
-
def create_main_panel(parent)
|
198
|
-
panel = FXVerticalFrame.new(parent, LAYOUT_FILL_X | LAYOUT_FILL_Y)
|
199
|
-
panel.vSpacing = 10
|
200
|
-
panel
|
201
|
-
end
|
202
|
-
|
203
|
-
def create_suite_panel(parent)
|
204
|
-
FXHorizontalFrame.new(parent, LAYOUT_SIDE_LEFT | LAYOUT_FILL_X)
|
205
|
-
end
|
206
|
-
|
207
|
-
def create_button(parent, text, action)
|
208
|
-
FXButton.new(parent, text).connect(SEL_COMMAND, &action)
|
209
|
-
end
|
210
|
-
|
211
|
-
def create_progress_bar(parent)
|
212
|
-
FXProgressBar.new(parent, nil, 0, PROGRESSBAR_NORMAL | LAYOUT_FILL_X)
|
213
|
-
end
|
214
|
-
|
215
|
-
def create_info_panel(parent)
|
216
|
-
FXMatrix.new(parent, 1, MATRIX_BY_ROWS | LAYOUT_FILL_X)
|
217
|
-
end
|
218
|
-
|
219
|
-
def create_label(parent, text)
|
220
|
-
FXLabel.new(parent, text, nil, JUSTIFY_CENTER_X | LAYOUT_FILL_COLUMN)
|
221
|
-
end
|
222
|
-
|
223
|
-
def create_list_panel(parent)
|
224
|
-
FXHorizontalFrame.new(parent, LAYOUT_FILL_X | FRAME_SUNKEN | FRAME_THICK)
|
225
|
-
end
|
226
|
-
|
227
|
-
def create_fault_list(parent)
|
228
|
-
list = FXList.new(parent, 10, nil, 0, LIST_SINGLESELECT | LAYOUT_FILL_X) #, 0, 0, 0, 150)
|
229
|
-
list.connect(SEL_COMMAND) do |sender, sel, ptr|
|
230
|
-
if sender.retrieveItem(sender.currentItem).selected?
|
231
|
-
show_fault(sender.retrieveItem(sender.currentItem).fault)
|
232
|
-
else
|
233
|
-
clear_fault
|
234
|
-
end
|
235
|
-
end
|
236
|
-
list
|
237
|
-
end
|
238
|
-
|
239
|
-
def create_detail_panel(parent)
|
240
|
-
FXHorizontalFrame.new(parent, LAYOUT_FILL_X | LAYOUT_FILL_Y | FRAME_SUNKEN | FRAME_THICK)
|
241
|
-
end
|
242
|
-
|
243
|
-
def create_text(parent)
|
244
|
-
FXText.new(parent, nil, 0, TEXT_READONLY | LAYOUT_FILL_X | LAYOUT_FILL_Y)
|
245
|
-
end
|
246
|
-
|
247
|
-
def create_entry(parent)
|
248
|
-
entry = FXTextField.new(parent, 30, nil, 0, TEXTFIELD_NORMAL | LAYOUT_SIDE_BOTTOM | LAYOUT_FILL_X)
|
249
|
-
entry.disable
|
250
|
-
entry
|
251
|
-
end
|
252
|
-
end
|
253
|
-
|
254
|
-
class FaultListItem < FXListItem
|
255
|
-
attr_reader(:fault)
|
256
|
-
def initialize(fault)
|
257
|
-
super(fault.short_display)
|
258
|
-
@fault = fault
|
259
|
-
end
|
260
|
-
end
|
261
|
-
end
|
262
|
-
end
|
263
|
-
end
|
264
|
-
end
|
265
|
-
|
266
|
-
if __FILE__ == $0
|
267
|
-
Test::Unit::UI::Fox::TestRunner.start_command_line_test
|
268
|
-
end
|