gir_ffi-gtk 0.12.1 → 0.13.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 +22 -17
- data/lib/gir_ffi-gtk/base.rb +2 -2
- data/lib/gir_ffi-gtk/builder.rb +2 -2
- data/lib/gir_ffi-gtk/container.rb +3 -3
- data/lib/gir_ffi-gtk/gtk2/list_store.rb +2 -2
- data/lib/gir_ffi-gtk/gtk2/tree_store.rb +3 -3
- data/lib/gir_ffi-gtk/gtk3/target_entry.rb +1 -1
- data/lib/gir_ffi-gtk/list_store.rb +2 -2
- data/lib/gir_ffi-gtk/tree_path.rb +1 -1
- data/lib/gir_ffi-gtk/tree_view_column.rb +1 -1
- data/test/callback_exceptions_test.rb +14 -15
- data/test/gir_ffi-gtk/base_test.rb +15 -15
- data/test/gir_ffi-gtk/builder_test.rb +6 -6
- data/test/gir_ffi-gtk/container_test.rb +1 -1
- data/test/gir_ffi-gtk/generated_gtk_test.rb +13 -13
- data/test/gir_ffi-gtk/menu_test.rb +14 -12
- data/test/gir_ffi-gtk/message_dialog_test.rb +3 -4
- data/test/gir_ffi-gtk/radio_action_test.rb +7 -6
- data/test/gir_ffi-gtk/radio_button_test.rb +8 -8
- data/test/gir_ffi-gtk/tree_path_test.rb +4 -4
- data/test/gir_ffi-gtk/tree_view_column_test.rb +7 -5
- data/test/test_helper.rb +7 -6
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e84a1c1fb530cf07ca0c685de398c075279e5f0aad37d5b99d1cb1828baec9c
|
4
|
+
data.tar.gz: 92bb036950992713f0fe8ae0a46f0cffa9ec294581597f2eae19cfb19a85aa63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df68feccf33c8cba1025cd92448b3dd33535364c1abcbdec3b79cb9341d02aa14f8d165a3702f675d180631d013fa7385df374999957a480fbdfb7cd3f9cd444
|
7
|
+
data.tar.gz: 39e23cb92615d3bd685474147843540dc9cbaf25d2c4a127e939a00d773205696bdaefcbe01cbc86174c99c94a3d3ccb8fecde8766c98a424fc4f54e13345302
|
data/Changelog.md
CHANGED
@@ -3,6 +3,11 @@
|
|
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.13.0 / 2018-09-08
|
7
|
+
|
8
|
+
* Drop support for Ruby 2.1
|
9
|
+
* Depend on GirFFI 0.13.0
|
10
|
+
|
6
11
|
## 0.12.1 / 2018-05-31
|
7
12
|
|
8
13
|
* Restore support for Ruby 2.1 and 2.2
|
@@ -24,21 +29,21 @@ Git log for all changes.
|
|
24
29
|
|
25
30
|
* Propagate exceptions from callbacks during event loops
|
26
31
|
* Add new overrides:
|
27
|
-
* for Gtk::Container
|
28
|
-
* for Gtk::TreeViewColumn
|
29
|
-
* for Gtk::TreeStore
|
30
|
-
* for Gtk::ListStore
|
31
|
-
* for Gtk::TargetEntry.new
|
32
|
-
* for GtkBuilder#connect_signals
|
32
|
+
* for `Gtk::Container`
|
33
|
+
* for `Gtk::TreeViewColumn`
|
34
|
+
* for `Gtk::TreeStore`
|
35
|
+
* for `Gtk::ListStore`
|
36
|
+
* for `Gtk::TargetEntry.new`
|
37
|
+
* for `GtkBuilder#connect_signals`
|
33
38
|
* Depend on GirFFI 0.9.0
|
34
39
|
* Use GirFFI's new way of handling callback parameters and user data and
|
35
40
|
destroy notifier handling
|
36
41
|
|
37
42
|
## 0.8.1 / 2015-12-02
|
38
43
|
|
39
|
-
* Add override for Gtk::RadioAction#set_group
|
40
|
-
* Add Gtk::Application example (thanks, cedlemo)
|
41
|
-
* Add and update WebKit examples
|
44
|
+
* Add override for `Gtk::RadioAction#set_group`
|
45
|
+
* Add `Gtk::Application` example (thanks, cedlemo)
|
46
|
+
* Add and update `WebKit` examples
|
42
47
|
|
43
48
|
## 0.8.0 / 2015-09-20
|
44
49
|
|
@@ -48,18 +53,18 @@ Git log for all changes.
|
|
48
53
|
## 0.7.2 / 2014-09-22
|
49
54
|
|
50
55
|
* Require at least Ruby 1.9.3
|
51
|
-
* Add overrides for Gtk::TreePath
|
52
|
-
* Add overrides for Gtk::MessageDialog.new
|
53
|
-
* Make other Ruby threads run during Gtk.main loop
|
56
|
+
* Add overrides for `Gtk::TreePath`
|
57
|
+
* Add overrides for `Gtk::MessageDialog.new`
|
58
|
+
* Make other Ruby threads run during `Gtk.main` loop
|
54
59
|
* Update dependencies
|
55
60
|
* Update examples
|
56
61
|
|
57
62
|
## 0.7.1 / 2014-03-25
|
58
63
|
|
59
|
-
* Fix Gtk::Builder#connect_signals_full by updating dependency on GirFFI
|
60
|
-
* Only override Gtk::Menu#popup if needed
|
64
|
+
* Fix `Gtk::Builder#connect_signals_full` by updating dependency on GirFFI
|
65
|
+
* Only override `Gtk::Menu#popup` if needed
|
61
66
|
* Test both Gtk+ 2 and 3
|
62
|
-
* Provide constructors for Gtk::RadioButton if needed
|
67
|
+
* Provide constructors for `Gtk::RadioButton` if needed
|
63
68
|
|
64
69
|
## 0.7.0 / 2014-01-11
|
65
70
|
|
@@ -75,8 +80,8 @@ Git log for all changes.
|
|
75
80
|
|
76
81
|
## 0.4.1 / 2012-09-22
|
77
82
|
|
78
|
-
* New TreeView example (thanks, Kasper Johansen)
|
79
|
-
* Implement Gtk::Menu#popup
|
83
|
+
* New `TreeView` example (thanks, Kasper Johansen)
|
84
|
+
* Implement `Gtk::Menu#popup`
|
80
85
|
* Update dependency on GirFFI so interfaces can wrap pointers
|
81
86
|
|
82
87
|
## 0.4.0 / 2012-08-24
|
data/lib/gir_ffi-gtk/base.rb
CHANGED
data/lib/gir_ffi-gtk/builder.rb
CHANGED
@@ -4,7 +4,7 @@ Gtk.load_class :Builder
|
|
4
4
|
module Gtk
|
5
5
|
# Overrides for GtkBuilder
|
6
6
|
class Builder
|
7
|
-
setup_instance_method :add_from_string
|
7
|
+
setup_instance_method! :add_from_string
|
8
8
|
|
9
9
|
def add_from_string_with_auto_length(buffer)
|
10
10
|
add_from_string_without_auto_length buffer, buffer.length
|
@@ -13,7 +13,7 @@ module Gtk
|
|
13
13
|
alias add_from_string_without_auto_length add_from_string
|
14
14
|
alias add_from_string add_from_string_with_auto_length
|
15
15
|
|
16
|
-
setup_instance_method :connect_signals_full
|
16
|
+
setup_instance_method! :connect_signals_full
|
17
17
|
remove_method :connect_signals
|
18
18
|
|
19
19
|
AFTER_FLAG = GObject::ConnectFlags[:after]
|
@@ -11,13 +11,13 @@ module Gtk
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
setup_instance_method :child_get_property
|
14
|
+
setup_instance_method! :child_get_property
|
15
15
|
|
16
16
|
def child_get_property_with_override(widget, property_name)
|
17
17
|
param_spec = object_class.find_child_property property_name
|
18
18
|
unless param_spec
|
19
|
-
raise
|
20
|
-
|
19
|
+
raise(ArgumentError,
|
20
|
+
"child property named '#{property_name}' not found in #{self.class}")
|
21
21
|
end
|
22
22
|
gtype = param_spec.value_type
|
23
23
|
gvalue = GObject::Value.for_gtype gtype
|
@@ -4,8 +4,8 @@ Gtk.load_class :ListStore
|
|
4
4
|
module Gtk
|
5
5
|
# Overrides for GtkListStore
|
6
6
|
class ListStore
|
7
|
-
setup_method :newv
|
8
|
-
setup_instance_method :set_valuesv
|
7
|
+
setup_method! :newv
|
8
|
+
setup_instance_method! :set_valuesv
|
9
9
|
|
10
10
|
alias old_initialize initialize
|
11
11
|
alias initialize initializev
|
@@ -4,9 +4,9 @@ Gtk.load_class :TreeStore
|
|
4
4
|
module Gtk
|
5
5
|
# Overrides for GtkTreeStore
|
6
6
|
class TreeStore
|
7
|
-
setup_method :newv
|
8
|
-
setup_instance_method :set_valuesv
|
9
|
-
setup_instance_method :insert_with_valuesv
|
7
|
+
setup_method! :newv
|
8
|
+
setup_instance_method! :set_valuesv
|
9
|
+
setup_instance_method! :insert_with_valuesv
|
10
10
|
|
11
11
|
alias old_initialize initialize
|
12
12
|
alias initialize initializev
|
@@ -4,11 +4,11 @@ Gtk.load_class :ListStore
|
|
4
4
|
module Gtk
|
5
5
|
# Overrides for GtkListStore
|
6
6
|
class ListStore
|
7
|
-
setup_instance_method :insert_with_valuesv
|
7
|
+
setup_instance_method! :insert_with_valuesv
|
8
8
|
|
9
9
|
alias insert_with_values insert_with_valuesv
|
10
10
|
|
11
|
-
setup_instance_method :set_value
|
11
|
+
setup_instance_method! :set_value
|
12
12
|
|
13
13
|
def set_value_with_value_conversion(iter, column, value)
|
14
14
|
value = GObject::Value.for_gtype get_column_type(column) if value.nil?
|
@@ -2,26 +2,26 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class CallbackTestException < RuntimeError; end
|
4
4
|
|
5
|
-
describe
|
6
|
-
describe
|
5
|
+
describe 'An exception in a callback' do
|
6
|
+
describe 'for signals' do
|
7
7
|
let(:object) { Gtk::Window.new :toplevel }
|
8
8
|
|
9
9
|
before do
|
10
|
-
object.signal_connect
|
11
|
-
raise CallbackTestException,
|
10
|
+
object.signal_connect 'destroy' do
|
11
|
+
raise CallbackTestException, 'Boom'
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
describe
|
16
|
-
it
|
17
|
-
|
15
|
+
describe 'when the signal is emitted synchronously' do
|
16
|
+
it 'raises an error' do
|
17
|
+
-> { GObject.signal_emit object, 'destroy' }.must_raise CallbackTestException
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
describe
|
22
|
-
it
|
21
|
+
describe 'when the signal is emitted during an event loop' do
|
22
|
+
it 'causes loop run to be terminated with an exception' do
|
23
23
|
GLib.timeout_add GLib::PRIORITY_DEFAULT, 1 do
|
24
|
-
GObject.signal_emit object,
|
24
|
+
GObject.signal_emit object, 'destroy'
|
25
25
|
false
|
26
26
|
end
|
27
27
|
# Guard against runaway loop
|
@@ -37,11 +37,11 @@ describe "An exception in a callback" do
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
describe
|
41
|
-
describe
|
42
|
-
it
|
40
|
+
describe 'for other callbacks' do
|
41
|
+
describe 'when the callback occurs during an event loop' do
|
42
|
+
it 'causes loop run to be terminated with an exception' do
|
43
43
|
GLib.timeout_add GLib::PRIORITY_DEFAULT, 1 do
|
44
|
-
raise CallbackTestException,
|
44
|
+
raise CallbackTestException, 'Boom'
|
45
45
|
end
|
46
46
|
# Guard against runaway loop
|
47
47
|
@guard = GLib.timeout_add(GLib::PRIORITY_DEFAULT, 1000) { Gtk.main_quit }
|
@@ -56,4 +56,3 @@ describe "An exception in a callback" do
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
59
|
-
|
@@ -1,47 +1,47 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
describe Gtk do
|
4
|
-
describe
|
4
|
+
describe '::init' do
|
5
5
|
before do
|
6
6
|
module DummyGtk
|
7
|
-
def self.init
|
8
|
-
|
7
|
+
def self.init(_arr)
|
8
|
+
%w(baz qux zonk)
|
9
9
|
end
|
10
10
|
|
11
11
|
include GirFFIGtk::AutoArgv
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
it
|
16
|
-
assert_raises(ArgumentError) { DummyGtk.init 1, [
|
17
|
-
assert_raises(ArgumentError) { DummyGtk.init [
|
15
|
+
it 'does not take any arguments' do
|
16
|
+
assert_raises(ArgumentError) { DummyGtk.init 1, ['foo'] }
|
17
|
+
assert_raises(ArgumentError) { DummyGtk.init ['foo'] }
|
18
18
|
assert_nothing_raised { DummyGtk.init }
|
19
19
|
end
|
20
20
|
|
21
|
-
it
|
22
|
-
ARGV.replace
|
21
|
+
it 'replaces ARGV with the tail of the result of the original init function' do
|
22
|
+
ARGV.replace %w(foo bar)
|
23
23
|
DummyGtk.init
|
24
|
-
assert_equal
|
24
|
+
assert_equal %w(qux zonk), ARGV.to_a
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
describe
|
29
|
-
it
|
28
|
+
describe '::main' do
|
29
|
+
it 'allows other threads to run' do
|
30
30
|
a = []
|
31
31
|
GLib.timeout_add(GLib::PRIORITY_DEFAULT, 150) { Gtk.main_quit }
|
32
32
|
|
33
33
|
slow_thread = Thread.new do
|
34
34
|
sleep 0.005
|
35
|
-
a <<
|
35
|
+
a << 'During run'
|
36
36
|
end
|
37
37
|
|
38
|
-
a <<
|
38
|
+
a << 'Before run'
|
39
39
|
Gtk.main
|
40
|
-
a <<
|
40
|
+
a << 'After run'
|
41
41
|
|
42
42
|
slow_thread.join
|
43
43
|
|
44
|
-
a.last.must_equal
|
44
|
+
a.last.must_equal 'After run'
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
@@ -3,23 +3,23 @@ require 'test_helper'
|
|
3
3
|
describe Gtk::Builder do
|
4
4
|
let(:builder) { Gtk::Builder.new }
|
5
5
|
let(:spec) do
|
6
|
-
<<-
|
6
|
+
<<-XML
|
7
7
|
<interface>
|
8
8
|
<object class="GtkButton" id="foo">
|
9
9
|
<signal handler="on_button_clicked" name="clicked"/>
|
10
10
|
</object>
|
11
11
|
</interface>
|
12
|
-
|
12
|
+
XML
|
13
13
|
end
|
14
14
|
|
15
|
-
describe
|
15
|
+
describe '#add_from_string' do
|
16
16
|
it 'takes one string as argument' do
|
17
17
|
builder.add_from_string spec
|
18
18
|
pass
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
describe
|
22
|
+
describe '#connect_signals' do
|
23
23
|
before do
|
24
24
|
builder.add_from_string spec
|
25
25
|
end
|
@@ -46,14 +46,14 @@ describe Gtk::Builder do
|
|
46
46
|
|
47
47
|
describe 'with a signal with after flag' do
|
48
48
|
let(:spec) do
|
49
|
-
<<-
|
49
|
+
<<-XML
|
50
50
|
<interface>
|
51
51
|
<object class="GtkButton" id="foo">
|
52
52
|
<signal handler="handler_after" name="clicked" after="true"/>
|
53
53
|
<signal handler="handler_before" name="clicked"/>
|
54
54
|
</object>
|
55
55
|
</interface>
|
56
|
-
|
56
|
+
XML
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'connects the handlers in the right order' do
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
# Tests generated methods and functions in the Gtk namespace.
|
4
|
-
describe
|
5
|
-
describe
|
4
|
+
describe 'In the generated Gtk module' do
|
5
|
+
describe 'a Gtk::Builder instance' do
|
6
6
|
before do
|
7
7
|
@builder = Gtk::Builder.new
|
8
8
|
@spec = '
|
@@ -14,31 +14,31 @@ describe "In the generated Gtk module" do
|
|
14
14
|
'
|
15
15
|
end
|
16
16
|
|
17
|
-
it
|
17
|
+
it 'loads the interface spec' do
|
18
18
|
assert_nothing_raised { @builder.add_from_string @spec }
|
19
19
|
end
|
20
20
|
|
21
|
-
describe
|
22
|
-
it
|
21
|
+
describe 'its #get_object method' do
|
22
|
+
it 'returns objects of the proper class' do
|
23
23
|
@builder.add_from_string @spec
|
24
|
-
o = @builder.get_object
|
24
|
+
o = @builder.get_object 'foo'
|
25
25
|
assert_instance_of Gtk::Button, o
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
describe
|
29
|
+
describe 'its #connect_signals_full method' do
|
30
30
|
before do
|
31
31
|
@builder.add_from_string @spec
|
32
32
|
end
|
33
|
-
it
|
33
|
+
it 'passes arguments correctly' do
|
34
34
|
aa = nil
|
35
|
-
@builder.connect_signals_full {|*args| aa = args}
|
35
|
+
@builder.connect_signals_full { |*args| aa = args }
|
36
36
|
b, o, sn, hn, co, f, ud = aa
|
37
37
|
assert_instance_of Gtk::Builder, b
|
38
38
|
assert_equal b.to_ptr, @builder.to_ptr
|
39
39
|
assert_instance_of Gtk::Button, o
|
40
|
-
assert_equal
|
41
|
-
assert_equal
|
40
|
+
assert_equal 'clicked', sn
|
41
|
+
assert_equal 'on_button_clicked', hn
|
42
42
|
co.must_be_nil
|
43
43
|
assert_equal 0, f
|
44
44
|
ud.wont_be_nil
|
@@ -46,12 +46,12 @@ describe "In the generated Gtk module" do
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
describe
|
49
|
+
describe 'a Gtk::Window instance' do
|
50
50
|
before do
|
51
51
|
@w = Gtk::Window.new :toplevel
|
52
52
|
end
|
53
53
|
|
54
|
-
it
|
54
|
+
it 'starts with a refcount of 2 (one for us, one for GTK+)' do
|
55
55
|
assert_equal 2, ref_count(@w)
|
56
56
|
end
|
57
57
|
end
|
@@ -1,18 +1,20 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
describe Gtk::Menu do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
4
|
+
describe '#popup' do
|
5
|
+
it 'delegates to popup_for_device' do
|
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
|
10
|
+
mnu = Gtk::Menu.new
|
11
|
+
mock(mnu).popup_for_device(nil,
|
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')
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
@@ -1,16 +1,15 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
describe Gtk::MessageDialog do
|
4
|
-
describe
|
5
|
-
it
|
4
|
+
describe '.new' do
|
5
|
+
it 'creates a Gtk::MessageDialog with the right text' do
|
6
6
|
dialog = Gtk::MessageDialog.new nil, :modal, :info, :close, 'Foo'
|
7
7
|
dialog.text.must_equal 'Foo'
|
8
8
|
end
|
9
9
|
|
10
|
-
it
|
10
|
+
it 'handles all % characters in the message as literals' do
|
11
11
|
dialog = Gtk::MessageDialog.new nil, :modal, :info, :close, 'Foo %'
|
12
12
|
dialog.text.must_equal 'Foo %'
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
@@ -1,25 +1,26 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
describe Gtk::RadioAction do
|
4
|
-
describe
|
5
|
-
it
|
4
|
+
describe '#get_group' do
|
5
|
+
it 'returns a GLib::SList object' do
|
6
6
|
action = Gtk::RadioAction.new 'name', 'label', 'tooltip', nil, 1
|
7
7
|
grp = action.get_group
|
8
8
|
grp.must_be_instance_of GLib::SList
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
describe
|
12
|
+
describe '#set_group' do
|
13
13
|
let(:action) { Gtk::RadioAction.new 'name', 'label', 'tooltip', nil, 1 }
|
14
14
|
|
15
|
-
it
|
15
|
+
it 'accepts nil' do
|
16
16
|
action.set_group nil
|
17
17
|
pass
|
18
18
|
end
|
19
19
|
|
20
|
-
it
|
20
|
+
it 'accepts a GLib::SList object' do
|
21
21
|
grp = action.get_group
|
22
|
-
other_action = Gtk::RadioAction.new
|
22
|
+
other_action = Gtk::RadioAction.new('other-name', 'other-label',
|
23
|
+
'other-tooltip', nil, 2)
|
23
24
|
other_action.set_group grp
|
24
25
|
pass
|
25
26
|
end
|
@@ -1,34 +1,34 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
describe Gtk::RadioButton do
|
4
|
-
describe
|
5
|
-
it
|
4
|
+
describe '.new_from_widget' do
|
5
|
+
it 'works when called with nil' do
|
6
6
|
result = Gtk::RadioButton.new_from_widget(nil)
|
7
7
|
result.must_be_instance_of Gtk::RadioButton
|
8
8
|
end
|
9
9
|
|
10
|
-
it
|
10
|
+
it 'works when called with another radio button' do
|
11
11
|
btn = Gtk::RadioButton.new_from_widget nil
|
12
12
|
result = Gtk::RadioButton.new_from_widget btn
|
13
13
|
result.must_be_instance_of Gtk::RadioButton
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
describe
|
18
|
-
it
|
17
|
+
describe '#get_group' do
|
18
|
+
it 'returns a GLib::SList object' do
|
19
19
|
btn = Gtk::RadioButton.new_from_widget nil
|
20
20
|
grp = btn.get_group
|
21
21
|
assert_instance_of GLib::SList, grp
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
describe
|
26
|
-
it
|
25
|
+
describe '.new' do
|
26
|
+
it 'works when called with nil' do
|
27
27
|
result = Gtk::RadioButton.new nil
|
28
28
|
result.must_be_instance_of Gtk::RadioButton
|
29
29
|
end
|
30
30
|
|
31
|
-
it
|
31
|
+
it 'works when called with the result of #get_group' do
|
32
32
|
btn = Gtk::RadioButton.new_from_widget nil
|
33
33
|
result = Gtk::RadioButton.new btn.get_group
|
34
34
|
result.must_be_instance_of Gtk::RadioButton
|
@@ -1,15 +1,15 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
describe Gtk::TreePath do
|
4
|
-
describe
|
4
|
+
describe '#get_indices' do
|
5
5
|
it "returns an enumerable of the TreePath's indices" do
|
6
|
-
tree_path = Gtk::TreePath.new_from_string
|
6
|
+
tree_path = Gtk::TreePath.new_from_string '1:2:3'
|
7
7
|
tree_path.get_indices.to_a.must_equal [1, 2, 3]
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
describe
|
12
|
-
it
|
11
|
+
describe '.new_from_indices' do
|
12
|
+
it 'creates a Gtk::TreePath with the right indices' do
|
13
13
|
tree_path = Gtk::TreePath.new_from_indices [1, 2, 3]
|
14
14
|
tree_path.get_indices.to_a.must_equal [1, 2, 3]
|
15
15
|
end
|
@@ -3,9 +3,11 @@ require 'test_helper'
|
|
3
3
|
describe Gtk::TreeViewColumn do
|
4
4
|
describe '.new_with_attributes' do
|
5
5
|
let(:renderer) { Gtk::CellRendererText.new }
|
6
|
-
let(:column)
|
7
|
-
|
8
|
-
|
6
|
+
let(:column) do
|
7
|
+
Gtk::TreeViewColumn.new_with_attributes('foo-title',
|
8
|
+
renderer,
|
9
|
+
text: 1)
|
10
|
+
end
|
9
11
|
let(:list_store) { Gtk::ListStore.new([GObject::TYPE_INT, GObject::TYPE_STRING]) }
|
10
12
|
|
11
13
|
it "sets the column's title" do
|
@@ -16,7 +18,7 @@ describe Gtk::TreeViewColumn do
|
|
16
18
|
column.get_cells.to_a.must_equal [renderer]
|
17
19
|
end
|
18
20
|
|
19
|
-
it
|
21
|
+
it 'adds the attribute mapping for the renderer' do
|
20
22
|
row = list_store.append
|
21
23
|
list_store.set_value(row, 1, 'foo-value')
|
22
24
|
column.cell_set_cell_data(list_store, row, false, false)
|
@@ -39,7 +41,7 @@ describe Gtk::TreeViewColumn do
|
|
39
41
|
column.set_attributes(renderer, text: 1)
|
40
42
|
end
|
41
43
|
|
42
|
-
it
|
44
|
+
it 'adds the attribute mapping for the renderer' do
|
43
45
|
row = list_store.append
|
44
46
|
list_store.set_value(row, 1, 'foo-value')
|
45
47
|
column.cell_set_cell_data(list_store, row, false, false)
|
data/test/test_helper.rb
CHANGED
@@ -1,13 +1,12 @@
|
|
1
|
-
if RUBY_PLATFORM == 'java'
|
2
|
-
require 'rubygems'
|
3
|
-
end
|
1
|
+
require 'rubygems' if RUBY_PLATFORM == 'java'
|
4
2
|
|
5
3
|
begin
|
6
4
|
require 'simplecov'
|
7
5
|
SimpleCov.start do
|
8
|
-
add_filter
|
6
|
+
add_filter '/test/'
|
9
7
|
end
|
10
8
|
rescue LoadError
|
9
|
+
nil # SimpleCov not available
|
11
10
|
end
|
12
11
|
|
13
12
|
require 'minitest/autorun'
|
@@ -21,15 +20,17 @@ else
|
|
21
20
|
require 'gir_ffi-gtk3'
|
22
21
|
end
|
23
22
|
|
24
|
-
|
23
|
+
module BaseTestExtensions
|
25
24
|
def assert_nothing_raised
|
26
25
|
yield
|
27
26
|
assert true
|
28
27
|
end
|
29
28
|
|
30
|
-
def ref_count
|
29
|
+
def ref_count(object)
|
31
30
|
GObject::Object::Struct.new(object.to_ptr)[:ref_count]
|
32
31
|
end
|
33
32
|
end
|
34
33
|
|
34
|
+
Minitest::Test.send :include, BaseTestExtensions
|
35
|
+
|
35
36
|
Gtk.init
|
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.13.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: 2018-
|
11
|
+
date: 2018-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gir_ffi
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.13.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.13.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,33 +39,33 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '5.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
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: '12.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: '12.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rr
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '1.1'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '1.1'
|
69
69
|
description: Bindings for Gtk+ 2 and 3, generated by GirFFI, with overrides.
|
70
70
|
email:
|
71
71
|
- matijs@matijs.net
|
@@ -132,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
132
|
requirements:
|
133
133
|
- - ">="
|
134
134
|
- !ruby/object:Gem::Version
|
135
|
-
version: 2.
|
135
|
+
version: 2.2.0
|
136
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
138
|
- - ">="
|