gir_ffi-gtk 0.14.0 → 0.14.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 281f8a6888138d1e0202fb5db8c0ea53360554105b53d6406341178b0ed78b3f
4
- data.tar.gz: 962bcd69122c211806c3080b338ab8149db749b4f2e05308054e8a427f5f3f1c
3
+ metadata.gz: 8bd9e77a426417bff917414f6d484ec54248a58159a0160f7a5f8dad983a4bef
4
+ data.tar.gz: 4f3f05f2d9da9adb3dd5283c6c5e6abede7c170b9e8e77c57e555c820c7ac09d
5
5
  SHA512:
6
- metadata.gz: c22e681ac28ad88e51a77a6abe88537222d9efa0fe559fc5d697810adcfbc3d47aa090e8451f6fd6a93324ace8857805700211913e36da1ff46397ecae34816b
7
- data.tar.gz: 196ec071a952298f9a9d71769325beb0fbbf696feff3425ffc5057bb6061323495fc8873ab8af905f9b97dffef70a915d4d2e0bfc9453b3f85b1794e4b8e7c95
6
+ metadata.gz: 83176abd6470da76a04a1a702d17bb51a9809e4510eb63dc35eaf626c585563b699e04a77e8398cf0edfdc6e470c92c491367a124cc1a7a60f3e69e9b1588d1a
7
+ data.tar.gz: 973b776ac24f27de88e9550e5388b8bef089e402e5f875c914cf6d6e3bb9e751fe4fe09bc9daa793a4303c062ca16ed64ae79317c5192cd6bf319548ff96ea0c
@@ -3,6 +3,13 @@
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.14.1 / 2018-12-19
7
+
8
+ * Override `Gtk::Widget#get_events`, `Gtk::Widget#set_events` and
9
+ `Gtk::Widget#add_events` methods to take and return `EventMask` values
10
+ instead of bare `int`s.
11
+ * Fix license in gemspec; it's LGPL 2.1 or later
12
+
6
13
  ## 0.14.0 / 2018-09-27
7
14
 
8
15
  * Depend on GirFFI 0.14.0
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GirFFIGtk
4
+ # Overrides for GtkWidget methods
5
+ module WidgetOverrides
6
+ def add_events(events)
7
+ super Gdk::EventMask.to_int events
8
+ end
9
+
10
+ def get_events
11
+ Gdk::EventMask.from_native super
12
+ end
13
+
14
+ def set_events(events)
15
+ super Gdk::EventMask.to_int events
16
+ end
17
+ end
18
+ end
19
+
20
+ Gtk.load_class :Widget
21
+
22
+ Gtk::Widget.setup_instance_method! :add_events
23
+ Gtk::Widget.setup_instance_method! :get_events
24
+ Gtk::Widget.setup_instance_method! :set_events
25
+ Gtk::Widget.prepend GirFFIGtk::WidgetOverrides
@@ -18,6 +18,7 @@ require 'gir_ffi-gtk/message_dialog'
18
18
  require 'gir_ffi-gtk/tree_path'
19
19
  require 'gir_ffi-gtk/tree_store'
20
20
  require 'gir_ffi-gtk/tree_view_column'
21
+ require 'gir_ffi-gtk/widget'
21
22
 
22
23
  require 'gir_ffi-gtk/gtk2/list_store'
23
24
  require 'gir_ffi-gtk/gtk2/radio_action'
@@ -18,6 +18,7 @@ require 'gir_ffi-gtk/message_dialog'
18
18
  require 'gir_ffi-gtk/tree_path'
19
19
  require 'gir_ffi-gtk/tree_store'
20
20
  require 'gir_ffi-gtk/tree_view_column'
21
+ require 'gir_ffi-gtk/widget'
21
22
 
22
23
  require 'gir_ffi-gtk/gtk3/button'
23
24
  require 'gir_ffi-gtk/gtk3/target_entry'
@@ -0,0 +1,103 @@
1
+ require 'test_helper'
2
+
3
+ describe Gtk::Widget do
4
+ describe '#add_events' do
5
+ let(:widget) { Gtk::EventBox.new }
6
+ let(:expected_native) do
7
+ Gdk::EventMask.to_int(focus_change_mask: true,
8
+ button_press_mask: true)
9
+ end
10
+
11
+ before do
12
+ ev_int = Gdk::EventMask.to_int :focus_change_mask
13
+ widget.set_events ev_int
14
+ end
15
+
16
+ it 'works when called with a bitmask hash' do
17
+ widget.add_events button_press_mask: true
18
+ ev = widget.get_events
19
+ Gdk::EventMask.to_int(ev).must_equal expected_native
20
+ end
21
+
22
+ it 'works when called with a symbol' do
23
+ widget.add_events :button_press_mask
24
+ ev = widget.get_events
25
+ Gdk::EventMask.to_int(ev).must_equal expected_native
26
+ end
27
+
28
+ it 'works when called with an int' do
29
+ ev_int = Gdk::EventMask.to_int :button_press_mask
30
+ widget.add_events ev_int
31
+ ev = widget.get_events
32
+ Gdk::EventMask.to_int(ev).must_equal expected_native
33
+ end
34
+ end
35
+
36
+ describe '#get_events' do
37
+ let(:widget) { Gtk::EventBox.new }
38
+
39
+ it 'returns a bitmap hash' do
40
+ widget.set_events focus_change_mask: true
41
+ ev = widget.get_events
42
+ ev.must_equal focus_change_mask: true
43
+ end
44
+ end
45
+
46
+ describe '#set_events' do
47
+ let(:widget) { Gtk::EventBox.new }
48
+ let(:expected_native) { Gdk::EventMask.to_int(focus_change_mask: true) }
49
+
50
+ it 'works when called with a bitmask hash' do
51
+ widget.set_events focus_change_mask: true
52
+ ev = widget.get_events
53
+ Gdk::EventMask.to_int(ev).must_equal expected_native
54
+ end
55
+
56
+ it 'works when called with a symbol' do
57
+ widget.set_events :focus_change_mask
58
+ ev = widget.get_events
59
+ Gdk::EventMask.to_int(ev).must_equal expected_native
60
+ end
61
+
62
+ it 'works when called with an int' do
63
+ ev_int = Gdk::EventMask.to_int :focus_change_mask
64
+ widget.set_events ev_int
65
+ ev = widget.get_events
66
+ Gdk::EventMask.to_int(ev).must_equal expected_native
67
+ end
68
+ end
69
+
70
+ describe '#events' do
71
+ let(:widget) { Gtk::EventBox.new }
72
+
73
+ it 'returns a bitmap hash' do
74
+ widget.set_events focus_change_mask: true
75
+ ev = widget.events
76
+ ev.must_equal focus_change_mask: true
77
+ end
78
+ end
79
+
80
+ describe '#events=' do
81
+ let(:widget) { Gtk::EventBox.new }
82
+ let(:expected_native) { Gdk::EventMask.to_int(focus_change_mask: true) }
83
+
84
+ it 'works when called with a bitmask hash' do
85
+ widget.events = { focus_change_mask: true }
86
+ ev = widget.get_events
87
+ Gdk::EventMask.to_int(ev).must_equal expected_native
88
+ end
89
+
90
+ it 'works when called with a symbol' do
91
+ widget.events = :focus_change_mask
92
+ ev = widget.get_events
93
+ Gdk::EventMask.to_int(ev).must_equal expected_native
94
+ end
95
+
96
+ it 'works when called with an int' do
97
+ ev_int = Gdk::EventMask.to_int :focus_change_mask
98
+ widget.events = ev_int
99
+ ev = widget.get_events
100
+ Gdk::EventMask.to_int(ev).must_equal expected_native
101
+ end
102
+ end
103
+ end
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.14.0
4
+ version: 0.14.1
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-09-27 00:00:00.000000000 Z
11
+ date: 2018-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gir_ffi
@@ -107,6 +107,7 @@ files:
107
107
  - lib/gir_ffi-gtk/tree_path.rb
108
108
  - lib/gir_ffi-gtk/tree_store.rb
109
109
  - lib/gir_ffi-gtk/tree_view_column.rb
110
+ - lib/gir_ffi-gtk/widget.rb
110
111
  - lib/gir_ffi-gtk2.rb
111
112
  - lib/gir_ffi-gtk3.rb
112
113
  - tasks/test.rake
@@ -129,10 +130,11 @@ files:
129
130
  - test/gir_ffi-gtk/tree_path_test.rb
130
131
  - test/gir_ffi-gtk/tree_store_test.rb
131
132
  - test/gir_ffi-gtk/tree_view_column_test.rb
133
+ - test/gir_ffi-gtk/widget_test.rb
132
134
  - test/test_helper.rb
133
135
  homepage: http://www.github.com/mvz/gir_ffi-gtk
134
136
  licenses:
135
- - LGPL-2.1
137
+ - LGPL-2.1+
136
138
  metadata: {}
137
139
  post_install_message:
138
140
  rdoc_options: []
@@ -174,4 +176,5 @@ test_files:
174
176
  - test/gir_ffi-gtk/tree_path_test.rb
175
177
  - test/gir_ffi-gtk/tree_store_test.rb
176
178
  - test/gir_ffi-gtk/tree_view_column_test.rb
179
+ - test/gir_ffi-gtk/widget_test.rb
177
180
  - test/test_helper.rb