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,19 +1,21 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../helper'
2
3
 
3
4
  describe Tk::Event do
4
5
  it 'gives a list of defined virtual events' do
5
- Tk::Event.info.sort.should == [
6
- "<<Copy>>", "<<Cut>>", "<<Paste>>", "<<PasteSelection>>",
7
- "<<PrevWindow>>", "<<Redo>>", "<<Undo>>"
6
+ Tk::Event.info.sort.unshift('<<Clear>>').uniq.should == [
7
+ '<<Clear>>', '<<ContextMenu>>', '<<Copy>>', '<<Cut>>', '<<LineEnd>>', '<<LineStart>>', '<<NextChar>>', '<<NextLine>>', '<<NextPara>>', '<<NextWindow>>', '<<NextWord>>', '<<Paste>>', '<<PasteSelection>>', '<<PrevChar>>', '<<PrevLine>>', '<<PrevPara>>', '<<PrevWindow>>', '<<PrevWord>>', '<<Redo>>', '<<SelectAll>>', '<<SelectLineEnd>>', '<<SelectLineStart>>', '<<SelectNextChar>>', '<<SelectNextLine>>', '<<SelectNextPara>>', '<<SelectNextWord>>', '<<SelectNone>>', '<<SelectPrevChar>>', '<<SelectPrevLine>>', '<<SelectPrevPara>>', '<<SelectPrevWord>>', '<<ToggleSelection>>', '<<Undo>>'
8
8
  ]
9
+ # tk-aqua: <<Clear>>, ...
9
10
  end
10
11
 
11
12
  it 'shows what sequences invoke a specific virtual event' do
12
13
  info = Tk::Event.info('<<Paste>>')
13
- info.should.include '<Control-Key-v>'
14
14
  info.should.is_a? Array
15
- #"<Control-Key-v>", "<Key-F18>", "<Control-Key-y>"
16
- #"<Control-Key-v>", "<Key-F18>", "<Control-Lock-Key-V>", "<Control-Key-y>"
15
+ %w(<Control-Key-v> <Mod1-Key-v>).should.include info.first
16
+ # "<Control-Key-v>", "<Key-F18>", "<Control-Key-y>"
17
+ # "<Control-Key-v>", "<Key-F18>", "<Control-Lock-Key-V>", "<Control-Key-y>"
18
+ # tk-aqua: "<Mod1-Key-v>", "<Key-F4>", "<Control-Lock-Key-V>"
17
19
  end
18
20
 
19
21
  it 'adds a virtual event' do
@@ -32,20 +34,20 @@ describe Tk::Event do
32
34
  Tk::Event.add('<<Clear>>', '<BackSpace>')
33
35
 
34
36
  entry = Tk::Entry.new('.')
35
- entry.bind('<<Clear>>'){ entry.delete(0, :end) }
36
- entry.bind('<Map>'){
37
+ entry.bind('<<Clear>>') { entry.delete(0, :end) }
38
+ entry.bind('<Map>') do
37
39
  Tk::Event.generate(entry, '<<Clear>>')
38
40
  Tk.interp.do_one_event
39
- }
41
+ end
40
42
  entry.insert 0, 'Hello, World!'
41
43
  entry.get.should == 'Hello, World!'
42
44
 
43
45
  entry.pack
44
46
  entry.focus
45
47
 
46
- Tk.interp.do_events_until{
48
+ Tk.interp.do_events_until do
47
49
  entry.get.empty?
48
- }
50
+ end
49
51
 
50
52
  entry.get.should == ''
51
53
  end
@@ -54,21 +56,21 @@ describe Tk::Event do
54
56
  Tk::Event.add('<<Clear>>', '<BackSpace>')
55
57
 
56
58
  entry = Tk::Entry.new('.')
57
- entry.bind('<<Clear>>'){ entry.delete(0, :end) }
58
- entry.bind('<Map>'){
59
+ entry.bind('<<Clear>>') { entry.delete(0, :end) }
60
+ entry.bind('<Map>') do
59
61
  entry.focus
60
62
  Tk::Event.generate(entry, '<BackSpace>')
61
63
  Tk.interp.do_one_event
62
- }
64
+ end
63
65
  entry.insert 0, 'Hello, World!'
64
66
  entry.get.should == 'Hello, World!'
65
67
 
66
68
  entry.pack
67
69
  entry.focus
68
70
 
69
- Tk.interp.do_events_until{
71
+ Tk.interp.do_events_until do
70
72
  entry.get.empty?
71
- }
73
+ end
72
74
 
73
75
  entry.get.should == ''
74
76
  end
@@ -77,18 +79,18 @@ describe Tk::Event do
77
79
  entered = false
78
80
 
79
81
  entry = Tk::Entry.new('.')
80
- entry.bind('<Key>'){ entered = true; Tk.stop }
81
- entry.bind('<Map>'){
82
+ entry.bind('<Key>') { entered = true; Tk.stop }
83
+ entry.bind('<Map>') do
82
84
  entry.focus
83
85
  Tk::Event.generate(entry, '<KeyPress-a>')
84
- }
86
+ end
85
87
 
86
88
  entry.pack
87
89
  entry.focus
88
90
 
89
- Tk.interp.do_events_until{
91
+ Tk.interp.do_events_until do
90
92
  entered
91
- }
93
+ end
92
94
 
93
95
  entered.should == true
94
96
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  Tk.init
@@ -10,14 +11,14 @@ describe Tk::Tile::Button do
10
11
  button = Button.new('.')
11
12
  button.cget(:default).should == 'normal'
12
13
 
13
- %w{normal active disabled}.each do |state|
14
- button = Button.new('.', default: state )
14
+ %w(normal active disabled).each do |state|
15
+ button = Button.new('.', default: state)
15
16
  button.cget(:default).should == state
16
17
  end
17
18
 
18
- lambda {
19
+ lambda do
19
20
  Button.new('.', default: 'unkown-')
20
- }.should.raise RuntimeError
21
+ end.should.raise RuntimeError
21
22
  end
22
23
 
23
24
  it 'sets width and height' do
@@ -29,7 +30,7 @@ describe Tk::Tile::Button do
29
30
  button.cget(:width).should == i.to_i
30
31
 
31
32
  button = Button.new('.', width: i.to_f)
32
- button.cget(:width).should == 0
33
+ button.cget(:width).should == i.to_i
33
34
  end
34
35
  end
35
36
 
@@ -38,14 +39,13 @@ describe Tk::Tile::Button do
38
39
  ran = false
39
40
  Tk.callbacks.size.should == 0
40
41
 
41
- button = Button.new('.'){
42
+ button = Button.new('.') do
42
43
  ran = true
43
44
  button.destroy
44
- }
45
+ end
45
46
  button.invoke
46
47
 
47
48
  Tk.callbacks.size.should == 0
48
49
  ran.should == true
49
50
  end
50
51
  end
51
-
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  describe Tk::Tile::CheckButton do
@@ -10,4 +11,3 @@ describe Tk::Tile::CheckButton 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::ComboBox do
@@ -8,15 +9,15 @@ describe Tk::Tile::ComboBox do
8
9
  end
9
10
 
10
11
  it 'sets combobox values' do
11
- b = Tk::Tile::ComboBox.new Tk.root, values: ['a','b']
12
- b.configure(values: ['c','d']).should == true
12
+ b = Tk::Tile::ComboBox.new Tk.root, values: %w(a b)
13
+ b.configure(values: %w(c d)).should == true
13
14
  end
14
15
 
15
16
  it 'sets the current value' do
16
17
  var = Tk::Variable.new('somevar')
17
18
  var.set 'before_combobox'
18
19
 
19
- b = Tk::Tile::ComboBox.new Tk.root, textvariable: var, values: ['a','b']
20
+ b = Tk::Tile::ComboBox.new Tk.root, textvariable: var, values: %w(a b)
20
21
 
21
22
  b.current.should == -1
22
23
 
@@ -28,9 +29,9 @@ describe Tk::Tile::ComboBox do
28
29
  b.set('baz').should == true
29
30
  var.to_s.should == 'baz'
30
31
 
31
- lambda {
32
+ lambda do
32
33
  b.current(10).should == false
33
- }.should.raise RuntimeError
34
+ end.should.raise RuntimeError
34
35
  end
35
36
 
36
37
  it 'sets the value of the combobox to value' do
@@ -51,15 +52,13 @@ describe Tk::Tile::ComboBox do
51
52
  end
52
53
 
53
54
  it 'sets postcommand' do
54
- lambda {
55
+ lambda do
55
56
  Tk::Tile::ComboBox.new Tk.root, postcommand: proc {}
56
- }.should.not.raise RuntimeError
57
+ end.should.not.raise RuntimeError
57
58
 
58
- lambda {
59
+ lambda do
59
60
  b = Tk::Tile::ComboBox.new
60
- b.postcommand { }
61
- }.should.not.raise RuntimeError
61
+ b.postcommand {}
62
+ end.should.not.raise RuntimeError
62
63
  end
63
-
64
64
  end
65
-
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  Tk.init
@@ -9,18 +10,17 @@ describe Tk::Tile::Entry do
9
10
  it 'Returns the current value of the configuration option given' do
10
11
  Tk::Tile::Style.theme_use 'alt'
11
12
 
12
- @entry.cget(:width ).should >= 0
13
- @entry.cget(:exportselection ).should == true
14
- #@entry.cget(:font ).should == "TkTextFont"
15
- @entry.cget(:invalidcommand ).should == nil
16
- @entry.cget(:justify ).should == :left
17
- @entry.cget(:validate ).should == :none
18
- @entry.cget(:validatecommand ).should == nil
19
- @entry.cget(:width ).should == 20
20
- @entry.cget(:xscrollcommand ).should == nil
21
-
22
- @entry.cget(:takefocus ).should == false
23
- @entry.cget(:textvariable ).should == nil # ""
13
+ @entry.cget(:width).should >= 0
14
+ @entry.cget(:exportselection).should == true
15
+ @entry.cget(:font).should == 'TkTextFont'
16
+ @entry.cget(:invalidcommand).should.nil?
17
+ @entry.cget(:justify).should == :left
18
+ @entry.cget(:validate).should == :none
19
+ @entry.cget(:validatecommand).should.nil?
20
+ @entry.cget(:xscrollcommand).should.nil?
21
+
22
+ @entry.cget(:takefocus).should == false
23
+ @entry.cget(:textvariable).should.nil? # ""
24
24
  end
25
25
 
26
26
  it 'sets ttk-state independent of tk-state' do
@@ -32,7 +32,7 @@ describe Tk::Tile::Entry do
32
32
  @entry.state.should == ['active']
33
33
 
34
34
  @entry.state(:disabled).should == true
35
- @entry.state.should == ['active','disabled']
35
+ @entry.state.should == %w(active disabled)
36
36
 
37
37
  @entry.cget(:state).should == ['normal']
38
38
  end
@@ -43,19 +43,18 @@ describe Tk::Tile::Entry do
43
43
  @entry.cget(:state).should == ['disabled']
44
44
 
45
45
  @entry.state(:active).should == true
46
- @entry.state.should == ['active','disabled']
46
+ @entry.state.should == %w(active disabled)
47
47
 
48
48
  @entry.state(:disabled).should == true
49
- @entry.state.should == ['active','disabled']
49
+ @entry.state.should == %w(active disabled)
50
50
 
51
51
  @entry.cget(:state).should == ['disabled']
52
52
  end
53
53
 
54
- #NOTE fails on 'bacon spec/tile/*' but passes with 'ruby __FILE__'
55
- #it 'Configure the current value of cursor' do
54
+ # NOTE fails on 'bacon spec/tile/*' but passes with 'ruby __FILE__'
55
+ # it 'Configure the current value of cursor' do
56
56
  # @entry.cget(:cursor ).should == nil #"xterm"
57
57
  # @entry.configure(cursor: 'xterm').should == true
58
58
  # @entry.cget(:cursor ).should == 'xterm'
59
- #end
59
+ # end
60
60
  end
61
-
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  Tk.init
@@ -8,13 +9,13 @@ describe Tk::Tile::Frame do
8
9
 
9
10
  it 'creates a new frame with layout_style' do
10
11
  layout_style = [
11
- 'Button.button', {:children=>[
12
- 'Button.focus', {:children=>[
13
- 'Button.padding', {:children=>[
14
- 'Button.label', {:expand=>true, :sticky=>''}
15
- ]}
16
- ]}
17
- ]}
12
+ 'Button.button', { children: [
13
+ 'Button.focus', { children: [
14
+ 'Button.padding', { children: [
15
+ 'Button.label', { expand: true, sticky: '' }
16
+ ] }
17
+ ] }
18
+ ] }
18
19
  ]
19
20
 
20
21
  frame = Frame.new(Tk.root)
@@ -44,11 +45,11 @@ describe Tk::Tile::Frame do
44
45
 
45
46
  it 'sets cursor' do
46
47
  frame = Frame.new(Tk.root)
47
- frame.cget(:cursor).should == nil
48
+ frame.cget(:cursor).should.nil?
48
49
 
49
- lambda {
50
+ lambda do
50
51
  Frame.new(Tk.root, cursor: '.s.s.s.s')
51
- }.should.raise RuntimeError
52
+ end.should.raise RuntimeError
52
53
  end
53
54
 
54
55
  it 'sets additional padding to include inside the border' do
@@ -56,10 +57,9 @@ describe Tk::Tile::Frame do
56
57
  frame.cget(:padding).should == []
57
58
 
58
59
  frame = Frame.new(Tk.root, padding: 10)
59
- frame.cget(:padding).should == [ '10' ]
60
+ frame.cget(:padding).should == ['10']
60
61
 
61
62
  frame.configure padding: [10, 20]
62
- frame.cget(:padding).should == ['10', '20']
63
+ frame.cget(:padding).should == %w(10 20)
63
64
  end
64
65
  end
65
-
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  describe Tk::Tile::Label do
@@ -9,9 +10,8 @@ describe Tk::Tile::Label do
9
10
 
10
11
  it 'assigns a value' do
11
12
  label = Tk::Tile::Label.new
12
- label.value.should == nil
13
+ label.value.should.nil?
13
14
  label.value = 'Hello, World!'
14
15
  label.value.should == 'Hello, World!'
15
16
  end
16
17
  end
17
-
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  describe Tk::Tile::LabelFrame do
@@ -10,4 +11,3 @@ describe Tk::Tile::LabelFrame 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::MenuButton do
@@ -10,4 +11,3 @@ describe Tk::Tile::MenuButton 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
@@ -13,7 +14,7 @@ describe Tk::Tile::Notebook do
13
14
  f0 = Tk::Tile::Frame.new
14
15
  nb = Tk::Tile::Notebook.new
15
16
 
16
- nb.add( f0, text: 'first tab' ).should == true
17
+ nb.add(f0, text: 'first tab').should == true
17
18
  end
18
19
 
19
20
  it 'selects the specified tab' do
@@ -21,11 +22,13 @@ describe Tk::Tile::Notebook do
21
22
  f1 = Tk::Tile::Frame.new
22
23
 
23
24
  nb = Tk::Tile::Notebook.new
24
- nb.add( f0, text: 'first tab' ).should == true
25
- nb.add( f1, text: 'second tab' ).should == true
25
+ nb.add(f0, text: 'first tab').should == true
26
+ nb.add(f1, text: 'second tab').should == true
26
27
 
27
- nb.select(f1).should == f1.tk_pathname
28
- nb.select(f0).should == f0.tk_pathname
28
+ nb.select(f1).should.true?
29
+ nb.select.should == f1.tk_pathname
30
+ nb.select(f0).should.true?
31
+ nb.select.should == f0.tk_pathname
29
32
  end
30
33
 
31
34
  it 'return index of tabs' do
@@ -33,8 +36,8 @@ describe Tk::Tile::Notebook do
33
36
  f1 = Tk::Tile::Frame.new
34
37
 
35
38
  nb = Tk::Tile::Notebook.new
36
- nb.add( f0, text: 'first tab' ).should == true
37
- nb.add( f1, text: 'second tab' ).should == true
39
+ nb.add(f0, text: 'first tab').should == true
40
+ nb.add(f1, text: 'second tab').should == true
38
41
 
39
42
  nb.index(f1).should == 1
40
43
  nb.index(f0).should == 0
@@ -47,8 +50,8 @@ describe Tk::Tile::Notebook do
47
50
  nb = Tk::Tile::Notebook.new
48
51
 
49
52
  nb.tabs.should == []
50
- nb.add( f2, text: 'first tab' ).should == true
51
- nb.tabs.should == [ f2.tk_pathname ]
53
+ nb.add(f2, text: 'first tab').should == true
54
+ nb.tabs.should == [f2.tk_pathname]
52
55
  end
53
56
 
54
57
  it 'inserts a new tab at position' do
@@ -56,19 +59,19 @@ describe Tk::Tile::Notebook do
56
59
  f1 = Tk::Tile::Frame.new
57
60
  nb = Tk::Tile::Notebook.new
58
61
 
59
- nb.add( f0, text: 'first tab' ).should == true
60
- nb.insert( 0, f1, text: 'first tab' ).should == true
62
+ nb.add(f0, text: 'first tab').should == true
63
+ nb.insert(0, f1, text: 'first tab').should == true
61
64
 
62
- nb.tabs.should == [ f1.tk_pathname, f0.tk_pathname ]
65
+ nb.tabs.should == [f1.tk_pathname, f0.tk_pathname]
63
66
  end
64
67
 
65
68
  it 'set tab options' do
66
69
  f2 = Tk::Tile::Frame.new
67
70
  nb = Tk::Tile::Notebook.new
68
71
 
69
- nb.add(f2, text: 'first tab' ).should == true
72
+ nb.add(f2, text: 'first tab').should == true
70
73
 
71
- nb.tab(f2, state: :disabled ).should == true
74
+ nb.tab(f2, state: :disabled).should == true
72
75
  nb.tab(f2).should.include 'disabled'
73
76
  end
74
77
 
@@ -76,21 +79,21 @@ describe Tk::Tile::Notebook do
76
79
  f2 = Tk::Tile::Frame.new
77
80
  nb = Tk::Tile::Notebook.new
78
81
 
79
- nb.add( f2, text: 'first tab' ).should == true
80
- nb.tabs.should == [ f2.tk_pathname ]
82
+ nb.add(f2, text: 'first tab').should == true
83
+ nb.tabs.should == [f2.tk_pathname]
81
84
 
82
85
  nb.forget(f2).should == true
83
- nb.tabs.should == [ ]
86
+ nb.tabs.should == []
84
87
  end
85
88
 
86
89
  it 'hides a specified tab' do
87
90
  f2 = Tk::Tile::Frame.new
88
91
  nb = Tk::Tile::Notebook.new
89
92
 
90
- nb.add( f2, text: 'first tab' ).should == true
93
+ nb.add(f2, text: 'first tab').should == true
91
94
 
92
95
  nb.hide(f2).should == true
93
- nb.tabs.should == [ f2.tk_pathname ]
96
+ nb.tabs.should == [f2.tk_pathname]
94
97
  end
95
98
 
96
99
  it 'enables traversal' do
@@ -100,4 +103,3 @@ describe Tk::Tile::Notebook do
100
103
  Tk::Tile::Notebook.enable_traversal(nb).should == true
101
104
  end
102
105
  end
103
-