ffi-tk 2010.08.23 → 2018.02.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +7 -0
  4. data/.rubocop_todo.yml +371 -0
  5. data/AUTHORS +4 -2
  6. data/CHANGELOG +302 -262
  7. data/Gemfile +10 -0
  8. data/Gemfile.lock +45 -0
  9. data/MANIFEST +6 -6
  10. data/README.md +1 -1
  11. data/Rakefile +12 -11
  12. data/bin/rwish +6 -5
  13. data/example/choose_color.rb +5 -4
  14. data/example/choose_directory.rb +5 -4
  15. data/example/dialog.rb +9 -8
  16. data/example/hello.rb +2 -1
  17. data/example/message_box.rb +8 -5
  18. data/example/option_menu.rb +4 -3
  19. data/example/popup.rb +4 -3
  20. data/example/set_palette.rb +5 -4
  21. data/example/text.rb +30 -30
  22. data/example/tile/kroc_demo_small.rb +51 -55
  23. data/example/tile/kroc_rb_demo.rb +74 -83
  24. data/example/tile/notebook.rb +6 -9
  25. data/example/tile/theme_hello.rb +6 -8
  26. data/example/tile/themes.rb +4 -2
  27. data/example/tile/treeview.rb +16 -14
  28. data/example/tkgo.rb +120 -88
  29. data/example/various.rb +8 -7
  30. data/example/wait.rb +3 -2
  31. data/ffi-tk.gemspec +21 -20
  32. data/gemset.nix +134 -0
  33. data/lib/ffi-tk.rb +10 -11
  34. data/lib/ffi-tk/command.rb +3 -2
  35. data/lib/ffi-tk/command/after.rb +8 -7
  36. data/lib/ffi-tk/command/bell.rb +2 -1
  37. data/lib/ffi-tk/command/bind.rb +1 -0
  38. data/lib/ffi-tk/command/bindtags.rb +1 -0
  39. data/lib/ffi-tk/command/cget.rb +31 -24
  40. data/lib/ffi-tk/command/choose_color.rb +2 -1
  41. data/lib/ffi-tk/command/choose_directory.rb +2 -1
  42. data/lib/ffi-tk/command/clipboard.rb +6 -5
  43. data/lib/ffi-tk/command/configure.rb +23 -21
  44. data/lib/ffi-tk/command/destroy.rb +2 -1
  45. data/lib/ffi-tk/command/dialog.rb +4 -3
  46. data/lib/ffi-tk/command/event.rb +1 -0
  47. data/lib/ffi-tk/command/focus.rb +2 -1
  48. data/lib/ffi-tk/command/font.rb +12 -9
  49. data/lib/ffi-tk/command/get_open_file.rb +1 -0
  50. data/lib/ffi-tk/command/get_save_file.rb +1 -0
  51. data/lib/ffi-tk/command/grab.rb +2 -1
  52. data/lib/ffi-tk/command/grid.rb +7 -6
  53. data/lib/ffi-tk/command/image.rb +5 -4
  54. data/lib/ffi-tk/command/lower.rb +1 -0
  55. data/lib/ffi-tk/command/message_box.rb +2 -1
  56. data/lib/ffi-tk/command/option_menu.rb +3 -2
  57. data/lib/ffi-tk/command/pack.rb +5 -4
  58. data/lib/ffi-tk/command/place.rb +5 -4
  59. data/lib/ffi-tk/command/popup.rb +2 -1
  60. data/lib/ffi-tk/command/raise.rb +1 -0
  61. data/lib/ffi-tk/command/scrollable.rb +7 -10
  62. data/lib/ffi-tk/command/selection.rb +4 -3
  63. data/lib/ffi-tk/command/set_palette.rb +2 -1
  64. data/lib/ffi-tk/command/tk_cmd.rb +1 -0
  65. data/lib/ffi-tk/command/vars.rb +2 -1
  66. data/lib/ffi-tk/command/wait.rb +2 -1
  67. data/lib/ffi-tk/command/winfo.rb +9 -8
  68. data/lib/ffi-tk/command/wm.rb +11 -10
  69. data/lib/ffi-tk/core_extensions.rb +5 -4
  70. data/lib/ffi-tk/event/data.rb +32 -31
  71. data/lib/ffi-tk/event/handler.rb +4 -3
  72. data/lib/ffi-tk/ffi/tcl.rb +42 -31
  73. data/lib/ffi-tk/ffi/tcl/cmd_proc.rb +2 -1
  74. data/lib/ffi-tk/ffi/tcl/eval_result.rb +47 -8
  75. data/lib/ffi-tk/ffi/tcl/interp.rb +7 -4
  76. data/lib/ffi-tk/ffi/tcl/obj.rb +7 -32
  77. data/lib/ffi-tk/ffi/tcl/time.rb +2 -1
  78. data/lib/ffi-tk/ffi/tk.rb +8 -7
  79. data/lib/ffi-tk/geometry.rb +20 -17
  80. data/lib/ffi-tk/thread_sender.rb +1 -0
  81. data/lib/ffi-tk/tk.rb +23 -23
  82. data/lib/ffi-tk/variable.rb +25 -3
  83. data/lib/ffi-tk/version.rb +1 -1
  84. data/lib/ffi-tk/widget.rb +2 -1
  85. data/lib/ffi-tk/widget/button.rb +4 -1
  86. data/lib/ffi-tk/widget/canvas.rb +18 -15
  87. data/lib/ffi-tk/widget/canvas/arc.rb +2 -1
  88. data/lib/ffi-tk/widget/canvas/bitmap.rb +2 -1
  89. data/lib/ffi-tk/widget/canvas/image.rb +2 -1
  90. data/lib/ffi-tk/widget/canvas/item.rb +4 -4
  91. data/lib/ffi-tk/widget/canvas/line.rb +2 -1
  92. data/lib/ffi-tk/widget/canvas/oval.rb +2 -1
  93. data/lib/ffi-tk/widget/canvas/polygon.rb +2 -1
  94. data/lib/ffi-tk/widget/canvas/rectangle.rb +2 -1
  95. data/lib/ffi-tk/widget/canvas/text.rb +2 -1
  96. data/lib/ffi-tk/widget/canvas/window.rb +2 -1
  97. data/lib/ffi-tk/widget/checkbutton.rb +4 -1
  98. data/lib/ffi-tk/widget/entry.rb +4 -1
  99. data/lib/ffi-tk/widget/frame.rb +4 -1
  100. data/lib/ffi-tk/widget/label.rb +4 -1
  101. data/lib/ffi-tk/widget/labelframe.rb +4 -1
  102. data/lib/ffi-tk/widget/listbox.rb +5 -2
  103. data/lib/ffi-tk/widget/menu.rb +4 -1
  104. data/lib/ffi-tk/widget/menubutton.rb +4 -1
  105. data/lib/ffi-tk/widget/message.rb +4 -1
  106. data/lib/ffi-tk/widget/panedwindow.rb +5 -2
  107. data/lib/ffi-tk/widget/radiobutton.rb +4 -1
  108. data/lib/ffi-tk/widget/root.rb +1 -0
  109. data/lib/ffi-tk/widget/scale.rb +4 -1
  110. data/lib/ffi-tk/widget/scrollbar.rb +4 -1
  111. data/lib/ffi-tk/widget/spinbox.rb +4 -1
  112. data/lib/ffi-tk/widget/text.rb +20 -16
  113. data/lib/ffi-tk/widget/text/peer.rb +1 -0
  114. data/lib/ffi-tk/widget/tile.rb +2 -1
  115. data/lib/ffi-tk/widget/tile/button.rb +4 -1
  116. data/lib/ffi-tk/widget/tile/checkbutton.rb +4 -1
  117. data/lib/ffi-tk/widget/tile/combobox.rb +5 -2
  118. data/lib/ffi-tk/widget/tile/entry.rb +4 -1
  119. data/lib/ffi-tk/widget/tile/frame.rb +4 -1
  120. data/lib/ffi-tk/widget/tile/label.rb +4 -2
  121. data/lib/ffi-tk/widget/tile/labelframe.rb +4 -1
  122. data/lib/ffi-tk/widget/tile/menubutton.rb +4 -1
  123. data/lib/ffi-tk/widget/tile/notebook.rb +4 -1
  124. data/lib/ffi-tk/widget/tile/panedwindow.rb +4 -1
  125. data/lib/ffi-tk/widget/tile/progressbar.rb +4 -2
  126. data/lib/ffi-tk/widget/tile/radiobutton.rb +4 -1
  127. data/lib/ffi-tk/widget/tile/scale.rb +4 -1
  128. data/lib/ffi-tk/widget/tile/scrollbar.rb +7 -4
  129. data/lib/ffi-tk/widget/tile/separator.rb +4 -1
  130. data/lib/ffi-tk/widget/tile/sizegrip.rb +4 -1
  131. data/lib/ffi-tk/widget/tile/style.rb +16 -17
  132. data/lib/ffi-tk/widget/tile/treeview.rb +11 -5
  133. data/lib/ffi-tk/widget/toplevel.rb +4 -1
  134. data/shell.nix +19 -0
  135. data/spec/ffi-tk/command/bind.rb +5 -4
  136. data/spec/ffi-tk/command/bindtags.rb +2 -1
  137. data/spec/ffi-tk/command/clipboard.rb +4 -3
  138. data/spec/ffi-tk/command/font.rb +20 -19
  139. data/spec/ffi-tk/command/image.rb +13 -5
  140. data/spec/ffi-tk/command/pack.rb +3 -2
  141. data/spec/ffi-tk/command/place.rb +4 -3
  142. data/spec/ffi-tk/command/selection.rb +2 -1
  143. data/spec/ffi-tk/command/vars.rb +3 -2
  144. data/spec/ffi-tk/command/winfo.rb +10 -10
  145. data/spec/ffi-tk/command/wm.rb +23 -22
  146. data/spec/ffi-tk/event.rb +23 -21
  147. data/spec/ffi-tk/tile/button.rb +8 -8
  148. data/spec/ffi-tk/tile/checkbutton.rb +1 -1
  149. data/spec/ffi-tk/tile/combobox.rb +11 -12
  150. data/spec/ffi-tk/tile/entry.rb +18 -19
  151. data/spec/ffi-tk/tile/frame.rb +13 -13
  152. data/spec/ffi-tk/tile/label.rb +2 -2
  153. data/spec/ffi-tk/tile/labelframe.rb +1 -1
  154. data/spec/ffi-tk/tile/menubutton.rb +1 -1
  155. data/spec/ffi-tk/tile/notebook.rb +22 -20
  156. data/spec/ffi-tk/tile/panedwindow.rb +1 -1
  157. data/spec/ffi-tk/tile/progressbar.rb +1 -1
  158. data/spec/ffi-tk/tile/radiobutton.rb +1 -1
  159. data/spec/ffi-tk/tile/scale.rb +1 -1
  160. data/spec/ffi-tk/tile/scrollbar.rb +1 -16
  161. data/spec/ffi-tk/tile/separator.rb +2 -2
  162. data/spec/ffi-tk/tile/sizegrip.rb +1 -1
  163. data/spec/ffi-tk/tile/style.rb +63 -65
  164. data/spec/ffi-tk/tile/treeview.rb +11 -10
  165. data/spec/ffi-tk/variable.rb +5 -4
  166. data/spec/ffi-tk/widget/button.rb +3 -2
  167. data/spec/ffi-tk/widget/canvas.rb +59 -58
  168. data/spec/ffi-tk/widget/checkbutton.rb +6 -5
  169. data/spec/ffi-tk/widget/entry.rb +112 -103
  170. data/spec/ffi-tk/widget/frame.rb +2 -1
  171. data/spec/ffi-tk/widget/label.rb +2 -1
  172. data/spec/ffi-tk/widget/labelframe.rb +1 -0
  173. data/spec/ffi-tk/widget/listbox.rb +5 -4
  174. data/spec/ffi-tk/widget/menu.rb +3 -2
  175. data/spec/ffi-tk/widget/menubutton.rb +1 -0
  176. data/spec/ffi-tk/widget/message.rb +1 -0
  177. data/spec/ffi-tk/widget/panedwindow.rb +1 -0
  178. data/spec/ffi-tk/widget/radiobutton.rb +1 -0
  179. data/spec/ffi-tk/widget/root.rb +2 -1
  180. data/spec/ffi-tk/widget/scale.rb +1 -0
  181. data/spec/ffi-tk/widget/scrollbar.rb +1 -0
  182. data/spec/ffi-tk/widget/spinbox.rb +1 -0
  183. data/spec/ffi-tk/widget/text.rb +63 -54
  184. data/spec/ffi-tk/widget/toplevel.rb +1 -0
  185. data/spec/helper.rb +3 -1
  186. data/tasks/authors.rake +3 -2
  187. data/tasks/bacon.rake +13 -11
  188. data/tasks/changelog.rake +1 -0
  189. data/tasks/gem.rake +13 -11
  190. data/tasks/manifest.rake +2 -1
  191. data/tasks/release.rake +11 -32
  192. data/tasks/reversion.rake +2 -1
  193. metadata +52 -75
  194. data/spec/ffi-tk/command/grid.rb +0 -6
  195. data/tasks/gem_setup.rake +0 -113
  196. data/tasks/grancher.rake +0 -12
  197. data/tasks/rcov.rake +0 -17
  198. data/tasks/setup.rake +0 -12
  199. data/tasks/ycov.rake +0 -84
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  describe Tk::Tile::PanedWindow do
@@ -10,4 +11,3 @@ describe Tk::Tile::PanedWindow do
10
11
  it 'needs more specs' do
11
12
  end
12
13
  end
13
-
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  describe Tk::Tile::Progressbar do
@@ -75,4 +76,3 @@ describe Tk::Tile::Progressbar do
75
76
  pbar.orient.should == :vertical
76
77
  end
77
78
  end
78
-
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  describe Tk::Tile::RadioButton do
@@ -10,4 +11,3 @@ describe Tk::Tile::RadioButton do
10
11
  it 'needs more specs' do
11
12
  end
12
13
  end
13
-
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  describe Tk::Tile::Scale do
@@ -10,4 +11,3 @@ describe Tk::Tile::Scale do
10
11
  it 'needs more specs' do
11
12
  end
12
13
  end
13
-
@@ -1,20 +1,6 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
- describe Tk::Tile::Scrollbar do
4
- it 'initializes' do
5
- instance = Tk::Tile::Scrollbar.new
6
- instance.class.should == Tk::Tile::Scrollbar
7
- instance.tk_parent.should == Tk.root
8
- end
9
-
10
- it 'sets orientation' do
11
- s = Tk::Tile::YScrollbar.new
12
- s.orient.should == :vertical
13
- s.orient :horizontal
14
- s.orient.should == :horizontal
15
- end
16
- end
17
-
18
4
  describe Tk::Tile::YScrollbar do
19
5
  it 'initializes' do
20
6
  instance = Tk::Tile::YScrollbar.new
@@ -40,4 +26,3 @@ describe Tk::Tile::XScrollbar do
40
26
  s.cget(:orient).should == :horizontal
41
27
  end
42
28
  end
43
-
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  describe Tk::Tile::Separator do
@@ -16,7 +17,6 @@ describe Tk::Tile::Separator do
16
17
 
17
18
  it 'sets identify' do
18
19
  s = Tk::Tile::Separator.new
19
- s.identify(0,0).should == true
20
+ s.identify(0, 0).should == true
20
21
  end
21
22
  end
22
-
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  describe Tk::Tile::Sizegrip do
@@ -10,4 +11,3 @@ describe Tk::Tile::Sizegrip do
10
11
  it 'needs more specs' do
11
12
  end
12
13
  end
13
-
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  Tk.init
@@ -5,106 +6,107 @@ Tk.init
5
6
  describe Tk::Tile::Style do
6
7
  Style = Tk::Tile::Style
7
8
 
8
- it '#theme_names returns a list of all known themes' do
9
+ it '#theme_names returns a list of all known themes' do
9
10
  names = Style.theme_names
10
11
 
11
- names.should.kind_of? Array
12
+ names.should.is_a? Array
12
13
  names.should.not.be.empty?
13
- names.all?{|i| i.kind_of?(String) }
14
- names.should == ["clam", "alt", "default", "classic"]
14
+ names.all? { |i| i.is_a?(String) }
15
+ names.all? { |i| %w(aqua clam alt default classic).include? i }
16
+ # tk-aqua: "aqua", "clam", ...
15
17
  end
16
18
 
17
- it '#theme_use sets the current theme' do
19
+ it '#theme_use sets the current theme' do
18
20
  Style.theme_use('default').should == 'default'
19
21
  Style.theme_use('unkown-theme-').should.be.nil?
20
22
  end
21
23
 
22
- it '#element_names returns the list of elements defined in the current theme' do
24
+ it '#element_names returns the list of elements defined in the current theme' do
23
25
  names = Style.element_names
24
26
 
25
- names.should.kind_of? Array
27
+ names.should.is_a? Array
26
28
  names.should.not.be.empty?
27
- names.all?{|i| i.kind_of?(String) }
28
- %w{label focus image text textarea}.each {|i| names.should.include? i }
29
+ names.all? { |i| i.is_a?(String) }
30
+ %w(label focus image text textarea).each { |i| names.should.include? i }
29
31
  end
30
32
 
31
- it '#element_options returns the list of elements options' do
33
+ it '#element_options returns the list of elements options' do
32
34
  name = 'text'
33
- options = %w{-text -font -foreground -underline -width -anchor -justify -wraplength -embossed}
35
+ options = %w(-text -font -foreground -underline -width -anchor -justify -wraplength -embossed)
34
36
 
35
- Style.element_options(name).should.kind_of? Array
37
+ Style.element_options(name).should.is_a? Array
36
38
  Style.element_options(name).should.not.be.empty?
37
39
  Style.element_options(name).should == options
38
40
 
39
- Style.element_options('unkown-element').should == nil
41
+ Style.element_options('unkown-element').should.nil?
40
42
  end
41
43
 
42
- it '#lookup returns the value specified for -option in style style' do
44
+ it '#lookup returns the value specified for -option in style style' do
43
45
  Style.lookup('label', 'font').should == 'TkDefaultFont'
44
- Style.lookup('label', 'foreground').should == 'black'
45
- Style.lookup('label', :foreground).should == 'black'
46
+ %w(black #000000).should.include? Style.lookup('label', 'foreground')
47
+ %w(black #000000).should.include? Style.lookup('label', :foreground)
46
48
  end
47
49
 
48
- it '#configure sets the default value of the specified option(s) in style' do
50
+ it '#configure sets the default value of the specified option(s) in style' do
49
51
  # configure one element option
50
- Style.configure('label', foreground: 'gray' ).should == true
52
+ Style.configure('label', foreground: 'gray').should == true
51
53
  Style.lookup('label', 'foreground').should == 'gray'
52
54
 
53
55
  # configure a hash of element options
54
- Style.configure('label', {foreground: 'gray', background: 'blue'} ).should == true
56
+ Style.configure('label', foreground: 'gray', background: 'blue').should == true
55
57
  Style.lookup('label', 'foreground').should == 'gray'
56
58
  Style.lookup('label', 'background').should == 'blue'
57
59
 
58
60
  Style.configure('label', foreground: 'black').should == true
59
61
 
60
62
  # configure other element..
61
- Style.configure('Button.label', foreground: :red ).should == true
63
+ Style.configure('Button.label', foreground: :red).should == true
62
64
  Style.lookup('Button.label', 'foreground').should == 'red'
63
65
 
64
- Style.configure('Button.label', foreground: :blue ).should == true
66
+ Style.configure('Button.label', foreground: :blue).should == true
65
67
  Style.lookup('Button.label', 'foreground').should == 'blue'
66
68
 
67
69
  # element origin is still black
68
70
  Style.lookup('label', 'foreground').should == 'black'
69
71
  end
70
72
 
71
- it '#map sets dynamic values of the specified option(s) in style' do
72
- Style.map('label', :background=>[:active, '#694418']).should == true
73
- Style.map(:foreground=>[:disabled, '#B2B2B2', :active, '#FFE7CB']).should == true
73
+ it '#map sets dynamic values of the specified option(s) in style' do
74
+ Style.map('label', background: [:active, '#694418']).should == true
75
+ Style.map(foreground: [:disabled, '#B2B2B2', :active, '#FFE7CB']).should == true
74
76
  end
75
77
 
76
- it '#layout defines the widget layout for style' do
78
+ it '#layout defines the widget layout for style' do
77
79
  Style.layout('TButton', [
78
- 'Button.button', {:children=>[
79
- 'Button.focus', {:children=>[
80
- 'Button.padding', {:children=>[
81
- 'Button.label', {:expand=>true, :sticky=>''}
82
- ]}
83
- ]}
84
- ]}
85
- ]).should == true
80
+ 'Button.button', { children: [
81
+ 'Button.focus', { children: [
82
+ 'Button.padding', { children: [
83
+ 'Button.label', { expand: true, sticky: '' }
84
+ ] }
85
+ ] }
86
+ ] }
87
+ ]).should == true
86
88
 
87
89
  module Tk::Tile::TScrollbar; end
88
90
  style_name = Tk::Tile.style('Vertical', Tk::Tile::TScrollbar)
89
91
  style_name.should == 'Vertical.TScrollbar'
90
92
 
91
93
  Style.layout(style_name, [
92
- 'Checkbutton.background', # this is not needed in tile 0.5 or later
93
- 'Checkbutton.border', {:children=>[
94
- 'Checkbutton.padding', {:children=>[
95
- 'Checkbutton.indicator', {:side=>:left},
96
- 'Checkbutton.focus', {:side=>:left, :children=>[
97
- 'Checkbutton.label'
98
- ]}
99
- ]}
100
- ]}
101
- ]).should == true
94
+ 'Checkbutton.background', # this is not needed in tile 0.5 or later
95
+ 'Checkbutton.border', { children: [
96
+ 'Checkbutton.padding', { children: [
97
+ 'Checkbutton.indicator', { side: :left },
98
+ 'Checkbutton.focus', { side: :left, children: [
99
+ 'Checkbutton.label'
100
+ ] }
101
+ ] }
102
+ ] }
103
+ ]).should == true
102
104
  end
103
105
 
104
-
105
- it '#element_create creates a new element in the current theme' do
106
- Style.element_create('someElement','label').should == nil
107
- Style.element_names.should.not.include? "someElement"
106
+ it '#element_create creates a new element in the current theme' do
107
+ Style.element_create('someElement', 'label').should.nil?
108
+ Style.element_names.should.not.include? 'someElement'
109
+ Tk::Image.names.size.should == 4
108
110
 
109
111
  assets = {}
110
112
  assets['button-n'] = Tk::Image.create('photo').to_s
@@ -112,19 +114,17 @@ describe Tk::Tile::Style do
112
114
  assets['button-h'] = Tk::Image.create('photo').to_s
113
115
 
114
116
  Style.element_create('Button.button', :image,
115
- [ assets['button-n'],
116
- :pressed, assets['button-p'],
117
- :active, assets['button-h'],
118
- ], :border=>3, :sticky=>:ew)
117
+ [assets['button-n'],
118
+ :pressed, assets['button-p'],
119
+ :active, assets['button-h']], border: 3, sticky: :ew)
119
120
 
120
- Tk::Image.delete *assets.each_value
121
- Tk::Image.names.size.should == 0
121
+ Tk::Image.delete(*assets.each_value)
122
+ Tk::Image.names.size.should == 4
122
123
  end
123
124
 
124
- it '#theme_settings configure in the context of a theme' do
125
-
125
+ it '#theme_settings configure in the context of a theme' do
126
126
  res = Style.theme_settings 'alt' do
127
- Style.configure('label', foreground: :green ).should == true
127
+ Style.configure('label', foreground: :green).should == true
128
128
  Style.lookup('label', 'foreground').should == 'green'
129
129
  end
130
130
  res.should == 'alt'
@@ -133,9 +133,9 @@ describe Tk::Tile::Style do
133
133
  Style.lookup('label', 'foreground').should == 'black'
134
134
  end
135
135
 
136
- it '#theme_create creates a new theme' do
136
+ it '#theme_create creates a new theme' do
137
137
  # Creates a new theme. It is an error if themeName already exists.
138
- lambda { Style.theme_create('default') }.should.raise ArgumentError
138
+ -> { Style.theme_create('default') }.should.raise ArgumentError
139
139
 
140
140
  #
141
141
  Style.theme_create('spec-theme').should == true
@@ -147,15 +147,13 @@ describe Tk::Tile::Style do
147
147
 
148
148
  # If -settings is present, script is evaluated in the context of the new theme
149
149
  res = Style.theme_create('spec-theme-block', parent: 'default') do
150
- Style.configure('.', :background=>'#FCB64F',
151
- :troughcolor=>'#F8C278', :borderwidth=>1)
152
- Style.configure(:font=>Tk::Tile::Font::Default, :borderwidth=>1)
150
+ Style.configure('.', background: '#FCB64F',
151
+ troughcolor: '#F8C278', borderwidth: 1)
152
+ Style.configure(font: Tk::Tile::Font::Default, borderwidth: 1)
153
153
 
154
- Style.map('.', :background=>[:active, '#694418'])
155
- Style.map(:foreground=>[:disabled, '#B2B2B2', :active, '#FFE7CB'])
154
+ Style.map('.', background: [:active, '#694418'])
155
+ Style.map(foreground: [:disabled, '#B2B2B2', :active, '#FFE7CB'])
156
156
  end
157
157
  res.should == true
158
-
159
158
  end
160
-
161
159
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  describe Tk::Tile::Treeview do
@@ -13,16 +14,16 @@ describe Tk::Tile::Treeview do
13
14
  list.cget(:takefocus).should == false
14
15
  list.cget(:columns).should == []
15
16
  list.cget(:displaycolumns).should == ['#all']
16
- list.cget(:show).should == ['tree', 'headings']
17
+ list.cget(:show).should == %w(tree headings)
17
18
  list.cget(:selectmode).should == :extended
18
19
  list.cget(:height).should == 10
19
20
  list.cget(:padding).should == []
20
- list.cget(:xscrollcommand).should == nil
21
- list.cget(:yscrollcommand).should == nil
21
+ list.cget(:xscrollcommand).should.nil?
22
+ list.cget(:yscrollcommand).should.nil?
22
23
  list.cget(:takefocus).should == false
23
- list.cget(:cursor).should == nil
24
+ list.cget(:cursor).should.nil?
24
25
  list.cget(:style).should == []
25
- list.cget(:class).should == nil
26
+ list.cget(:class).should.nil?
26
27
  end
27
28
 
28
29
  it 'returns the widget state' do
@@ -31,9 +32,9 @@ describe Tk::Tile::Treeview do
31
32
 
32
33
  it 'executes a block if the state matches the spec' do
33
34
  value = nil
34
- list.instate('active'){ value = :active }
35
+ list.instate('active') { value = :active }
35
36
  value.should == :active
36
- list.instate('!active'){ value = :inactive }
37
+ list.instate('!active') { value = :inactive }
37
38
  value.should == :active
38
39
  end
39
40
 
@@ -53,7 +54,7 @@ describe Tk::Tile::Treeview do
53
54
  image: '',
54
55
  values: '',
55
56
  open: 0,
56
- tags: '',
57
+ tags: ''
57
58
  }
58
59
  end
59
60
 
@@ -63,7 +64,7 @@ describe Tk::Tile::Treeview do
63
64
  minwidth: 20,
64
65
  stretch: true,
65
66
  anchor: 'w',
66
- id: '',
67
+ id: ''
67
68
  }
68
69
  end
69
70
 
@@ -76,7 +77,7 @@ describe Tk::Tile::Treeview do
76
77
  end
77
78
 
78
79
  it 'gets parent of item' do
79
- @item0.parent.id.should == ''
80
+ @item0.parent.should.nil?
80
81
  end
81
82
 
82
83
  it 'detaches the item' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../helper'
2
3
 
3
4
  Tk.init
@@ -5,11 +6,11 @@ Tk.init
5
6
  describe Tk::Variable do
6
7
  it 'creates a Variable' do
7
8
  @var = Tk::Variable.new('somevar')
8
- @var.name.should == "somevar"
9
+ @var.name.should == 'somevar'
9
10
  end
10
11
 
11
12
  it 'cannot get a value from it yet' do
12
- lambda{ @var.get }.should.raise(NameError)
13
+ -> { @var.get }.should.raise(NameError)
13
14
  end
14
15
 
15
16
  it 'sets the value and retrieves it' do
@@ -19,6 +20,6 @@ describe Tk::Variable do
19
20
 
20
21
  it 'unsets the variable' do
21
22
  @var.unset
22
- lambda{ @var.get }.should.raise(NameError)
23
+ -> { @var.get }.should.raise(NameError)
23
24
  end
24
- end
25
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  describe Tk::Button do
@@ -5,10 +6,10 @@ describe Tk::Button do
5
6
  ran = false
6
7
  Tk.callbacks.size.should == 0
7
8
 
8
- button = Tk::Button.new{
9
+ button = Tk::Button.new do
9
10
  ran = true
10
11
  button.destroy
11
- }
12
+ end
12
13
  button.invoke
13
14
 
14
15
  Tk.callbacks.size.should == 0
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  describe Tk::Canvas do
@@ -12,18 +13,18 @@ describe Tk::Canvas do
12
13
  @text.id.should == 1
13
14
  @text.canvas.should == @canvas
14
15
 
15
- @text.activefill.should == nil
16
- @text.activestipple.should == nil
17
- @text.anchor.should == "center"
18
- @text.disabledfill.should == nil
19
- @text.disabledstipple.should == nil
20
- @text.fill.should == "black"
21
- @text.font.should == "TkDefaultFont"
16
+ @text.activefill.should.nil?
17
+ @text.activestipple.should.nil?
18
+ @text.anchor.should == 'center'
19
+ @text.disabledfill.should.nil?
20
+ @text.disabledstipple.should.nil?
21
+ @text.fill.should == 'black'
22
+ @text.font.should == 'TkDefaultFont'
22
23
  @text.justify.should == :left
23
- @text.state.should == nil
24
- @text.stipple.should == nil
24
+ @text.state.should.nil?
25
+ @text.stipple.should.nil?
25
26
  @text.tags.should == []
26
- @text.text.should == "Hello, World!"
27
+ @text.text.should == 'Hello, World!'
27
28
  @text.underline.should == -1
28
29
  @text.width.should == 0
29
30
  end
@@ -37,23 +38,23 @@ describe Tk::Canvas do
37
38
  @rect.activedash.should == 0
38
39
  @rect.disableddash.should == 0
39
40
  @rect.dashoffset.should == 0
40
- @rect.fill.should == nil
41
- @rect.activefill.should == nil
42
- @rect.disabledfill.should == nil
41
+ @rect.fill.should.nil?
42
+ @rect.activefill.should.nil?
43
+ @rect.disabledfill.should.nil?
43
44
  @rect.offset.should == '0,0'
44
45
  @rect.outline.should == 'black'
45
- @rect.activeoutline.should == nil
46
- @rect.disabledoutline.should == nil
46
+ @rect.activeoutline.should.nil?
47
+ @rect.disabledoutline.should.nil?
47
48
  @rect.outlineoffset.should == 0
48
- @rect.outlinestipple.should == nil
49
- @rect.activeoutlinestipple.should == nil
50
- @rect.disabledoutlinestipple.should == nil
51
- @rect.stipple.should == nil
52
- @rect.activestipple.should == nil
53
- @rect.disabledstipple.should == nil
54
- @rect.state.should == nil
49
+ @rect.outlinestipple.should.nil?
50
+ @rect.activeoutlinestipple.should.nil?
51
+ @rect.disabledoutlinestipple.should.nil?
52
+ @rect.stipple.should.nil?
53
+ @rect.activestipple.should.nil?
54
+ @rect.disabledstipple.should.nil?
55
+ @rect.state.should.nil?
55
56
  @rect.tags.should == []
56
- @rect.width.should == 0
57
+ @rect.width.should == 1
57
58
  @rect.activewidth.should == 0
58
59
  @rect.disabledwidth.should == 0
59
60
  end
@@ -67,23 +68,23 @@ describe Tk::Canvas do
67
68
  @arc.activedash.should == 0
68
69
  @arc.disableddash.should == 0
69
70
  @arc.dashoffset.should == 0
70
- @arc.fill.should == nil
71
- @arc.activefill.should == nil
72
- @arc.disabledfill.should == nil
71
+ @arc.fill.should.nil?
72
+ @arc.activefill.should.nil?
73
+ @arc.disabledfill.should.nil?
73
74
  @arc.offset.should == '0,0'
74
75
  @arc.outline.should == 'black'
75
- @arc.activeoutline.should == nil
76
- @arc.disabledoutline.should == nil
76
+ @arc.activeoutline.should.nil?
77
+ @arc.disabledoutline.should.nil?
77
78
  @arc.outlineoffset.should == 0.0
78
- @arc.outlinestipple.should == nil
79
- @arc.activeoutlinestipple.should == nil
80
- @arc.disabledoutlinestipple.should == nil
81
- @arc.stipple.should == nil
82
- @arc.activestipple.should == nil
83
- @arc.disabledstipple.should == nil
84
- @arc.state.should == nil
79
+ @arc.outlinestipple.should.nil?
80
+ @arc.activeoutlinestipple.should.nil?
81
+ @arc.disabledoutlinestipple.should.nil?
82
+ @arc.stipple.should.nil?
83
+ @arc.activestipple.should.nil?
84
+ @arc.disabledstipple.should.nil?
85
+ @arc.state.should.nil?
85
86
  @arc.tags.should == []
86
- @arc.width.should == 0
87
+ @arc.width.should == 1
87
88
  @arc.activewidth.should == 0
88
89
  @arc.disabledwidth.should == 0
89
90
  @arc.extent.should == 90.0
@@ -101,21 +102,21 @@ describe Tk::Canvas do
101
102
  @poly.disableddash.should == 0
102
103
  @poly.dashoffset.should == 0
103
104
  @poly.fill.should == 'black'
104
- @poly.activefill.should == nil
105
- @poly.disabledfill.should == nil
105
+ @poly.activefill.should.nil?
106
+ @poly.disabledfill.should.nil?
106
107
  @poly.offset.should == '0,0'
107
- @poly.outline.should == nil
108
- @poly.activeoutline.should == nil
109
- @poly.disabledoutline.should == nil
110
- @poly.outlinestipple.should == nil
111
- @poly.activeoutlinestipple.should == nil
112
- @poly.disabledoutlinestipple.should == nil
113
- @poly.stipple.should == nil
114
- @poly.activestipple.should == nil
115
- @poly.disabledstipple.should == nil
116
- @poly.state.should == nil
108
+ @poly.outline.should.nil?
109
+ @poly.activeoutline.should.nil?
110
+ @poly.disabledoutline.should.nil?
111
+ @poly.outlinestipple.should.nil?
112
+ @poly.activeoutlinestipple.should.nil?
113
+ @poly.disabledoutlinestipple.should.nil?
114
+ @poly.stipple.should.nil?
115
+ @poly.activestipple.should.nil?
116
+ @poly.disabledstipple.should.nil?
117
+ @poly.state.should.nil?
117
118
  @poly.tags.should == []
118
- @poly.width.should == 0
119
+ @poly.width.should == 1
119
120
  @poly.activewidth.should == 0
120
121
  @poly.disabledwidth.should == 0
121
122
  @poly.joinstyle.should == :round
@@ -133,18 +134,18 @@ describe Tk::Canvas do
133
134
  @line.disableddash.should == 0
134
135
  @line.dashoffset.should == 0
135
136
  @line.fill.should == 'black'
136
- @line.activefill.should == nil
137
- @line.disabledfill.should == nil
138
- @line.stipple.should == nil
139
- @line.activestipple.should == nil
140
- @line.disabledstipple.should == nil
141
- @line.state.should == nil
137
+ @line.activefill.should.nil?
138
+ @line.disabledfill.should.nil?
139
+ @line.stipple.should.nil?
140
+ @line.activestipple.should.nil?
141
+ @line.disabledstipple.should.nil?
142
+ @line.state.should.nil?
142
143
  @line.tags.should == []
143
- @line.width.should == 0
144
+ @line.width.should == 1
144
145
  @line.activewidth.should == 0
145
146
  @line.disabledwidth.should == 0
146
147
  @line.arrow.should == :none
147
- @line.arrowshape.should == ["8", "10", "3"]
148
+ @line.arrowshape.should == %w(8 10 3)
148
149
  @line.capstyle.should == :butt
149
150
  @line.joinstyle.should == :round
150
151
  @line.smooth.should == false
@@ -157,7 +158,7 @@ describe Tk::Canvas do
157
158
  @win.id.should == 6
158
159
  @win.canvas.should == @canvas
159
160
 
160
- @win.state.should == nil
161
+ @win.state.should.nil?
161
162
  @win.tags.should == []
162
163
  @win.anchor.should == 'center'
163
164
  @win.height.should == 0