ffi-tk 2010.08.23 → 2018.02.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +7 -0
- data/.rubocop_todo.yml +371 -0
- data/AUTHORS +4 -2
- data/CHANGELOG +302 -262
- data/Gemfile +10 -0
- data/Gemfile.lock +45 -0
- data/MANIFEST +6 -6
- data/README.md +1 -1
- data/Rakefile +12 -11
- data/bin/rwish +6 -5
- data/example/choose_color.rb +5 -4
- data/example/choose_directory.rb +5 -4
- data/example/dialog.rb +9 -8
- data/example/hello.rb +2 -1
- data/example/message_box.rb +8 -5
- data/example/option_menu.rb +4 -3
- data/example/popup.rb +4 -3
- data/example/set_palette.rb +5 -4
- data/example/text.rb +30 -30
- data/example/tile/kroc_demo_small.rb +51 -55
- data/example/tile/kroc_rb_demo.rb +74 -83
- data/example/tile/notebook.rb +6 -9
- data/example/tile/theme_hello.rb +6 -8
- data/example/tile/themes.rb +4 -2
- data/example/tile/treeview.rb +16 -14
- data/example/tkgo.rb +120 -88
- data/example/various.rb +8 -7
- data/example/wait.rb +3 -2
- data/ffi-tk.gemspec +21 -20
- data/gemset.nix +134 -0
- data/lib/ffi-tk.rb +10 -11
- data/lib/ffi-tk/command.rb +3 -2
- data/lib/ffi-tk/command/after.rb +8 -7
- data/lib/ffi-tk/command/bell.rb +2 -1
- data/lib/ffi-tk/command/bind.rb +1 -0
- data/lib/ffi-tk/command/bindtags.rb +1 -0
- data/lib/ffi-tk/command/cget.rb +31 -24
- data/lib/ffi-tk/command/choose_color.rb +2 -1
- data/lib/ffi-tk/command/choose_directory.rb +2 -1
- data/lib/ffi-tk/command/clipboard.rb +6 -5
- data/lib/ffi-tk/command/configure.rb +23 -21
- data/lib/ffi-tk/command/destroy.rb +2 -1
- data/lib/ffi-tk/command/dialog.rb +4 -3
- data/lib/ffi-tk/command/event.rb +1 -0
- data/lib/ffi-tk/command/focus.rb +2 -1
- data/lib/ffi-tk/command/font.rb +12 -9
- data/lib/ffi-tk/command/get_open_file.rb +1 -0
- data/lib/ffi-tk/command/get_save_file.rb +1 -0
- data/lib/ffi-tk/command/grab.rb +2 -1
- data/lib/ffi-tk/command/grid.rb +7 -6
- data/lib/ffi-tk/command/image.rb +5 -4
- data/lib/ffi-tk/command/lower.rb +1 -0
- data/lib/ffi-tk/command/message_box.rb +2 -1
- data/lib/ffi-tk/command/option_menu.rb +3 -2
- data/lib/ffi-tk/command/pack.rb +5 -4
- data/lib/ffi-tk/command/place.rb +5 -4
- data/lib/ffi-tk/command/popup.rb +2 -1
- data/lib/ffi-tk/command/raise.rb +1 -0
- data/lib/ffi-tk/command/scrollable.rb +7 -10
- data/lib/ffi-tk/command/selection.rb +4 -3
- data/lib/ffi-tk/command/set_palette.rb +2 -1
- data/lib/ffi-tk/command/tk_cmd.rb +1 -0
- data/lib/ffi-tk/command/vars.rb +2 -1
- data/lib/ffi-tk/command/wait.rb +2 -1
- data/lib/ffi-tk/command/winfo.rb +9 -8
- data/lib/ffi-tk/command/wm.rb +11 -10
- data/lib/ffi-tk/core_extensions.rb +5 -4
- data/lib/ffi-tk/event/data.rb +32 -31
- data/lib/ffi-tk/event/handler.rb +4 -3
- data/lib/ffi-tk/ffi/tcl.rb +42 -31
- data/lib/ffi-tk/ffi/tcl/cmd_proc.rb +2 -1
- data/lib/ffi-tk/ffi/tcl/eval_result.rb +47 -8
- data/lib/ffi-tk/ffi/tcl/interp.rb +7 -4
- data/lib/ffi-tk/ffi/tcl/obj.rb +7 -32
- data/lib/ffi-tk/ffi/tcl/time.rb +2 -1
- data/lib/ffi-tk/ffi/tk.rb +8 -7
- data/lib/ffi-tk/geometry.rb +20 -17
- data/lib/ffi-tk/thread_sender.rb +1 -0
- data/lib/ffi-tk/tk.rb +23 -23
- data/lib/ffi-tk/variable.rb +25 -3
- data/lib/ffi-tk/version.rb +1 -1
- data/lib/ffi-tk/widget.rb +2 -1
- data/lib/ffi-tk/widget/button.rb +4 -1
- data/lib/ffi-tk/widget/canvas.rb +18 -15
- data/lib/ffi-tk/widget/canvas/arc.rb +2 -1
- data/lib/ffi-tk/widget/canvas/bitmap.rb +2 -1
- data/lib/ffi-tk/widget/canvas/image.rb +2 -1
- data/lib/ffi-tk/widget/canvas/item.rb +4 -4
- data/lib/ffi-tk/widget/canvas/line.rb +2 -1
- data/lib/ffi-tk/widget/canvas/oval.rb +2 -1
- data/lib/ffi-tk/widget/canvas/polygon.rb +2 -1
- data/lib/ffi-tk/widget/canvas/rectangle.rb +2 -1
- data/lib/ffi-tk/widget/canvas/text.rb +2 -1
- data/lib/ffi-tk/widget/canvas/window.rb +2 -1
- data/lib/ffi-tk/widget/checkbutton.rb +4 -1
- data/lib/ffi-tk/widget/entry.rb +4 -1
- data/lib/ffi-tk/widget/frame.rb +4 -1
- data/lib/ffi-tk/widget/label.rb +4 -1
- data/lib/ffi-tk/widget/labelframe.rb +4 -1
- data/lib/ffi-tk/widget/listbox.rb +5 -2
- data/lib/ffi-tk/widget/menu.rb +4 -1
- data/lib/ffi-tk/widget/menubutton.rb +4 -1
- data/lib/ffi-tk/widget/message.rb +4 -1
- data/lib/ffi-tk/widget/panedwindow.rb +5 -2
- data/lib/ffi-tk/widget/radiobutton.rb +4 -1
- data/lib/ffi-tk/widget/root.rb +1 -0
- data/lib/ffi-tk/widget/scale.rb +4 -1
- data/lib/ffi-tk/widget/scrollbar.rb +4 -1
- data/lib/ffi-tk/widget/spinbox.rb +4 -1
- data/lib/ffi-tk/widget/text.rb +20 -16
- data/lib/ffi-tk/widget/text/peer.rb +1 -0
- data/lib/ffi-tk/widget/tile.rb +2 -1
- data/lib/ffi-tk/widget/tile/button.rb +4 -1
- data/lib/ffi-tk/widget/tile/checkbutton.rb +4 -1
- data/lib/ffi-tk/widget/tile/combobox.rb +5 -2
- data/lib/ffi-tk/widget/tile/entry.rb +4 -1
- data/lib/ffi-tk/widget/tile/frame.rb +4 -1
- data/lib/ffi-tk/widget/tile/label.rb +4 -2
- data/lib/ffi-tk/widget/tile/labelframe.rb +4 -1
- data/lib/ffi-tk/widget/tile/menubutton.rb +4 -1
- data/lib/ffi-tk/widget/tile/notebook.rb +4 -1
- data/lib/ffi-tk/widget/tile/panedwindow.rb +4 -1
- data/lib/ffi-tk/widget/tile/progressbar.rb +4 -2
- data/lib/ffi-tk/widget/tile/radiobutton.rb +4 -1
- data/lib/ffi-tk/widget/tile/scale.rb +4 -1
- data/lib/ffi-tk/widget/tile/scrollbar.rb +7 -4
- data/lib/ffi-tk/widget/tile/separator.rb +4 -1
- data/lib/ffi-tk/widget/tile/sizegrip.rb +4 -1
- data/lib/ffi-tk/widget/tile/style.rb +16 -17
- data/lib/ffi-tk/widget/tile/treeview.rb +11 -5
- data/lib/ffi-tk/widget/toplevel.rb +4 -1
- data/shell.nix +19 -0
- data/spec/ffi-tk/command/bind.rb +5 -4
- data/spec/ffi-tk/command/bindtags.rb +2 -1
- data/spec/ffi-tk/command/clipboard.rb +4 -3
- data/spec/ffi-tk/command/font.rb +20 -19
- data/spec/ffi-tk/command/image.rb +13 -5
- data/spec/ffi-tk/command/pack.rb +3 -2
- data/spec/ffi-tk/command/place.rb +4 -3
- data/spec/ffi-tk/command/selection.rb +2 -1
- data/spec/ffi-tk/command/vars.rb +3 -2
- data/spec/ffi-tk/command/winfo.rb +10 -10
- data/spec/ffi-tk/command/wm.rb +23 -22
- data/spec/ffi-tk/event.rb +23 -21
- data/spec/ffi-tk/tile/button.rb +8 -8
- data/spec/ffi-tk/tile/checkbutton.rb +1 -1
- data/spec/ffi-tk/tile/combobox.rb +11 -12
- data/spec/ffi-tk/tile/entry.rb +18 -19
- data/spec/ffi-tk/tile/frame.rb +13 -13
- data/spec/ffi-tk/tile/label.rb +2 -2
- data/spec/ffi-tk/tile/labelframe.rb +1 -1
- data/spec/ffi-tk/tile/menubutton.rb +1 -1
- data/spec/ffi-tk/tile/notebook.rb +22 -20
- data/spec/ffi-tk/tile/panedwindow.rb +1 -1
- data/spec/ffi-tk/tile/progressbar.rb +1 -1
- data/spec/ffi-tk/tile/radiobutton.rb +1 -1
- data/spec/ffi-tk/tile/scale.rb +1 -1
- data/spec/ffi-tk/tile/scrollbar.rb +1 -16
- data/spec/ffi-tk/tile/separator.rb +2 -2
- data/spec/ffi-tk/tile/sizegrip.rb +1 -1
- data/spec/ffi-tk/tile/style.rb +63 -65
- data/spec/ffi-tk/tile/treeview.rb +11 -10
- data/spec/ffi-tk/variable.rb +5 -4
- data/spec/ffi-tk/widget/button.rb +3 -2
- data/spec/ffi-tk/widget/canvas.rb +59 -58
- data/spec/ffi-tk/widget/checkbutton.rb +6 -5
- data/spec/ffi-tk/widget/entry.rb +112 -103
- data/spec/ffi-tk/widget/frame.rb +2 -1
- data/spec/ffi-tk/widget/label.rb +2 -1
- data/spec/ffi-tk/widget/labelframe.rb +1 -0
- data/spec/ffi-tk/widget/listbox.rb +5 -4
- data/spec/ffi-tk/widget/menu.rb +3 -2
- data/spec/ffi-tk/widget/menubutton.rb +1 -0
- data/spec/ffi-tk/widget/message.rb +1 -0
- data/spec/ffi-tk/widget/panedwindow.rb +1 -0
- data/spec/ffi-tk/widget/radiobutton.rb +1 -0
- data/spec/ffi-tk/widget/root.rb +2 -1
- data/spec/ffi-tk/widget/scale.rb +1 -0
- data/spec/ffi-tk/widget/scrollbar.rb +1 -0
- data/spec/ffi-tk/widget/spinbox.rb +1 -0
- data/spec/ffi-tk/widget/text.rb +63 -54
- data/spec/ffi-tk/widget/toplevel.rb +1 -0
- data/spec/helper.rb +3 -1
- data/tasks/authors.rake +3 -2
- data/tasks/bacon.rake +13 -11
- data/tasks/changelog.rake +1 -0
- data/tasks/gem.rake +13 -11
- data/tasks/manifest.rake +2 -1
- data/tasks/release.rake +11 -32
- data/tasks/reversion.rake +2 -1
- metadata +52 -75
- data/spec/ffi-tk/command/grid.rb +0 -6
- data/tasks/gem_setup.rake +0 -113
- data/tasks/grancher.rake +0 -12
- data/tasks/rcov.rake +0 -17
- data/tasks/setup.rake +0 -12
- data/tasks/ycov.rake +0 -84
data/spec/ffi-tk/tile/scale.rb
CHANGED
@@ -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
|
-
|
data/spec/ffi-tk/tile/style.rb
CHANGED
@@ -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
|
9
|
+
it '#theme_names returns a list of all known themes' do
|
9
10
|
names = Style.theme_names
|
10
11
|
|
11
|
-
names.should.
|
12
|
+
names.should.is_a? Array
|
12
13
|
names.should.not.be.empty?
|
13
|
-
names.all?{|i| i.
|
14
|
-
names.
|
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
|
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
|
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.
|
27
|
+
names.should.is_a? Array
|
26
28
|
names.should.not.be.empty?
|
27
|
-
names.all?{|i| i.
|
28
|
-
%w
|
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
|
33
|
+
it '#element_options returns the list of elements options' do
|
32
34
|
name = 'text'
|
33
|
-
options = %w
|
35
|
+
options = %w(-text -font -foreground -underline -width -anchor -justify -wraplength -embossed)
|
34
36
|
|
35
|
-
Style.element_options(name).should.
|
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
|
41
|
+
Style.element_options('unkown-element').should.nil?
|
40
42
|
end
|
41
43
|
|
42
|
-
it '#lookup
|
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')
|
45
|
-
Style.lookup('label', :foreground)
|
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
|
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'
|
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',
|
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
|
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
|
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
|
72
|
-
Style.map('label', :
|
73
|
-
Style.map(:
|
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
|
78
|
+
it '#layout defines the widget layout for style' do
|
77
79
|
Style.layout('TButton', [
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
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
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
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
|
-
|
106
|
-
Style.
|
107
|
-
|
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
|
-
|
116
|
-
|
117
|
-
|
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
|
121
|
-
Tk::Image.names.size.should ==
|
121
|
+
Tk::Image.delete(*assets.each_value)
|
122
|
+
Tk::Image.names.size.should == 4
|
122
123
|
end
|
123
124
|
|
124
|
-
it '#theme_settings
|
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
|
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
|
136
|
+
it '#theme_create creates a new theme' do
|
137
137
|
# Creates a new theme. It is an error if themeName already exists.
|
138
|
-
|
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('.', :
|
151
|
-
|
152
|
-
Style.configure(:
|
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('.', :
|
155
|
-
Style.map(:
|
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 ==
|
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
|
21
|
-
list.cget(:yscrollcommand).should
|
21
|
+
list.cget(:xscrollcommand).should.nil?
|
22
|
+
list.cget(:yscrollcommand).should.nil?
|
22
23
|
list.cget(:takefocus).should == false
|
23
|
-
list.cget(:cursor).should
|
24
|
+
list.cget(:cursor).should.nil?
|
24
25
|
list.cget(:style).should == []
|
25
|
-
list.cget(:class).should
|
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.
|
80
|
+
@item0.parent.should.nil?
|
80
81
|
end
|
81
82
|
|
82
83
|
it 'detaches the item' do
|
data/spec/ffi-tk/variable.rb
CHANGED
@@ -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 ==
|
9
|
+
@var.name.should == 'somevar'
|
9
10
|
end
|
10
11
|
|
11
12
|
it 'cannot get a value from it yet' do
|
12
|
-
|
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
|
-
|
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
|
16
|
-
@text.activestipple.should
|
17
|
-
@text.anchor.should ==
|
18
|
-
@text.disabledfill.should
|
19
|
-
@text.disabledstipple.should
|
20
|
-
@text.fill.should ==
|
21
|
-
@text.font.should ==
|
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
|
24
|
-
@text.stipple.should
|
24
|
+
@text.state.should.nil?
|
25
|
+
@text.stipple.should.nil?
|
25
26
|
@text.tags.should == []
|
26
|
-
@text.text.should ==
|
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
|
41
|
-
@rect.activefill.should
|
42
|
-
@rect.disabledfill.should
|
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
|
46
|
-
@rect.disabledoutline.should
|
46
|
+
@rect.activeoutline.should.nil?
|
47
|
+
@rect.disabledoutline.should.nil?
|
47
48
|
@rect.outlineoffset.should == 0
|
48
|
-
@rect.outlinestipple.should
|
49
|
-
@rect.activeoutlinestipple.should
|
50
|
-
@rect.disabledoutlinestipple.should
|
51
|
-
@rect.stipple.should
|
52
|
-
@rect.activestipple.should
|
53
|
-
@rect.disabledstipple.should
|
54
|
-
@rect.state.should
|
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 ==
|
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
|
71
|
-
@arc.activefill.should
|
72
|
-
@arc.disabledfill.should
|
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
|
76
|
-
@arc.disabledoutline.should
|
76
|
+
@arc.activeoutline.should.nil?
|
77
|
+
@arc.disabledoutline.should.nil?
|
77
78
|
@arc.outlineoffset.should == 0.0
|
78
|
-
@arc.outlinestipple.should
|
79
|
-
@arc.activeoutlinestipple.should
|
80
|
-
@arc.disabledoutlinestipple.should
|
81
|
-
@arc.stipple.should
|
82
|
-
@arc.activestipple.should
|
83
|
-
@arc.disabledstipple.should
|
84
|
-
@arc.state.should
|
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 ==
|
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
|
105
|
-
@poly.disabledfill.should
|
105
|
+
@poly.activefill.should.nil?
|
106
|
+
@poly.disabledfill.should.nil?
|
106
107
|
@poly.offset.should == '0,0'
|
107
|
-
@poly.outline.should
|
108
|
-
@poly.activeoutline.should
|
109
|
-
@poly.disabledoutline.should
|
110
|
-
@poly.outlinestipple.should
|
111
|
-
@poly.activeoutlinestipple.should
|
112
|
-
@poly.disabledoutlinestipple.should
|
113
|
-
@poly.stipple.should
|
114
|
-
@poly.activestipple.should
|
115
|
-
@poly.disabledstipple.should
|
116
|
-
@poly.state.should
|
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 ==
|
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
|
137
|
-
@line.disabledfill.should
|
138
|
-
@line.stipple.should
|
139
|
-
@line.activestipple.should
|
140
|
-
@line.disabledstipple.should
|
141
|
-
@line.state.should
|
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 ==
|
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 ==
|
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
|
161
|
+
@win.state.should.nil?
|
161
162
|
@win.tags.should == []
|
162
163
|
@win.anchor.should == 'center'
|
163
164
|
@win.height.should == 0
|