gir_ffi-gtk 0.14.1 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +6 -0
- data/Rakefile +2 -0
- data/lib/gir_ffi-gtk/gtk2/menu.rb +27 -0
- data/lib/gir_ffi-gtk2.rb +1 -1
- data/lib/gir_ffi-gtk3.rb +0 -1
- data/test/callback_exceptions_test.rb +5 -7
- data/test/gir_ffi-gtk/action_test.rb +4 -2
- data/test/gir_ffi-gtk/base_test.rb +3 -1
- data/test/gir_ffi-gtk/builder_test.rb +5 -3
- data/test/gir_ffi-gtk/button_test.rb +4 -2
- data/test/gir_ffi-gtk/container_test.rb +6 -4
- data/test/gir_ffi-gtk/dialog_test.rb +5 -3
- data/test/gir_ffi-gtk/file_chooser_dialog_test.rb +6 -4
- data/test/gir_ffi-gtk/generated_gtk_test.rb +4 -2
- data/test/gir_ffi-gtk/image_test.rb +8 -6
- data/test/gir_ffi-gtk/list_store_test.rb +8 -6
- data/test/gir_ffi-gtk/menu_test.rb +4 -12
- data/test/gir_ffi-gtk/message_dialog_test.rb +4 -2
- data/test/gir_ffi-gtk/radio_action_test.rb +3 -1
- data/test/gir_ffi-gtk/radio_button_test.rb +6 -4
- data/test/gir_ffi-gtk/target_entry_test.rb +8 -6
- data/test/gir_ffi-gtk/tree_path_test.rb +4 -2
- data/test/gir_ffi-gtk/tree_store_test.rb +8 -6
- data/test/gir_ffi-gtk/tree_view_column_test.rb +7 -5
- data/test/gir_ffi-gtk/widget_test.rb +13 -11
- data/test/test_helper.rb +2 -0
- metadata +11 -12
- data/lib/gir_ffi-gtk/menu.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d45b72cccc0ec948d74f745d823939e5ac7e48ae69d68ff5c97ddf43b39ec01
|
4
|
+
data.tar.gz: a5249e2bfc4c7473f7bd52c52f8de200f5fa126a07fb53e2b95a0294ef5dacaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74415a42a27ea38dd77dedcbfeb2e429f8c41cd702d9ddcfeb7763c0722a2d40d6c997c0887f2279e86ef98ca298ee899bdc113e795eb4aea0c408148b47b3ef
|
7
|
+
data.tar.gz: b24ee409eaca856b8c3662fad01b85cecf95cc74add4c9b50dc8dbebebceda61cb74c83407df3e8570891fc7405e5fec92d9d131de1bd379f5b3c310e1acd6e5
|
data/Changelog.md
CHANGED
@@ -3,6 +3,12 @@
|
|
3
3
|
All notable changes to this project will be documented in this file. See the
|
4
4
|
Git log for all changes.
|
5
5
|
|
6
|
+
## 0.15.0 / 2019-10-19
|
7
|
+
|
8
|
+
* Fix override for `Gtk::Menu#popup`
|
9
|
+
* Depend on GirFFI 0.15.0
|
10
|
+
* Target Ruby 2.4+
|
11
|
+
|
6
12
|
## 0.14.1 / 2018-12-19
|
7
13
|
|
8
14
|
* Override `Gtk::Widget#get_events`, `Gtk::Widget#set_events` and
|
data/Rakefile
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Gtk.load_class :Menu
|
4
|
+
module Gtk
|
5
|
+
# Add non-introspected functions to Gtk::Lib
|
6
|
+
module Lib
|
7
|
+
attach_function(:gtk_menu_popup,
|
8
|
+
[:pointer, :pointer, :pointer,
|
9
|
+
:pointer, :pointer,
|
10
|
+
:uint, :uint32 ],
|
11
|
+
:void)
|
12
|
+
end
|
13
|
+
|
14
|
+
# Overrides for GtkMenu
|
15
|
+
class Menu
|
16
|
+
def popup(parent_menu_shell, parent_menu_item, button, activate_time, &func)
|
17
|
+
_v1 = Gtk::Widget.from(parent_menu_shell)
|
18
|
+
_v2 = Gtk::Widget.from(parent_menu_item)
|
19
|
+
_v3 = Gtk::MenuPositionFunc.from(func)
|
20
|
+
_v4 = GirFFI::ArgHelper.store(_v3)
|
21
|
+
_v5 = button
|
22
|
+
_v6 = activate_time
|
23
|
+
Gtk::Lib.gtk_menu_popup self, _v1, _v2, _v3, _v4, _v5, _v6
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
data/lib/gir_ffi-gtk2.rb
CHANGED
@@ -13,7 +13,6 @@ require 'gir_ffi-gtk/dialog'
|
|
13
13
|
require 'gir_ffi-gtk/file_chooser_dialog'
|
14
14
|
require 'gir_ffi-gtk/image'
|
15
15
|
require 'gir_ffi-gtk/list_store'
|
16
|
-
require 'gir_ffi-gtk/menu'
|
17
16
|
require 'gir_ffi-gtk/message_dialog'
|
18
17
|
require 'gir_ffi-gtk/tree_path'
|
19
18
|
require 'gir_ffi-gtk/tree_store'
|
@@ -21,6 +20,7 @@ require 'gir_ffi-gtk/tree_view_column'
|
|
21
20
|
require 'gir_ffi-gtk/widget'
|
22
21
|
|
23
22
|
require 'gir_ffi-gtk/gtk2/list_store'
|
23
|
+
require 'gir_ffi-gtk/gtk2/menu'
|
24
24
|
require 'gir_ffi-gtk/gtk2/radio_action'
|
25
25
|
require 'gir_ffi-gtk/gtk2/radio_button'
|
26
26
|
require 'gir_ffi-gtk/gtk2/target_entry'
|
data/lib/gir_ffi-gtk3.rb
CHANGED
@@ -13,7 +13,6 @@ require 'gir_ffi-gtk/dialog'
|
|
13
13
|
require 'gir_ffi-gtk/file_chooser_dialog'
|
14
14
|
require 'gir_ffi-gtk/image'
|
15
15
|
require 'gir_ffi-gtk/list_store'
|
16
|
-
require 'gir_ffi-gtk/menu'
|
17
16
|
require 'gir_ffi-gtk/message_dialog'
|
18
17
|
require 'gir_ffi-gtk/tree_path'
|
19
18
|
require 'gir_ffi-gtk/tree_store'
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
class CallbackTestException < RuntimeError; end
|
@@ -14,7 +16,7 @@ describe 'An exception in a callback' do
|
|
14
16
|
|
15
17
|
describe 'when the signal is emitted synchronously' do
|
16
18
|
it 'raises an error' do
|
17
|
-
-> { GObject.signal_emit object, 'destroy' }.must_raise CallbackTestException
|
19
|
+
_(-> { GObject.signal_emit object, 'destroy' }).must_raise CallbackTestException
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
@@ -26,9 +28,7 @@ describe 'An exception in a callback' do
|
|
26
28
|
end
|
27
29
|
# Guard against runaway loop
|
28
30
|
@guard = GLib.timeout_add(GLib::PRIORITY_DEFAULT, 1000) { Gtk.main_quit }
|
29
|
-
|
30
|
-
Gtk.main
|
31
|
-
end.must_raise CallbackTestException
|
31
|
+
_(-> { Gtk.main }).must_raise CallbackTestException
|
32
32
|
end
|
33
33
|
|
34
34
|
after do
|
@@ -45,9 +45,7 @@ describe 'An exception in a callback' do
|
|
45
45
|
end
|
46
46
|
# Guard against runaway loop
|
47
47
|
@guard = GLib.timeout_add(GLib::PRIORITY_DEFAULT, 1000) { Gtk.main_quit }
|
48
|
-
|
49
|
-
Gtk.main
|
50
|
-
end.must_raise CallbackTestException
|
48
|
+
_(-> { Gtk.main }).must_raise CallbackTestException
|
51
49
|
end
|
52
50
|
|
53
51
|
after do
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
describe Gtk::Action do
|
@@ -6,12 +8,12 @@ describe Gtk::Action do
|
|
6
8
|
describe '#create_icon' do
|
7
9
|
it 'works when called with a symbol' do
|
8
10
|
result = action.create_icon :dialog
|
9
|
-
result.must_be_instance_of Gtk::Image
|
11
|
+
_(result).must_be_instance_of Gtk::Image
|
10
12
|
end
|
11
13
|
|
12
14
|
it 'works when called with an integer' do
|
13
15
|
result = action.create_icon 4
|
14
|
-
result.must_be_instance_of Gtk::Image
|
16
|
+
_(result).must_be_instance_of Gtk::Image
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
describe Gtk::Builder do
|
@@ -31,7 +33,7 @@ describe Gtk::Builder do
|
|
31
33
|
nil
|
32
34
|
end
|
33
35
|
|
34
|
-
name.must_equal 'on_button_clicked'
|
36
|
+
_(name).must_equal 'on_button_clicked'
|
35
37
|
end
|
36
38
|
|
37
39
|
it 'connects the signal to the proc returned by the block' do
|
@@ -41,7 +43,7 @@ describe Gtk::Builder do
|
|
41
43
|
end
|
42
44
|
button = builder.get_object('foo')
|
43
45
|
GObject.signal_emit button, 'clicked'
|
44
|
-
name.must_equal 'on_button_clicked'
|
46
|
+
_(name).must_equal 'on_button_clicked'
|
45
47
|
end
|
46
48
|
|
47
49
|
describe 'with a signal with after flag' do
|
@@ -63,7 +65,7 @@ describe Gtk::Builder do
|
|
63
65
|
end
|
64
66
|
button = builder.get_object('foo')
|
65
67
|
GObject.signal_emit button, 'clicked'
|
66
|
-
name.must_equal 'handler_after'
|
68
|
+
_(name).must_equal 'handler_after'
|
67
69
|
end
|
68
70
|
end
|
69
71
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
describe Gtk::Button do
|
@@ -8,12 +10,12 @@ describe Gtk::Button do
|
|
8
10
|
|
9
11
|
it 'works when called with a symbol' do
|
10
12
|
result = Gtk::Button.new_from_icon_name('hi', :dialog)
|
11
|
-
result.must_be_instance_of Gtk::Button
|
13
|
+
_(result).must_be_instance_of Gtk::Button
|
12
14
|
end
|
13
15
|
|
14
16
|
it 'works when called with an integer' do
|
15
17
|
result = Gtk::Button.new_from_icon_name('hi', 4)
|
16
|
-
result.must_be_instance_of Gtk::Button
|
18
|
+
_(result).must_be_instance_of Gtk::Button
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
describe Gtk::Container do
|
@@ -10,11 +12,11 @@ describe Gtk::Container do
|
|
10
12
|
end
|
11
13
|
|
12
14
|
it 'adds the widget to the container' do
|
13
|
-
container.get_children.to_a.must_equal [widget]
|
15
|
+
_(container.get_children.to_a).must_equal [widget]
|
14
16
|
end
|
15
17
|
|
16
18
|
it 'sets the child properties for the widget' do
|
17
|
-
container.child_get_property(widget, 'left-attach').must_equal 1
|
19
|
+
_(container.child_get_property(widget, 'left-attach')).must_equal 1
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
@@ -22,12 +24,12 @@ describe Gtk::Container do
|
|
22
24
|
it 'fetches the given child property' do
|
23
25
|
container.add widget
|
24
26
|
container.child_set_property(widget, 'left-attach', 1)
|
25
|
-
container.child_get_property(widget, 'left-attach').must_equal 1
|
27
|
+
_(container.child_get_property(widget, 'left-attach')).must_equal 1
|
26
28
|
end
|
27
29
|
|
28
30
|
it 'raises an ArgumentError for unknown properties' do
|
29
31
|
container.add widget
|
30
|
-
proc { container.child_get_property(widget, 'foobar') }.must_raise ArgumentError
|
32
|
+
_(proc { container.child_get_property(widget, 'foobar') }).must_raise ArgumentError
|
31
33
|
end
|
32
34
|
end
|
33
35
|
end
|
@@ -1,13 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
describe Gtk::Dialog do
|
4
6
|
describe '.new_with_buttons' do
|
5
7
|
it 'creates a Gtk::Dialog with the right title and buttons' do
|
6
8
|
dialog = Gtk::Dialog.new_with_buttons 'Foo', nil, :modal, [['Bar', :yes]]
|
7
|
-
dialog.title.must_equal 'Foo'
|
9
|
+
_(dialog.title).must_equal 'Foo'
|
8
10
|
button = dialog.action_area.children.first
|
9
|
-
button.label.must_equal 'Bar'
|
10
|
-
dialog.response_for_widget(button).must_equal Gtk::ResponseType.to_int(:yes)
|
11
|
+
_(button.label).must_equal 'Bar'
|
12
|
+
_(dialog.response_for_widget(button)).must_equal Gtk::ResponseType.to_int(:yes)
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
@@ -1,18 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
describe Gtk::FileChooserDialog do
|
4
6
|
describe '.new' do
|
5
7
|
it 'creates a Gtk::FileChooserDialog with the right attributes' do
|
6
8
|
dialog = Gtk::FileChooserDialog.new 'Foo', nil, :save, [['Bar', :yes]]
|
7
|
-
dialog.title.must_equal 'Foo'
|
8
|
-
dialog.action.must_equal :save
|
9
|
+
_(dialog.title).must_equal 'Foo'
|
10
|
+
_(dialog.action).must_equal :save
|
9
11
|
button = if Gtk::MAJOR_VERSION == 3 && Gtk::MINOR_VERSION >= 12
|
10
12
|
dialog.header_bar.children.to_a.last
|
11
13
|
else
|
12
14
|
dialog.action_area.children.to_a.last
|
13
15
|
end
|
14
|
-
button.label.must_equal 'Bar'
|
15
|
-
dialog.response_for_widget(button).must_equal Gtk::ResponseType.to_int(:yes)
|
16
|
+
_(button.label).must_equal 'Bar'
|
17
|
+
_(dialog.response_for_widget(button)).must_equal Gtk::ResponseType.to_int(:yes)
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
# Tests generated methods and functions in the Gtk namespace.
|
@@ -39,9 +41,9 @@ describe 'In the generated Gtk module' do
|
|
39
41
|
assert_instance_of Gtk::Button, o
|
40
42
|
assert_equal 'clicked', sn
|
41
43
|
assert_equal 'on_button_clicked', hn
|
42
|
-
co.must_be_nil
|
44
|
+
_(co).must_be_nil
|
43
45
|
assert_equal 0, f
|
44
|
-
ud.wont_be_nil
|
46
|
+
_(ud).wont_be_nil
|
45
47
|
end
|
46
48
|
end
|
47
49
|
end
|
@@ -1,15 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
describe Gtk::Image do
|
4
6
|
describe '.new_from_icon_name' do
|
5
7
|
it 'works when called with a symbol' do
|
6
8
|
result = Gtk::Image.new_from_icon_name('hi', :dialog)
|
7
|
-
result.must_be_instance_of Gtk::Image
|
9
|
+
_(result).must_be_instance_of Gtk::Image
|
8
10
|
end
|
9
11
|
|
10
12
|
it 'works when called with an integer' do
|
11
13
|
result = Gtk::Image.new_from_icon_name('hi', 4)
|
12
|
-
result.must_be_instance_of Gtk::Image
|
14
|
+
_(result).must_be_instance_of Gtk::Image
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
@@ -17,12 +19,12 @@ describe Gtk::Image do
|
|
17
19
|
let(:gicon) { Gio::ThemedIcon.new('hi') }
|
18
20
|
it 'works when called with a symbol' do
|
19
21
|
result = Gtk::Image.new_from_gicon(gicon, :dialog)
|
20
|
-
result.must_be_instance_of Gtk::Image
|
22
|
+
_(result).must_be_instance_of Gtk::Image
|
21
23
|
end
|
22
24
|
|
23
25
|
it 'works when called with an integer' do
|
24
26
|
result = Gtk::Image.new_from_gicon(gicon, 4)
|
25
|
-
result.must_be_instance_of Gtk::Image
|
27
|
+
_(result).must_be_instance_of Gtk::Image
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
@@ -32,12 +34,12 @@ describe Gtk::Image do
|
|
32
34
|
|
33
35
|
it 'works when called with a symbol' do
|
34
36
|
image.set_from_gicon(gicon, :dialog)
|
35
|
-
image.get_gicon.must_equal [gicon, 6]
|
37
|
+
_(image.get_gicon).must_equal [gicon, 6]
|
36
38
|
end
|
37
39
|
|
38
40
|
it 'works when called with an integer' do
|
39
41
|
image.set_from_gicon(gicon, 4)
|
40
|
-
image.get_gicon.must_equal [gicon, 4]
|
42
|
+
_(image.get_gicon).must_equal [gicon, 4]
|
41
43
|
end
|
42
44
|
end
|
43
45
|
end
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
describe Gtk::ListStore do
|
4
6
|
describe '.new' do
|
5
7
|
it 'takes an array of column types' do
|
6
8
|
store = Gtk::ListStore.new([GObject::TYPE_STRING, GObject::TYPE_INT])
|
7
|
-
store.must_be_instance_of Gtk::ListStore
|
9
|
+
_(store).must_be_instance_of Gtk::ListStore
|
8
10
|
end
|
9
11
|
end
|
10
12
|
|
@@ -12,8 +14,8 @@ describe Gtk::ListStore do
|
|
12
14
|
it 'inserts a row with the given values' do
|
13
15
|
store = Gtk::ListStore.new([GObject::TYPE_STRING, GObject::TYPE_INT])
|
14
16
|
row = store.insert_with_values(0, [0, 1], ['foo', 42])
|
15
|
-
store.get_value(row, 0).must_equal 'foo'
|
16
|
-
store.get_value(row, 1).must_equal 42
|
17
|
+
_(store.get_value(row, 0)).must_equal 'foo'
|
18
|
+
_(store.get_value(row, 1)).must_equal 42
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
@@ -22,8 +24,8 @@ describe Gtk::ListStore do
|
|
22
24
|
store = Gtk::ListStore.new([GObject::TYPE_STRING, GObject::TYPE_INT])
|
23
25
|
row = store.insert_with_values(0, [0, 1], ['foo', 42])
|
24
26
|
store.set(row, [1, 0], [3, 'bar'])
|
25
|
-
store.get_value(row, 0).must_equal 'bar'
|
26
|
-
store.get_value(row, 1).must_equal 3
|
27
|
+
_(store.get_value(row, 0)).must_equal 'bar'
|
28
|
+
_(store.get_value(row, 1)).must_equal 3
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
@@ -32,7 +34,7 @@ describe Gtk::ListStore do
|
|
32
34
|
store = Gtk::ListStore.new([GObject::TYPE_STRING, GObject::TYPE_INT])
|
33
35
|
row = store.insert_with_values(0, [0, 1], ['foo', 42])
|
34
36
|
store.set_value(row, 0, nil)
|
35
|
-
store.get_value(row, 0).must_be_nil
|
37
|
+
_(store.get_value(row, 0)).must_be_nil
|
36
38
|
end
|
37
39
|
end
|
38
40
|
end
|
@@ -1,20 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
describe Gtk::Menu do
|
4
6
|
describe '#popup' do
|
5
|
-
it '
|
6
|
-
default_method = GObjectIntrospection::IRepository.default.
|
7
|
-
find_by_name('Gtk', 'Menu').
|
8
|
-
find_method('popup')
|
9
|
-
skip 'No overrided needed for Gtk::Menu#popup' if default_method
|
7
|
+
it 'can be called with 4 arguments' do
|
10
8
|
mnu = Gtk::Menu.new
|
11
|
-
|
12
|
-
'parent_menu_shell', 'parent_menu_item',
|
13
|
-
'func', 'data',
|
14
|
-
nil,
|
15
|
-
'button', 'activate_time')
|
16
|
-
mnu.popup('parent_menu_shell', 'parent_menu_item', 'func', 'data',
|
17
|
-
'button', 'activate_time')
|
9
|
+
mnu.popup(nil, nil, 1, 32)
|
18
10
|
end
|
19
11
|
end
|
20
12
|
end
|
@@ -1,15 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
describe Gtk::MessageDialog do
|
4
6
|
describe '.new' do
|
5
7
|
it 'creates a Gtk::MessageDialog with the right text' do
|
6
8
|
dialog = Gtk::MessageDialog.new nil, :modal, :info, :close, 'Foo'
|
7
|
-
dialog.text.must_equal 'Foo'
|
9
|
+
_(dialog.text).must_equal 'Foo'
|
8
10
|
end
|
9
11
|
|
10
12
|
it 'handles all % characters in the message as literals' do
|
11
13
|
dialog = Gtk::MessageDialog.new nil, :modal, :info, :close, 'Foo %'
|
12
|
-
dialog.text.must_equal 'Foo %'
|
14
|
+
_(dialog.text).must_equal 'Foo %'
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
describe Gtk::RadioAction do
|
@@ -5,7 +7,7 @@ describe Gtk::RadioAction do
|
|
5
7
|
it 'returns a GLib::SList object' do
|
6
8
|
action = Gtk::RadioAction.new 'name', 'label', 'tooltip', nil, 1
|
7
9
|
grp = action.get_group
|
8
|
-
grp.must_be_instance_of GLib::SList
|
10
|
+
_(grp).must_be_instance_of GLib::SList
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
@@ -1,16 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
describe Gtk::RadioButton do
|
4
6
|
describe '.new_from_widget' do
|
5
7
|
it 'works when called with nil' do
|
6
8
|
result = Gtk::RadioButton.new_from_widget(nil)
|
7
|
-
result.must_be_instance_of Gtk::RadioButton
|
9
|
+
_(result).must_be_instance_of Gtk::RadioButton
|
8
10
|
end
|
9
11
|
|
10
12
|
it 'works when called with another radio button' do
|
11
13
|
btn = Gtk::RadioButton.new_from_widget nil
|
12
14
|
result = Gtk::RadioButton.new_from_widget btn
|
13
|
-
result.must_be_instance_of Gtk::RadioButton
|
15
|
+
_(result).must_be_instance_of Gtk::RadioButton
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
@@ -25,13 +27,13 @@ describe Gtk::RadioButton do
|
|
25
27
|
describe '.new' do
|
26
28
|
it 'works when called with nil' do
|
27
29
|
result = Gtk::RadioButton.new nil
|
28
|
-
result.must_be_instance_of Gtk::RadioButton
|
30
|
+
_(result).must_be_instance_of Gtk::RadioButton
|
29
31
|
end
|
30
32
|
|
31
33
|
it 'works when called with the result of #get_group' do
|
32
34
|
btn = Gtk::RadioButton.new_from_widget nil
|
33
35
|
result = Gtk::RadioButton.new btn.get_group
|
34
|
-
result.must_be_instance_of Gtk::RadioButton
|
36
|
+
_(result).must_be_instance_of Gtk::RadioButton
|
35
37
|
end
|
36
38
|
end
|
37
39
|
end
|
@@ -1,19 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
describe Gtk::TargetEntry do
|
4
6
|
describe '.new' do
|
5
7
|
it 'takes and uses three arguments' do
|
6
8
|
entry = Gtk::TargetEntry.new('foo', 3, 42)
|
7
|
-
entry.target.must_equal 'foo'
|
8
|
-
entry.flags.must_equal 3
|
9
|
-
entry.info.must_equal 42
|
9
|
+
_(entry.target).must_equal 'foo'
|
10
|
+
_(entry.flags).must_equal 3
|
11
|
+
_(entry.info).must_equal 42
|
10
12
|
end
|
11
13
|
|
12
14
|
it 'allows symbol values for the second argument' do
|
13
15
|
entry = Gtk::TargetEntry.new('foo', :same_app, 42)
|
14
|
-
entry.target.must_equal 'foo'
|
15
|
-
entry.flags.must_equal 1
|
16
|
-
entry.info.must_equal 42
|
16
|
+
_(entry.target).must_equal 'foo'
|
17
|
+
_(entry.flags).must_equal 1
|
18
|
+
_(entry.info).must_equal 42
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -1,17 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
describe Gtk::TreePath do
|
4
6
|
describe '#get_indices' do
|
5
7
|
it "returns an enumerable of the TreePath's indices" do
|
6
8
|
tree_path = Gtk::TreePath.new_from_string '1:2:3'
|
7
|
-
tree_path.get_indices.to_a.must_equal [1, 2, 3]
|
9
|
+
_(tree_path.get_indices.to_a).must_equal [1, 2, 3]
|
8
10
|
end
|
9
11
|
end
|
10
12
|
|
11
13
|
describe '.new_from_indices' do
|
12
14
|
it 'creates a Gtk::TreePath with the right indices' do
|
13
15
|
tree_path = Gtk::TreePath.new_from_indices [1, 2, 3]
|
14
|
-
tree_path.get_indices.to_a.must_equal [1, 2, 3]
|
16
|
+
_(tree_path.get_indices.to_a).must_equal [1, 2, 3]
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
describe Gtk::TreeStore do
|
4
6
|
describe '.new' do
|
5
7
|
it 'takes an array of column types' do
|
6
8
|
store = Gtk::TreeStore.new([GObject::TYPE_STRING, GObject::TYPE_INT])
|
7
|
-
store.must_be_instance_of Gtk::TreeStore
|
9
|
+
_(store).must_be_instance_of Gtk::TreeStore
|
8
10
|
end
|
9
11
|
end
|
10
12
|
|
@@ -12,8 +14,8 @@ describe Gtk::TreeStore do
|
|
12
14
|
it 'inserts a row with the given values' do
|
13
15
|
store = Gtk::TreeStore.new([GObject::TYPE_STRING, GObject::TYPE_INT])
|
14
16
|
row = store.insert_with_values(nil, 0, [0, 1], ['foo', 42])
|
15
|
-
store.get_value(row, 0).must_equal 'foo'
|
16
|
-
store.get_value(row, 1).must_equal 42
|
17
|
+
_(store.get_value(row, 0)).must_equal 'foo'
|
18
|
+
_(store.get_value(row, 1)).must_equal 42
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
@@ -22,8 +24,8 @@ describe Gtk::TreeStore do
|
|
22
24
|
store = Gtk::TreeStore.new([GObject::TYPE_STRING, GObject::TYPE_INT])
|
23
25
|
row = store.insert_with_values(nil, 0, [0, 1], ['foo', 42])
|
24
26
|
store.set(row, [1, 0], [3, 'bar'])
|
25
|
-
store.get_value(row, 0).must_equal 'bar'
|
26
|
-
store.get_value(row, 1).must_equal 3
|
27
|
+
_(store.get_value(row, 0)).must_equal 'bar'
|
28
|
+
_(store.get_value(row, 1)).must_equal 3
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
@@ -32,7 +34,7 @@ describe Gtk::TreeStore do
|
|
32
34
|
store = Gtk::TreeStore.new([GObject::TYPE_STRING, GObject::TYPE_INT])
|
33
35
|
row = store.insert_with_values(nil, 0, [0, 1], ['foo', 42])
|
34
36
|
store.set_value(row, 0, nil)
|
35
|
-
store.get_value(row, 0).must_be_nil
|
37
|
+
_(store.get_value(row, 0)).must_be_nil
|
36
38
|
end
|
37
39
|
end
|
38
40
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
describe Gtk::TreeViewColumn do
|
@@ -11,23 +13,23 @@ describe Gtk::TreeViewColumn do
|
|
11
13
|
let(:list_store) { Gtk::ListStore.new([GObject::TYPE_INT, GObject::TYPE_STRING]) }
|
12
14
|
|
13
15
|
it "sets the column's title" do
|
14
|
-
column.title.must_equal 'foo-title'
|
16
|
+
_(column.title).must_equal 'foo-title'
|
15
17
|
end
|
16
18
|
|
17
19
|
it 'packs the renderer into the column' do
|
18
|
-
column.get_cells.to_a.must_equal [renderer]
|
20
|
+
_(column.get_cells.to_a).must_equal [renderer]
|
19
21
|
end
|
20
22
|
|
21
23
|
it 'adds the attribute mapping for the renderer' do
|
22
24
|
row = list_store.append
|
23
25
|
list_store.set_value(row, 1, 'foo-value')
|
24
26
|
column.cell_set_cell_data(list_store, row, false, false)
|
25
|
-
renderer.text.must_equal 'foo-value'
|
27
|
+
_(renderer.text).must_equal 'foo-value'
|
26
28
|
end
|
27
29
|
|
28
30
|
it 'allows not specifying any attributes' do
|
29
31
|
col = Gtk::TreeViewColumn.new_with_attributes('foo-title', renderer)
|
30
|
-
col.must_be_instance_of Gtk::TreeViewColumn
|
32
|
+
_(col).must_be_instance_of Gtk::TreeViewColumn
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
@@ -45,7 +47,7 @@ describe Gtk::TreeViewColumn do
|
|
45
47
|
row = list_store.append
|
46
48
|
list_store.set_value(row, 1, 'foo-value')
|
47
49
|
column.cell_set_cell_data(list_store, row, false, false)
|
48
|
-
renderer.text.must_equal 'foo-value'
|
50
|
+
_(renderer.text).must_equal 'foo-value'
|
49
51
|
end
|
50
52
|
end
|
51
53
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
describe Gtk::Widget do
|
@@ -16,20 +18,20 @@ describe Gtk::Widget do
|
|
16
18
|
it 'works when called with a bitmask hash' do
|
17
19
|
widget.add_events button_press_mask: true
|
18
20
|
ev = widget.get_events
|
19
|
-
Gdk::EventMask.to_int(ev).must_equal expected_native
|
21
|
+
_(Gdk::EventMask.to_int(ev)).must_equal expected_native
|
20
22
|
end
|
21
23
|
|
22
24
|
it 'works when called with a symbol' do
|
23
25
|
widget.add_events :button_press_mask
|
24
26
|
ev = widget.get_events
|
25
|
-
Gdk::EventMask.to_int(ev).must_equal expected_native
|
27
|
+
_(Gdk::EventMask.to_int(ev)).must_equal expected_native
|
26
28
|
end
|
27
29
|
|
28
30
|
it 'works when called with an int' do
|
29
31
|
ev_int = Gdk::EventMask.to_int :button_press_mask
|
30
32
|
widget.add_events ev_int
|
31
33
|
ev = widget.get_events
|
32
|
-
Gdk::EventMask.to_int(ev).must_equal expected_native
|
34
|
+
_(Gdk::EventMask.to_int(ev)).must_equal expected_native
|
33
35
|
end
|
34
36
|
end
|
35
37
|
|
@@ -39,7 +41,7 @@ describe Gtk::Widget do
|
|
39
41
|
it 'returns a bitmap hash' do
|
40
42
|
widget.set_events focus_change_mask: true
|
41
43
|
ev = widget.get_events
|
42
|
-
ev.must_equal focus_change_mask: true
|
44
|
+
_(ev).must_equal focus_change_mask: true
|
43
45
|
end
|
44
46
|
end
|
45
47
|
|
@@ -50,20 +52,20 @@ describe Gtk::Widget do
|
|
50
52
|
it 'works when called with a bitmask hash' do
|
51
53
|
widget.set_events focus_change_mask: true
|
52
54
|
ev = widget.get_events
|
53
|
-
Gdk::EventMask.to_int(ev).must_equal expected_native
|
55
|
+
_(Gdk::EventMask.to_int(ev)).must_equal expected_native
|
54
56
|
end
|
55
57
|
|
56
58
|
it 'works when called with a symbol' do
|
57
59
|
widget.set_events :focus_change_mask
|
58
60
|
ev = widget.get_events
|
59
|
-
Gdk::EventMask.to_int(ev).must_equal expected_native
|
61
|
+
_(Gdk::EventMask.to_int(ev)).must_equal expected_native
|
60
62
|
end
|
61
63
|
|
62
64
|
it 'works when called with an int' do
|
63
65
|
ev_int = Gdk::EventMask.to_int :focus_change_mask
|
64
66
|
widget.set_events ev_int
|
65
67
|
ev = widget.get_events
|
66
|
-
Gdk::EventMask.to_int(ev).must_equal expected_native
|
68
|
+
_(Gdk::EventMask.to_int(ev)).must_equal expected_native
|
67
69
|
end
|
68
70
|
end
|
69
71
|
|
@@ -73,7 +75,7 @@ describe Gtk::Widget do
|
|
73
75
|
it 'returns a bitmap hash' do
|
74
76
|
widget.set_events focus_change_mask: true
|
75
77
|
ev = widget.events
|
76
|
-
ev.must_equal focus_change_mask: true
|
78
|
+
_(ev).must_equal focus_change_mask: true
|
77
79
|
end
|
78
80
|
end
|
79
81
|
|
@@ -84,20 +86,20 @@ describe Gtk::Widget do
|
|
84
86
|
it 'works when called with a bitmask hash' do
|
85
87
|
widget.events = { focus_change_mask: true }
|
86
88
|
ev = widget.get_events
|
87
|
-
Gdk::EventMask.to_int(ev).must_equal expected_native
|
89
|
+
_(Gdk::EventMask.to_int(ev)).must_equal expected_native
|
88
90
|
end
|
89
91
|
|
90
92
|
it 'works when called with a symbol' do
|
91
93
|
widget.events = :focus_change_mask
|
92
94
|
ev = widget.get_events
|
93
|
-
Gdk::EventMask.to_int(ev).must_equal expected_native
|
95
|
+
_(Gdk::EventMask.to_int(ev)).must_equal expected_native
|
94
96
|
end
|
95
97
|
|
96
98
|
it 'works when called with an int' do
|
97
99
|
ev_int = Gdk::EventMask.to_int :focus_change_mask
|
98
100
|
widget.events = ev_int
|
99
101
|
ev = widget.get_events
|
100
|
-
Gdk::EventMask.to_int(ev).must_equal expected_native
|
102
|
+
_(Gdk::EventMask.to_int(ev)).must_equal expected_native
|
101
103
|
end
|
102
104
|
end
|
103
105
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gir_ffi-gtk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matijs van Zuijlen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gir_ffi
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.15.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.15.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '5.
|
33
|
+
version: '5.12'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '5.
|
40
|
+
version: '5.12'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rr
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- lib/gir_ffi-gtk/dialog.rb
|
95
95
|
- lib/gir_ffi-gtk/file_chooser_dialog.rb
|
96
96
|
- lib/gir_ffi-gtk/gtk2/list_store.rb
|
97
|
+
- lib/gir_ffi-gtk/gtk2/menu.rb
|
97
98
|
- lib/gir_ffi-gtk/gtk2/radio_action.rb
|
98
99
|
- lib/gir_ffi-gtk/gtk2/radio_button.rb
|
99
100
|
- lib/gir_ffi-gtk/gtk2/target_entry.rb
|
@@ -102,7 +103,6 @@ files:
|
|
102
103
|
- lib/gir_ffi-gtk/gtk3/target_entry.rb
|
103
104
|
- lib/gir_ffi-gtk/image.rb
|
104
105
|
- lib/gir_ffi-gtk/list_store.rb
|
105
|
-
- lib/gir_ffi-gtk/menu.rb
|
106
106
|
- lib/gir_ffi-gtk/message_dialog.rb
|
107
107
|
- lib/gir_ffi-gtk/tree_path.rb
|
108
108
|
- lib/gir_ffi-gtk/tree_store.rb
|
@@ -144,15 +144,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
144
|
requirements:
|
145
145
|
- - ">="
|
146
146
|
- !ruby/object:Gem::Version
|
147
|
-
version: 2.
|
147
|
+
version: 2.4.0
|
148
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
requirements: []
|
154
|
-
|
155
|
-
rubygems_version: 2.7.6
|
154
|
+
rubygems_version: 3.0.6
|
156
155
|
signing_key:
|
157
156
|
specification_version: 4
|
158
157
|
summary: GirFFI-based Ruby bindings for Gtk+ 2 and 3
|
data/lib/gir_ffi-gtk/menu.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Gtk.load_class :Menu
|
4
|
-
module Gtk
|
5
|
-
# Overrides for GtkMenu
|
6
|
-
class Menu
|
7
|
-
unless method_defined? :popup
|
8
|
-
# Smells of :reek:LongParameterList: due to the defined GtkMenu interface.
|
9
|
-
# rubocop:disable Metrics/ParameterLists
|
10
|
-
def popup(parent_menu_shell, parent_menu_item, func, data, button, activate_time)
|
11
|
-
popup_for_device(nil,
|
12
|
-
parent_menu_shell, parent_menu_item, func, data,
|
13
|
-
nil,
|
14
|
-
button, activate_time)
|
15
|
-
end
|
16
|
-
# rubocop:enable Metrics/ParameterLists
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|