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
@@ -0,0 +1,19 @@
1
+ with (import <nixpkgs> {});
2
+ let
3
+ ruby = (ruby_2_4.override { useRailsExpress = false; });
4
+ gems = pkgs.bundlerEnv { name = "ffi-tk-gems"; inherit ruby; gemdir = ./.; };
5
+ bundler = pkgs.bundler.override { inherit ruby; };
6
+ bundix = pkgs.bundix.override { inherit bundler; };
7
+ in stdenv.mkDerivation rec {
8
+ name = "ffi-tk";
9
+ SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
10
+ TCL_LIBPATH = "${tcl-8_6}/lib/libtcl8.6.so";
11
+ TK_LIBPATH = "${tk}/lib/libtk8.6.so";
12
+ buildInputs = [
13
+ bashInteractive
14
+ pkgconfig
15
+ ruby bundler bundix gems
16
+ tcl-8_6 tk
17
+ zip
18
+ ];
19
+ }
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  describe Tk::Bind do
@@ -7,16 +8,16 @@ describe Tk::Bind do
7
8
 
8
9
  it 'should bind a block' do
9
10
  foo = false
10
- entry.bind('f'){ foo = true }
11
- Tk.interp.do_events_until{
11
+ entry.bind('f') { foo = true }
12
+ Tk.interp.do_events_until do
12
13
  Tk::Event.generate(entry, 'f')
13
14
  foo
14
- }
15
+ end
15
16
  foo.should == true
16
17
  end
17
18
 
18
19
  it 'should return the bound proc' do
19
- entry.bind('f').should == ' ::RubyFFI::event 0 f %# %b %c %d %f %h %i %k %m %o %p %s %t %w %x %y %A %B %D %E %K %N %P %R %S %T %W %X %Y '
20
+ entry.bind('f').should == ' ::RubyFFI::event 0 "f" %# %b %c %d %f %h %i %k %m %o %p %s %t %w %x %y %A %B %D %E %K %N %P %R %S %T %W %X %Y '
20
21
  end
21
22
 
22
23
  it 'should list the sequences bound' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  Tk.init
@@ -7,7 +8,7 @@ describe Tk::Bindtags do
7
8
  @entry.pack # only placed widgets have bindtags?
8
9
 
9
10
  it 'lists bindtags of a widget' do
10
- Tk::Bindtags.bindtags(@entry).should == [".entry0", "Entry", ".", "all"]
11
+ Tk::Bindtags.bindtags(@entry).should == ['.entry0', 'Entry', '.', 'all']
11
12
  end
12
13
 
13
14
  it 'reverses bindtags of a widget' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  Tk.init
@@ -7,12 +8,12 @@ describe Tk::Clipboard do
7
8
 
8
9
  it 'should clear the clipboard' do
9
10
  C.clear
10
- lambda{ C.get }.should.raise.message.
11
- should =~ /^CLIPBOARD selection doesn't exist or form "STRING" not defined/
11
+ -> { C.get }.should.raise.message
12
+ .should =~ /^CLIPBOARD selection doesn't exist or form "STRING" not defined/
12
13
  end
13
14
 
14
15
  it 'should append to the clipboard' do
15
16
  C.append data: 'something'
16
17
  C.get.should == 'something'
17
18
  end
18
- end
19
+ end
@@ -1,14 +1,15 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  Tk.init
4
5
 
5
6
  describe Tk::Font do
6
7
  it 'lists names of all named fonts' do
7
- Tk::Font.names.sort.should == [
8
- "TkCaptionFont", "TkDefaultFont", "TkFixedFont", "TkHeadingFont",
9
- "TkIconFont", "TkMenuFont", "TkSmallCaptionFont", "TkTextFont",
10
- "TkTooltipFont"
11
- ]
8
+ Tk::Font.names.sort.select { |name| name.match(/^Tk./) }.should == %w(
9
+ TkCaptionFont TkDefaultFont TkFixedFont TkHeadingFont
10
+ TkIconFont TkMenuFont TkSmallCaptionFont TkTextFont
11
+ TkTooltipFont
12
+ )
12
13
  end
13
14
 
14
15
  it 'measures a character' do
@@ -16,9 +17,9 @@ describe Tk::Font do
16
17
  end
17
18
 
18
19
  it 'shows metrics of a font' do
19
- Tk::Font.metrics('TkDefaultFont', :ascent).should == 12
20
+ Tk::Font.metrics('TkDefaultFont', :ascent).should >= 11
20
21
  Tk::Font.metrics('TkDefaultFont', :descent).should == 3
21
- Tk::Font.metrics('TkDefaultFont', :linespace).should == 15
22
+ Tk::Font.metrics('TkDefaultFont', :linespace).should >= 14
22
23
  Tk::Font.metrics('TkDefaultFont', :fixed).should == 0
23
24
  end
24
25
 
@@ -27,16 +28,16 @@ describe Tk::Font do
27
28
  end
28
29
 
29
30
  it 'creates a font' do
30
- Tk::Font.create('Awesome Font').should == "Awesome Font"
31
- Tk::Font.names.sort.should.include('Awesome Font')
31
+ Tk::Font.create('DejaVuSans').should == 'DejaVuSans'
32
+ Tk::Font.names.sort.should.include('DejaVuSans')
32
33
 
33
- lambda{
34
- Tk::Font.create('Awesome Font')
35
- }.should.raise.message =~ /^named font "Awesome Font" already exists/
34
+ lambda do
35
+ Tk::Font.create('DejaVuSans')
36
+ end.should.raise.message =~ /^named font "DejaVuSans" already exists/
36
37
  end
37
38
 
38
39
  it 'show configuration for our font' do
39
- conf = Tk::Font.configure('Awesome Font')
40
+ conf = Tk::Font.configure('DejaVuSans')
40
41
  conf[:family].should == ''
41
42
  conf[:size].should == 0
42
43
  conf[:weight].should == :normal
@@ -46,12 +47,12 @@ describe Tk::Font do
46
47
  end
47
48
 
48
49
  it 'manipulates configuration of our font' do
49
- Tk::Font.configure('Awesome Font', size: 10)
50
- Tk::Font.configure('Awesome Font')[:size].should == 10
50
+ Tk::Font.configure('DejaVuSans', size: 10)
51
+ Tk::Font.configure('DejaVuSans')[:size].should == 10
51
52
  end
52
53
 
53
54
  it 'shows actual information about the font' do
54
- conf = Tk::Font.actual('Awesome Font')
55
+ conf = Tk::Font.actual('DejaVuSans')
55
56
  conf[:family].should.not == ''
56
57
  conf[:size].should == 10
57
58
  conf[:weight].should == :normal
@@ -61,7 +62,7 @@ describe Tk::Font do
61
62
  end
62
63
 
63
64
  it 'deletes the font' do
64
- Tk::Font.delete('Awesome Font')
65
- Tk::Font.names.should.not.include('Awesome Font')
65
+ Tk::Font.delete('DejaVuSans')
66
+ Tk::Font.names.should.not.include('DejaVuSans')
66
67
  end
67
- end
68
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  Tk.init
@@ -5,22 +6,29 @@ Tk.init
5
6
  describe Tk::Image do
6
7
  Image = Tk::Image
7
8
 
9
+ extra_images = %w(
10
+ ::tk::icons::information
11
+ ::tk::icons::error
12
+ ::tk::icons::warning
13
+ ::tk::icons::question
14
+ )
15
+
8
16
  it 'creates photo image and return path' do
9
- Image.names.size.should == 0
17
+ Image.names.size.should == extra_images.size
10
18
  Image.create('photo').to_s.should == 'image1'
11
19
  Image.create('photo').to_s.should == 'image2'
12
- Image.names.should == ['image1', 'image2']
20
+ Image.names.sort.should == (extra_images + %w(image1 image2)).sort
13
21
 
14
22
  Image.delete('image1', 'image2')
15
- Image.names.size.should == 0
23
+ Image.names.size.should == extra_images.size
16
24
  end
17
25
 
18
26
  it 'creates bitmap image and return path' do
19
27
  Image.create('bitmap').to_s.should == 'image3'
20
- Image.names.should == ['image3']
28
+ Image.names.sort.should == (extra_images + %w(image3)).sort
21
29
  end
22
30
 
23
31
  it 'raise RuntimeError if wrong type' do
24
- lambda { Image.create('unkown-') }.should.raise RuntimeError
32
+ -> { Image.create('unkown-') }.should.raise RuntimeError
25
33
  end
26
34
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  Tk.init
@@ -15,6 +16,6 @@ describe Tk::Pack do
15
16
 
16
17
  it 'forgets the packing' do
17
18
  Tk::Pack.forget(@button)
18
- lambda{ Tk::Pack.info(@button) }.should.raise
19
+ -> { Tk::Pack.info(@button) }.should.raise
19
20
  end
20
- end
21
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  Tk.init
@@ -8,8 +9,8 @@ describe Tk::Place do
8
9
  it 'places a widget' do
9
10
  Tk::Place.place(@button, y: 42, x: 24)
10
11
  Tk::Place.info(@button).should == {
11
- in: ".", x: 24, relx: 0.0, y: 42, rely: 0.0, width: 0, relwidth: 0.0,
12
- height: 0, relheight: 0.0, anchor: "nw", bordermode: :inside
12
+ in: '.', x: 24, relx: 0.0, y: 42, rely: 0.0, width: 0, relwidth: 0.0,
13
+ height: 0, relheight: 0.0, anchor: 'nw', bordermode: :inside
13
14
  }
14
15
  end
15
16
 
@@ -17,4 +18,4 @@ describe Tk::Place do
17
18
  Tk::Place.forget(@button)
18
19
  Tk::Place.info(@button).should == {}
19
20
  end
20
- end
21
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  Tk.init
@@ -10,4 +11,4 @@ describe Tk::Selection do
10
11
  it 'gets selection' do
11
12
  Tk::Selection.get.should == 'abc'
12
13
  end
13
- end
14
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  Tk.init
@@ -27,6 +28,6 @@ describe 'tkvars' do
27
28
  end
28
29
 
29
30
  it 'does not have text_relayout set' do
30
- lambda{ Tk.text_relayout }.should.raise(NameError)
31
+ -> { Tk.text_relayout }.should.raise(NameError)
31
32
  end
32
- end
33
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  Tk.init
@@ -34,7 +35,7 @@ describe Tk::Winfo do
34
35
  end
35
36
 
36
37
  should 'not contain any coordinates yet' do
37
- root.winfo_containing(0, 0).should == nil
38
+ root.winfo_containing(0, 0).should.nil?
38
39
  end
39
40
 
40
41
  it 'tells us the depth of the window' do
@@ -84,12 +85,12 @@ describe Tk::Winfo do
84
85
  root.winfo_manager.should == 'wm'
85
86
  end
86
87
 
87
- it "knows its name" do
88
+ it 'knows its name' do
88
89
  root.winfo_name.should =~ /^tk/
89
90
  end
90
91
 
91
92
  it 'knows its parent' do
92
- root.winfo_parent.should == nil
93
+ root.winfo_parent.should.nil?
93
94
  entry.winfo_parent.should == root.tk_pathname
94
95
  end
95
96
 
@@ -98,11 +99,11 @@ describe Tk::Winfo do
98
99
  end
99
100
 
100
101
  it 'knows location of pointer x coordinate' do
101
- root.winfo_pointerx.class.should == Fixnum
102
+ root.winfo_pointerx.class.should == Integer
102
103
  end
103
104
 
104
105
  it 'knows location of pointer y coordinate' do
105
- root.winfo_pointery.class.should == Fixnum
106
+ root.winfo_pointery.class.should == Integer
106
107
  end
107
108
 
108
109
  # NOTE: hold still while the specs are running ;)
@@ -119,9 +120,9 @@ describe Tk::Winfo do
119
120
  end
120
121
 
121
122
  it 'gives r,g,b values of a color' do
122
- root.winfo_rgb('red').should == [65535, 0, 0]
123
- root.winfo_rgb('green').should == [0, 65535, 0]
124
- root.winfo_rgb('blue').should == [0, 0, 65535]
123
+ root.winfo_rgb('red').should == [65_535, 0, 0]
124
+ root.winfo_rgb('green').should == [0, 32_911, 0]
125
+ root.winfo_rgb('blue').should == [0, 0, 65_535]
125
126
  end
126
127
 
127
128
  it 'knows x coordinate of root window' do
@@ -194,7 +195,6 @@ describe Tk::Winfo do
194
195
  root.winfo_visualsavailable(:directcolor).should.not.be.empty
195
196
  end
196
197
 
197
-
198
198
  it 'knows the height of the virtual root window' do
199
199
  root.winfo_vrootheight.should >= 200
200
200
  end
@@ -223,7 +223,7 @@ describe Tk::Winfo do
223
223
  root.winfo_y.should == 0
224
224
  end
225
225
 
226
- # TODO check real screen values? (xrandr only)
226
+ # TODO: check real screen values? (xrandr only)
227
227
  # For now it checks for a minimum of 320 x 200
228
228
  #
229
229
  # matcher = /Screen (.+?)\: (.+), current (.+) x (.+), /
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../helper'
2
3
 
3
4
  Tk.init
@@ -14,9 +15,9 @@ describe Tk::WM do
14
15
  # * WM.iconposition
15
16
  # * WM.iconwindow
16
17
 
17
- describe "WM.aspect" do
18
+ describe 'WM.aspect' do
18
19
  should 'list current attributes' do
19
- root.wm_aspect.should == nil
20
+ root.wm_aspect.should.nil?
20
21
  end
21
22
 
22
23
  should 'set aspect ratio' do
@@ -26,7 +27,7 @@ describe Tk::WM do
26
27
 
27
28
  should 'remove aspect ratio' do
28
29
  root.wm_aspect = nil
29
- root.wm_aspect.should == nil
30
+ root.wm_aspect.should.nil?
30
31
  end
31
32
  end
32
33
 
@@ -56,25 +57,25 @@ describe Tk::WM do
56
57
  root.wm_attributes(:fullscreen).should == true
57
58
  root.wm_attributes(fullscreen: false)
58
59
 
59
- # TODO somehow fullscreen doesn't change back, on tk side.
60
- #Tk.interp.do_events_until do
60
+ # TODO: somehow fullscreen doesn't change back, on tk side.
61
+ # Tk.interp.do_events_until do
61
62
  # root.wm_attributes(:fullscreen) == false
62
- #end
63
+ # end
63
64
 
64
- #root.wm_attributes(:fullscreen).should == false
65
+ # root.wm_attributes(:fullscreen).should == false
65
66
  end
66
67
  end
67
68
 
68
69
  describe 'WM.client' do
69
70
  it 'has empty WM_CLIENT_MACHINE property' do
70
- root.wm_client.should == nil
71
+ root.wm_client.should.nil?
71
72
  end
72
73
 
73
74
  it 'sets WM_CLIENT_MACHINE property' do
74
75
  root.wm_client = 'foo'
75
76
  root.wm_client.should == 'foo'
76
77
  root.wm_client = nil
77
- root.wm_client.should == nil
78
+ root.wm_client.should.nil?
78
79
  end
79
80
  end
80
81
 
@@ -91,14 +92,14 @@ describe Tk::WM do
91
92
 
92
93
  describe 'WM.command' do
93
94
  it 'queries the WM_COMMAND property' do
94
- root.wm_command.should == []
95
+ root.wm_command.should.nil?
95
96
  end
96
97
 
97
98
  it 'sets queries the WM_COMMAND property' do
98
- root.wm_command = ['foo', 'bar']
99
- root.wm_command.should == ['foo', 'bar']
100
- root.wm_command = []
101
- root.wm_command.should == []
99
+ root.wm_command = %w(foo bar)
100
+ root.wm_command.should == %w(foo bar)
101
+ root.wm_command = nil
102
+ root.wm_command.should.nil?
102
103
  end
103
104
  end
104
105
 
@@ -145,18 +146,18 @@ describe Tk::WM do
145
146
 
146
147
  describe 'WM.grid' do
147
148
  it 'queries grid info when no grid is set' do
148
- root.wm_grid.should == nil
149
+ root.wm_grid.should.nil?
149
150
  end
150
151
 
151
152
  it 'sets a grid' do
152
- root.wm_grid = [1,1,1,1]
153
- root.wm_grid.should == [1,1,1,1]
153
+ root.wm_grid = [1, 1, 1, 1]
154
+ root.wm_grid.should == [1, 1, 1, 1]
154
155
  end
155
156
  end
156
157
 
157
158
  describe 'WM.group' do
158
159
  it 'queries group pathname' do
159
- root.wm_group.should == nil
160
+ root.wm_group.should.nil?
160
161
  end
161
162
 
162
163
  it 'sets group pathname' do
@@ -167,12 +168,12 @@ describe Tk::WM do
167
168
 
168
169
  describe 'WM.iconbitmap' do
169
170
  it 'queries iconbitmap' do
170
- root.wm_iconbitmap.should == nil
171
+ root.wm_iconbitmap.should.nil?
171
172
  end
172
173
 
173
174
  it 'sets iconbitmap' do
174
- lambda{ root.wm_iconbitmap = 'some.gif' }.
175
- should.raise.message.should =~ /^bitmap "some.gif" not defined/
175
+ -> { root.wm_iconbitmap = 'some.gif' }
176
+ .should.raise.message.should =~ /^bitmap "some.gif" not defined/
176
177
  end
177
178
  end
178
179
 
@@ -182,4 +183,4 @@ describe Tk::WM do
182
183
  root.wm_deiconify.should == true
183
184
  end
184
185
  end
185
- end
186
+ end