gir_ffi-gtk 0.15.0 → 0.15.1

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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +6 -0
  3. data/lib/gir_ffi-gtk/base.rb +3 -3
  4. data/lib/gir_ffi-gtk/file_chooser_dialog.rb +4 -0
  5. data/lib/gir_ffi-gtk/gtk2/menu.rb +8 -9
  6. data/lib/gir_ffi-gtk/message_dialog.rb +1 -1
  7. data/lib/gir_ffi-gtk/tree_path.rb +1 -1
  8. data/lib/gir_ffi-gtk/version.rb +5 -0
  9. data/lib/gir_ffi-gtk2.rb +22 -21
  10. data/lib/gir_ffi-gtk3.rb +18 -17
  11. metadata +89 -68
  12. data/Rakefile +0 -10
  13. data/examples/01_empty_window.rb +0 -12
  14. data/examples/02_hello_world.rb +0 -27
  15. data/examples/03_upgraded_hello_world.rb +0 -40
  16. data/examples/04_webkit.rb +0 -18
  17. data/examples/05_notification.rb +0 -33
  18. data/examples/06_treeview.rb +0 -51
  19. data/examples/07_simple_gtk_application.rb +0 -30
  20. data/examples/08_webkit_headless.rb +0 -21
  21. data/examples/09_webkit2_headless.rb +0 -24
  22. data/examples/10_completion_provider.rb +0 -62
  23. data/tasks/test.rake +0 -30
  24. data/test/callback_exceptions_test.rb +0 -56
  25. data/test/gir_ffi-gtk/action_test.rb +0 -19
  26. data/test/gir_ffi-gtk/base_test.rb +0 -49
  27. data/test/gir_ffi-gtk/builder_test.rb +0 -72
  28. data/test/gir_ffi-gtk/button_test.rb +0 -21
  29. data/test/gir_ffi-gtk/container_test.rb +0 -35
  30. data/test/gir_ffi-gtk/dialog_test.rb +0 -15
  31. data/test/gir_ffi-gtk/file_chooser_dialog_test.rb +0 -20
  32. data/test/gir_ffi-gtk/generated_gtk_test.rb +0 -60
  33. data/test/gir_ffi-gtk/image_test.rb +0 -45
  34. data/test/gir_ffi-gtk/list_store_test.rb +0 -40
  35. data/test/gir_ffi-gtk/menu_test.rb +0 -12
  36. data/test/gir_ffi-gtk/message_dialog_test.rb +0 -17
  37. data/test/gir_ffi-gtk/radio_action_test.rb +0 -30
  38. data/test/gir_ffi-gtk/radio_button_test.rb +0 -39
  39. data/test/gir_ffi-gtk/target_entry_test.rb +0 -21
  40. data/test/gir_ffi-gtk/tree_path_test.rb +0 -19
  41. data/test/gir_ffi-gtk/tree_store_test.rb +0 -40
  42. data/test/gir_ffi-gtk/tree_view_column_test.rb +0 -53
  43. data/test/gir_ffi-gtk/widget_test.rb +0 -105
  44. data/test/test_helper.rb +0 -38
@@ -1,21 +0,0 @@
1
- require 'gir_ffi-gtk3'
2
-
3
- GirFFI.setup :WebKit, '3.0'
4
-
5
- Gtk.init
6
-
7
- win = Gtk::OffscreenWindow.new
8
- web_view = WebKit::WebView.new
9
- win.add(web_view)
10
-
11
- web_view.signal_connect "load-finished" do
12
- pixbuf = win.get_pixbuf
13
- pixbuf.savev("google.png", "png", nil, nil)
14
- puts web_view.get_title
15
- Gtk.main_quit
16
- end
17
-
18
- web_view.load_uri('http://www.google.com/')
19
- win.show_all
20
-
21
- Gtk.main
@@ -1,24 +0,0 @@
1
- require 'gir_ffi-gtk3'
2
-
3
- GirFFI.setup :WebKit2, '4.0'
4
-
5
- Gtk.init
6
-
7
- win = Gtk::OffscreenWindow.new
8
- web_view = WebKit2::WebView.new
9
- win.add(web_view)
10
-
11
- web_view.signal_connect "load-changed" do |_, event, _|
12
- case event
13
- when :finished
14
- pixbuf = win.get_pixbuf
15
- pixbuf.savev("google.png", "png", nil, nil)
16
- puts web_view.get_title
17
- Gtk.main_quit
18
- end
19
- end
20
-
21
- web_view.load_uri('http://www.google.com/')
22
- win.show_all
23
-
24
- Gtk.main
@@ -1,62 +0,0 @@
1
- require 'gir_ffi-gtk3'
2
-
3
- # This is an example of creating a derived class with vfunc implementations.
4
-
5
- GirFFI.setup :GtkSource
6
-
7
- Gtk.init
8
-
9
- class TestProvider < GObject::Object
10
- include GtkSource::CompletionProvider
11
-
12
- def get_name
13
- 'Test Provider'
14
- end
15
-
16
- def get_priority
17
- 1
18
- end
19
-
20
- def match(_context)
21
- true
22
- end
23
-
24
- def populate(context)
25
- icon = Gtk::IconTheme.get_default.load_icon(Gtk::STOCK_DIALOG_INFO, 16, 0)
26
-
27
- proposals = [
28
- GtkSource::CompletionItem.new("Proposal 1", "Proposal 1", icon, "blah 1"),
29
- GtkSource::CompletionItem.new("Proposal 2", "Proposal 2", icon, "blah 2"),
30
- GtkSource::CompletionItem.new("Proposal 3", "Proposal 3", icon, "blah 3"),
31
- ]
32
- context.add_proposals(self, proposals, true)
33
- end
34
- end
35
-
36
- GirFFI.define_type TestProvider do |info|
37
- info.install_vfunc_implementation :get_name
38
- info.install_vfunc_implementation :get_priority
39
- info.install_vfunc_implementation :match
40
- info.install_vfunc_implementation :populate
41
- end
42
-
43
- win = Gtk::Window.new :toplevel
44
- win.show
45
- GObject.signal_connect(win, "destroy") { Gtk.main_quit }
46
-
47
- vbox = Gtk::VBox.new(false, 0)
48
- win.add vbox
49
-
50
- lm = GtkSource::LanguageManager.get_default
51
- lang = lm.get_language "ruby"
52
- buffer = GtkSource::Buffer.new_with_language lang
53
- @source = GtkSource::View.new_with_buffer buffer
54
-
55
- test_provider = TestProvider.new
56
- completion = @source.get_completion
57
- completion.add_provider test_provider
58
-
59
- vbox.pack_start @source, true, true, 0
60
-
61
- win.show_all
62
- Gtk.main
data/tasks/test.rake DELETED
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rake/testtask'
4
-
5
- namespace :test do
6
- Rake::TestTask.new(:gtk3) do |t|
7
- t.libs = ['lib']
8
- t.test_files = FileList['test/**/*_test.rb']
9
- t.ruby_opts += ['-w', '-Itest']
10
- end
11
-
12
- Rake::TestTask.new(:gtk2) do |t|
13
- t.libs = ['lib']
14
- t.test_files = FileList['test/**/*_test.rb']
15
- t.ruby_opts += ['-w', '-Itest']
16
- end
17
-
18
- task gtk2: :set_gtk_version_2
19
-
20
- task :set_gtk_version_2 do
21
- ENV['GTK_VERSION'] = '2'
22
- end
23
-
24
- task :sleep do
25
- sleep 1
26
- end
27
- end
28
-
29
- desc 'Run unit tests'
30
- task test: ['test:gtk3', 'test:sleep', 'test:gtk2']
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- class CallbackTestException < RuntimeError; end
6
-
7
- describe 'An exception in a callback' do
8
- describe 'for signals' do
9
- let(:object) { Gtk::Window.new :toplevel }
10
-
11
- before do
12
- object.signal_connect 'destroy' do
13
- raise CallbackTestException, 'Boom'
14
- end
15
- end
16
-
17
- describe 'when the signal is emitted synchronously' do
18
- it 'raises an error' do
19
- _(-> { GObject.signal_emit object, 'destroy' }).must_raise CallbackTestException
20
- end
21
- end
22
-
23
- describe 'when the signal is emitted during an event loop' do
24
- it 'causes loop run to be terminated with an exception' do
25
- GLib.timeout_add GLib::PRIORITY_DEFAULT, 1 do
26
- GObject.signal_emit object, 'destroy'
27
- false
28
- end
29
- # Guard against runaway loop
30
- @guard = GLib.timeout_add(GLib::PRIORITY_DEFAULT, 1000) { Gtk.main_quit }
31
- _(-> { Gtk.main }).must_raise CallbackTestException
32
- end
33
-
34
- after do
35
- GLib.source_remove @guard
36
- end
37
- end
38
- end
39
-
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
- GLib.timeout_add GLib::PRIORITY_DEFAULT, 1 do
44
- raise CallbackTestException, 'Boom'
45
- end
46
- # Guard against runaway loop
47
- @guard = GLib.timeout_add(GLib::PRIORITY_DEFAULT, 1000) { Gtk.main_quit }
48
- _(-> { Gtk.main }).must_raise CallbackTestException
49
- end
50
-
51
- after do
52
- GLib.source_remove @guard
53
- end
54
- end
55
- end
56
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- describe Gtk::Action do
6
- let(:action) { Gtk::Action.new('hi', 'Hello', 'hey there', Gtk::STOCK_FILE) }
7
-
8
- describe '#create_icon' do
9
- it 'works when called with a symbol' do
10
- result = action.create_icon :dialog
11
- _(result).must_be_instance_of Gtk::Image
12
- end
13
-
14
- it 'works when called with an integer' do
15
- result = action.create_icon 4
16
- _(result).must_be_instance_of Gtk::Image
17
- end
18
- end
19
- end
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- describe Gtk do
6
- describe '::init' do
7
- before do
8
- module DummyGtk
9
- def self.init(_arr)
10
- %w(baz qux zonk)
11
- end
12
-
13
- include GirFFIGtk::AutoArgv
14
- end
15
- end
16
-
17
- it 'does not take any arguments' do
18
- assert_raises(ArgumentError) { DummyGtk.init 1, ['foo'] }
19
- assert_raises(ArgumentError) { DummyGtk.init ['foo'] }
20
- assert_nothing_raised { DummyGtk.init }
21
- end
22
-
23
- it 'replaces ARGV with the tail of the result of the original init function' do
24
- ARGV.replace %w(foo bar)
25
- DummyGtk.init
26
- assert_equal %w(qux zonk), ARGV.to_a
27
- end
28
- end
29
-
30
- describe '::main' do
31
- it 'allows other threads to run' do
32
- a = []
33
- GLib.timeout_add(GLib::PRIORITY_DEFAULT, 150) { Gtk.main_quit }
34
-
35
- slow_thread = Thread.new do
36
- sleep 0.005
37
- a << 'During run'
38
- end
39
-
40
- a << 'Before run'
41
- Gtk.main
42
- a << 'After run'
43
-
44
- slow_thread.join
45
-
46
- _(a.last).must_equal 'After run'
47
- end
48
- end
49
- end
@@ -1,72 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- describe Gtk::Builder do
6
- let(:builder) { Gtk::Builder.new }
7
- let(:spec) do
8
- <<-XML
9
- <interface>
10
- <object class="GtkButton" id="foo">
11
- <signal handler="on_button_clicked" name="clicked"/>
12
- </object>
13
- </interface>
14
- XML
15
- end
16
-
17
- describe '#add_from_string' do
18
- it 'takes one string as argument' do
19
- builder.add_from_string spec
20
- pass
21
- end
22
- end
23
-
24
- describe '#connect_signals' do
25
- before do
26
- builder.add_from_string spec
27
- end
28
-
29
- it 'passes the handler name to the block' do
30
- name = nil
31
- builder.connect_signals do |handler_name|
32
- name = handler_name
33
- nil
34
- end
35
-
36
- _(name).must_equal 'on_button_clicked'
37
- end
38
-
39
- it 'connects the signal to the proc returned by the block' do
40
- name = nil
41
- builder.connect_signals do |handler_name|
42
- proc { name = handler_name }
43
- end
44
- button = builder.get_object('foo')
45
- GObject.signal_emit button, 'clicked'
46
- _(name).must_equal 'on_button_clicked'
47
- end
48
-
49
- describe 'with a signal with after flag' do
50
- let(:spec) do
51
- <<-XML
52
- <interface>
53
- <object class="GtkButton" id="foo">
54
- <signal handler="handler_after" name="clicked" after="true"/>
55
- <signal handler="handler_before" name="clicked"/>
56
- </object>
57
- </interface>
58
- XML
59
- end
60
-
61
- it 'connects the handlers in the right order' do
62
- name = nil
63
- builder.connect_signals do |handler_name|
64
- proc { name = handler_name }
65
- end
66
- button = builder.get_object('foo')
67
- GObject.signal_emit button, 'clicked'
68
- _(name).must_equal 'handler_after'
69
- end
70
- end
71
- end
72
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- describe Gtk::Button do
6
- describe '.new_from_icon_name' do
7
- before do
8
- skip if Gtk::MAJOR_VERSION == 2 || Gtk::MAJOR_VERSION == 3 && Gtk::MINOR_VERSION < 10
9
- end
10
-
11
- it 'works when called with a symbol' do
12
- result = Gtk::Button.new_from_icon_name('hi', :dialog)
13
- _(result).must_be_instance_of Gtk::Button
14
- end
15
-
16
- it 'works when called with an integer' do
17
- result = Gtk::Button.new_from_icon_name('hi', 4)
18
- _(result).must_be_instance_of Gtk::Button
19
- end
20
- end
21
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- describe Gtk::Container do
6
- let(:container) { Gtk::Table.new 1, 1, true }
7
- let(:widget) { Gtk::Label.new 'foo' }
8
-
9
- describe '#add_with_properties' do
10
- before do
11
- container.add_with_properties widget, 'left-attach': 1
12
- end
13
-
14
- it 'adds the widget to the container' do
15
- _(container.get_children.to_a).must_equal [widget]
16
- end
17
-
18
- it 'sets the child properties for the widget' do
19
- _(container.child_get_property(widget, 'left-attach')).must_equal 1
20
- end
21
- end
22
-
23
- describe '#child_get_property' do
24
- it 'fetches the given child property' do
25
- container.add widget
26
- container.child_set_property(widget, 'left-attach', 1)
27
- _(container.child_get_property(widget, 'left-attach')).must_equal 1
28
- end
29
-
30
- it 'raises an ArgumentError for unknown properties' do
31
- container.add widget
32
- _(proc { container.child_get_property(widget, 'foobar') }).must_raise ArgumentError
33
- end
34
- end
35
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- describe Gtk::Dialog do
6
- describe '.new_with_buttons' do
7
- it 'creates a Gtk::Dialog with the right title and buttons' do
8
- dialog = Gtk::Dialog.new_with_buttons 'Foo', nil, :modal, [['Bar', :yes]]
9
- _(dialog.title).must_equal 'Foo'
10
- button = dialog.action_area.children.first
11
- _(button.label).must_equal 'Bar'
12
- _(dialog.response_for_widget(button)).must_equal Gtk::ResponseType.to_int(:yes)
13
- end
14
- end
15
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- describe Gtk::FileChooserDialog do
6
- describe '.new' do
7
- it 'creates a Gtk::FileChooserDialog with the right attributes' do
8
- dialog = Gtk::FileChooserDialog.new 'Foo', nil, :save, [['Bar', :yes]]
9
- _(dialog.title).must_equal 'Foo'
10
- _(dialog.action).must_equal :save
11
- button = if Gtk::MAJOR_VERSION == 3 && Gtk::MINOR_VERSION >= 12
12
- dialog.header_bar.children.to_a.last
13
- else
14
- dialog.action_area.children.to_a.last
15
- end
16
- _(button.label).must_equal 'Bar'
17
- _(dialog.response_for_widget(button)).must_equal Gtk::ResponseType.to_int(:yes)
18
- end
19
- end
20
- end
@@ -1,60 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- # Tests generated methods and functions in the Gtk namespace.
6
- describe 'In the generated Gtk module' do
7
- describe 'a Gtk::Builder instance' do
8
- before do
9
- @builder = Gtk::Builder.new
10
- @spec = '
11
- <interface>
12
- <object class="GtkButton" id="foo">
13
- <signal handler="on_button_clicked" name="clicked"/>
14
- </object>
15
- </interface>
16
- '
17
- end
18
-
19
- it 'loads the interface spec' do
20
- assert_nothing_raised { @builder.add_from_string @spec }
21
- end
22
-
23
- describe 'its #get_object method' do
24
- it 'returns objects of the proper class' do
25
- @builder.add_from_string @spec
26
- o = @builder.get_object 'foo'
27
- assert_instance_of Gtk::Button, o
28
- end
29
- end
30
-
31
- describe 'its #connect_signals_full method' do
32
- before do
33
- @builder.add_from_string @spec
34
- end
35
- it 'passes arguments correctly' do
36
- aa = nil
37
- @builder.connect_signals_full { |*args| aa = args }
38
- b, o, sn, hn, co, f, ud = aa
39
- assert_instance_of Gtk::Builder, b
40
- assert_equal b.to_ptr, @builder.to_ptr
41
- assert_instance_of Gtk::Button, o
42
- assert_equal 'clicked', sn
43
- assert_equal 'on_button_clicked', hn
44
- _(co).must_be_nil
45
- assert_equal 0, f
46
- _(ud).wont_be_nil
47
- end
48
- end
49
- end
50
-
51
- describe 'a Gtk::Window instance' do
52
- before do
53
- @w = Gtk::Window.new :toplevel
54
- end
55
-
56
- it 'starts with a refcount of 2 (one for us, one for GTK+)' do
57
- assert_equal 2, ref_count(@w)
58
- end
59
- end
60
- end
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- describe Gtk::Image do
6
- describe '.new_from_icon_name' do
7
- it 'works when called with a symbol' do
8
- result = Gtk::Image.new_from_icon_name('hi', :dialog)
9
- _(result).must_be_instance_of Gtk::Image
10
- end
11
-
12
- it 'works when called with an integer' do
13
- result = Gtk::Image.new_from_icon_name('hi', 4)
14
- _(result).must_be_instance_of Gtk::Image
15
- end
16
- end
17
-
18
- describe '.new_from_gicon' do
19
- let(:gicon) { Gio::ThemedIcon.new('hi') }
20
- it 'works when called with a symbol' do
21
- result = Gtk::Image.new_from_gicon(gicon, :dialog)
22
- _(result).must_be_instance_of Gtk::Image
23
- end
24
-
25
- it 'works when called with an integer' do
26
- result = Gtk::Image.new_from_gicon(gicon, 4)
27
- _(result).must_be_instance_of Gtk::Image
28
- end
29
- end
30
-
31
- describe '#set_from_gicon' do
32
- let(:gicon) { Gio::ThemedIcon.new('gnome') }
33
- let(:image) { Gtk::Image.new }
34
-
35
- it 'works when called with a symbol' do
36
- image.set_from_gicon(gicon, :dialog)
37
- _(image.get_gicon).must_equal [gicon, 6]
38
- end
39
-
40
- it 'works when called with an integer' do
41
- image.set_from_gicon(gicon, 4)
42
- _(image.get_gicon).must_equal [gicon, 4]
43
- end
44
- end
45
- end
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- describe Gtk::ListStore do
6
- describe '.new' do
7
- it 'takes an array of column types' do
8
- store = Gtk::ListStore.new([GObject::TYPE_STRING, GObject::TYPE_INT])
9
- _(store).must_be_instance_of Gtk::ListStore
10
- end
11
- end
12
-
13
- describe '#insert_with_values' do
14
- it 'inserts a row with the given values' do
15
- store = Gtk::ListStore.new([GObject::TYPE_STRING, GObject::TYPE_INT])
16
- row = store.insert_with_values(0, [0, 1], ['foo', 42])
17
- _(store.get_value(row, 0)).must_equal 'foo'
18
- _(store.get_value(row, 1)).must_equal 42
19
- end
20
- end
21
-
22
- describe '#set' do
23
- it 'updates a row with the given values' do
24
- store = Gtk::ListStore.new([GObject::TYPE_STRING, GObject::TYPE_INT])
25
- row = store.insert_with_values(0, [0, 1], ['foo', 42])
26
- store.set(row, [1, 0], [3, 'bar'])
27
- _(store.get_value(row, 0)).must_equal 'bar'
28
- _(store.get_value(row, 1)).must_equal 3
29
- end
30
- end
31
-
32
- describe '#set_value' do
33
- it 'allows setting a value to nil' do
34
- store = Gtk::ListStore.new([GObject::TYPE_STRING, GObject::TYPE_INT])
35
- row = store.insert_with_values(0, [0, 1], ['foo', 42])
36
- store.set_value(row, 0, nil)
37
- _(store.get_value(row, 0)).must_be_nil
38
- end
39
- end
40
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- describe Gtk::Menu do
6
- describe '#popup' do
7
- it 'can be called with 4 arguments' do
8
- mnu = Gtk::Menu.new
9
- mnu.popup(nil, nil, 1, 32)
10
- end
11
- end
12
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- describe Gtk::MessageDialog do
6
- describe '.new' do
7
- it 'creates a Gtk::MessageDialog with the right text' do
8
- dialog = Gtk::MessageDialog.new nil, :modal, :info, :close, 'Foo'
9
- _(dialog.text).must_equal 'Foo'
10
- end
11
-
12
- it 'handles all % characters in the message as literals' do
13
- dialog = Gtk::MessageDialog.new nil, :modal, :info, :close, 'Foo %'
14
- _(dialog.text).must_equal 'Foo %'
15
- end
16
- end
17
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- describe Gtk::RadioAction do
6
- describe '#get_group' do
7
- it 'returns a GLib::SList object' do
8
- action = Gtk::RadioAction.new 'name', 'label', 'tooltip', nil, 1
9
- grp = action.get_group
10
- _(grp).must_be_instance_of GLib::SList
11
- end
12
- end
13
-
14
- describe '#set_group' do
15
- let(:action) { Gtk::RadioAction.new 'name', 'label', 'tooltip', nil, 1 }
16
-
17
- it 'accepts nil' do
18
- action.set_group nil
19
- pass
20
- end
21
-
22
- it 'accepts a GLib::SList object' do
23
- grp = action.get_group
24
- other_action = Gtk::RadioAction.new('other-name', 'other-label',
25
- 'other-tooltip', nil, 2)
26
- other_action.set_group grp
27
- pass
28
- end
29
- end
30
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- describe Gtk::RadioButton do
6
- describe '.new_from_widget' do
7
- it 'works when called with nil' do
8
- result = Gtk::RadioButton.new_from_widget(nil)
9
- _(result).must_be_instance_of Gtk::RadioButton
10
- end
11
-
12
- it 'works when called with another radio button' do
13
- btn = Gtk::RadioButton.new_from_widget nil
14
- result = Gtk::RadioButton.new_from_widget btn
15
- _(result).must_be_instance_of Gtk::RadioButton
16
- end
17
- end
18
-
19
- describe '#get_group' do
20
- it 'returns a GLib::SList object' do
21
- btn = Gtk::RadioButton.new_from_widget nil
22
- grp = btn.get_group
23
- assert_instance_of GLib::SList, grp
24
- end
25
- end
26
-
27
- describe '.new' do
28
- it 'works when called with nil' do
29
- result = Gtk::RadioButton.new nil
30
- _(result).must_be_instance_of Gtk::RadioButton
31
- end
32
-
33
- it 'works when called with the result of #get_group' do
34
- btn = Gtk::RadioButton.new_from_widget nil
35
- result = Gtk::RadioButton.new btn.get_group
36
- _(result).must_be_instance_of Gtk::RadioButton
37
- end
38
- end
39
- end