gdk3 2.2.0 → 2.2.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.
- checksums.yaml +4 -4
- data/Rakefile +18 -4
- data/lib/gdk3/atom.rb +26 -0
- data/lib/gdk3/cairo.rb +60 -0
- data/lib/gdk3/color.rb +27 -0
- data/lib/gdk3/deprecated.rb +14 -16
- data/lib/gdk3/event.rb +38 -0
- data/lib/gdk3/loader.rb +266 -0
- data/lib/gdk3/rectangle.rb +38 -0
- data/lib/gdk3/rgba.rb +32 -0
- data/lib/gdk3/window-attr.rb +28 -0
- data/lib/gdk3/window.rb +21 -0
- data/lib/gdk3.rb +61 -2
- data/test/run-test.rb +15 -6
- data/test/test-gdk-cairo.rb +41 -0
- data/test/test-gdk-event-type.rb +25 -0
- data/test/test-gdk-event.rb +47 -49
- data/test/test-gdk-keyval.rb +21 -0
- data/test/test-gdk-pixbuf.rb +49 -0
- data/test/test-gdk-rectangle.rb +35 -4
- data/test/test-gdk-rgba.rb +6 -1
- data/test/test-gdk-window-attr.rb +1 -1
- metadata +23 -51
- data/ext/gdk3/depend +0 -11
- data/ext/gdk3/extconf.rb +0 -130
- data/ext/gdk3/gdk3.def +0 -12
- data/ext/gdk3/init.c +0 -35
- data/ext/gdk3/rbgdk.c +0 -491
- data/ext/gdk3/rbgdk3.h +0 -73
- data/ext/gdk3/rbgdk3conversions.h +0 -121
- data/ext/gdk3/rbgdk3private.h +0 -85
- data/ext/gdk3/rbgdkatom.c +0 -122
- data/ext/gdk3/rbgdkcairo.c +0 -91
- data/ext/gdk3/rbgdkcolor.c +0 -137
- data/ext/gdk3/rbgdkconst.c +0 -33
- data/ext/gdk3/rbgdkcursor.c +0 -92
- data/ext/gdk3/rbgdkdevice.c +0 -253
- data/ext/gdk3/rbgdkdevicemanager.c +0 -39
- data/ext/gdk3/rbgdkdisplay.c +0 -434
- data/ext/gdk3/rbgdkdisplaymanager.c +0 -55
- data/ext/gdk3/rbgdkdragcontext.c +0 -191
- data/ext/gdk3/rbgdkevent.c +0 -1173
- data/ext/gdk3/rbgdkgeometry.c +0 -253
- data/ext/gdk3/rbgdkkeymap.c +0 -151
- data/ext/gdk3/rbgdkkeyval.c +0 -108
- data/ext/gdk3/rbgdkpango.c +0 -197
- data/ext/gdk3/rbgdkpangorenderer.c +0 -144
- data/ext/gdk3/rbgdkpixbuf.c +0 -176
- data/ext/gdk3/rbgdkproperty.c +0 -305
- data/ext/gdk3/rbgdkrectangle.c +0 -140
- data/ext/gdk3/rbgdkrgb.c +0 -199
- data/ext/gdk3/rbgdkrgba.c +0 -142
- data/ext/gdk3/rbgdkscreen.c +0 -443
- data/ext/gdk3/rbgdkselection.c +0 -146
- data/ext/gdk3/rbgdkthreads.c +0 -77
- data/ext/gdk3/rbgdktimecoord.c +0 -133
- data/ext/gdk3/rbgdkvisual.c +0 -251
- data/ext/gdk3/rbgdkwindow.c +0 -1069
- data/ext/gdk3/rbgdkwindowattr.c +0 -191
- data/ext/gdk3/rbgdkx11.c +0 -102
- data/ext/gdk3/rbgdkx11x11window.c +0 -66
- data/extconf.rb +0 -49
- data/lib/gdk3/base.rb +0 -59
data/lib/gdk3.rb
CHANGED
@@ -1,3 +1,62 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
3
16
|
|
17
|
+
require "gobject-introspection"
|
18
|
+
require "cairo-gobject"
|
19
|
+
require "atk"
|
20
|
+
require "pango"
|
21
|
+
require "gdk_pixbuf2"
|
22
|
+
|
23
|
+
base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
|
24
|
+
vendor_dir = base_dir + "vendor" + "local"
|
25
|
+
vendor_bin_dir = vendor_dir + "bin"
|
26
|
+
GLib.prepend_dll_path(vendor_bin_dir)
|
27
|
+
vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0"
|
28
|
+
GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir)
|
29
|
+
|
30
|
+
require "gdk3/loader"
|
31
|
+
|
32
|
+
module Gdk
|
33
|
+
LOG_DOMAIN = "Gdk"
|
34
|
+
GLib::Log.set_log_domain(LOG_DOMAIN)
|
35
|
+
|
36
|
+
class Error < StandardError
|
37
|
+
end
|
38
|
+
|
39
|
+
class << self
|
40
|
+
def const_missing(name)
|
41
|
+
init
|
42
|
+
if const_defined?(name)
|
43
|
+
const_get(name)
|
44
|
+
else
|
45
|
+
super
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def init
|
50
|
+
class << self
|
51
|
+
remove_method(:init)
|
52
|
+
remove_method(:const_missing)
|
53
|
+
end
|
54
|
+
loader = Loader.new(self)
|
55
|
+
loader.load("Gdk")
|
56
|
+
end
|
57
|
+
|
58
|
+
def cairo_available?
|
59
|
+
true
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
data/test/run-test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
# Copyright (C) 2013 Ruby-GNOME2 Project Team
|
3
|
+
# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
|
4
4
|
#
|
5
5
|
# This library is free software; you can redistribute it and/or
|
6
6
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -21,15 +21,20 @@ ruby_gnome2_base = File.expand_path(ruby_gnome2_base)
|
|
21
21
|
|
22
22
|
glib_base = File.join(ruby_gnome2_base, "glib2")
|
23
23
|
atk_base = File.join(ruby_gnome2_base, "atk")
|
24
|
+
cairo_gobject_base = File.join(ruby_gnome2_base, "cairo-gobject")
|
24
25
|
pango_base = File.join(ruby_gnome2_base, "pango")
|
25
26
|
gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdk_pixbuf2")
|
27
|
+
gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection")
|
26
28
|
gdk3_base = File.join(ruby_gnome2_base, "gdk3")
|
27
29
|
|
28
|
-
[
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
[
|
31
|
+
[glib_base, "glib2"],
|
32
|
+
[atk_base, "atk"],
|
33
|
+
[cairo_gobject_base, "cairo-gobject"],
|
34
|
+
[pango_base, "pango"],
|
35
|
+
[gdk_pixbuf_base, "gdk_pixbuf2"],
|
36
|
+
[gobject_introspection_base, "gobject-introspection"]
|
37
|
+
].each do |target, module_name|
|
33
38
|
if system("which make > /dev/null")
|
34
39
|
`make -C #{target.dump} > /dev/null` or exit(false)
|
35
40
|
end
|
@@ -37,6 +42,8 @@ gdk3_base = File.join(ruby_gnome2_base, "gdk3")
|
|
37
42
|
$LOAD_PATH.unshift(File.join(target, "lib"))
|
38
43
|
end
|
39
44
|
|
45
|
+
$LOAD_PATH.unshift(File.join(gdk3_base, "lib"))
|
46
|
+
|
40
47
|
$LOAD_PATH.unshift(File.join(glib_base, "test"))
|
41
48
|
require "glib-test-init"
|
42
49
|
|
@@ -44,5 +51,7 @@ $LOAD_PATH.unshift(File.join(gdk3_base, "test"))
|
|
44
51
|
require "gdk-test-utils"
|
45
52
|
|
46
53
|
require "gdk3"
|
54
|
+
Gdk.init
|
55
|
+
Gdk.init_check([$0])
|
47
56
|
|
48
57
|
exit Test::Unit::AutoRunner.run(true)
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 Ruby-GNOME2 Project Team
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
|
19
|
+
require "stringio"
|
20
|
+
|
21
|
+
class TestGdkCairo < Test::Unit::TestCase
|
22
|
+
def setup
|
23
|
+
output = StringIO.new
|
24
|
+
surface = Cairo::PDFSurface.new(output, 10, 10)
|
25
|
+
@context = Cairo::Context.new(surface)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_set_source_color
|
29
|
+
color = Gdk::Color.new(0xffff, 0x0000, 0xffff)
|
30
|
+
@context.source_color = color
|
31
|
+
assert_equal(Cairo::Color::RGB.new(1.0, 0.0, 1.0),
|
32
|
+
@context.source.color)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_set_source_rgba
|
36
|
+
rgba = Gdk::RGBA.new(0.1, 0.2, 0.3, 0.4)
|
37
|
+
@context.source_rgba = rgba
|
38
|
+
assert_equal(Cairo::Color::RGB.new(0.1, 0.2, 0.3, 0.4),
|
39
|
+
@context.source.color)
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Copyright (C) 2014 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
class TestGdkEventType < Test::Unit::TestCase
|
18
|
+
def test_2button_press
|
19
|
+
assert_equal("2button-press", Gdk::EventType::BUTTON2_PRESS.nick)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_3button_press
|
23
|
+
assert_equal("3button-press", Gdk::EventType::BUTTON3_PRESS.nick)
|
24
|
+
end
|
25
|
+
end
|
data/test/test-gdk-event.rb
CHANGED
@@ -30,9 +30,13 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
30
30
|
module TestAnyMethods
|
31
31
|
def test_window
|
32
32
|
assert_nil(event.window)
|
33
|
+
attributes = Gdk::WindowAttr.new(100, 100, :input_only, :temp)
|
34
|
+
window = Gdk::Window.new(nil, attributes, 0)
|
35
|
+
event.window = window
|
36
|
+
assert_equal(window, event.window)
|
33
37
|
end
|
34
38
|
|
35
|
-
def test_send_event
|
39
|
+
def test_send_event?
|
36
40
|
assert_false(event.send_event?)
|
37
41
|
end
|
38
42
|
end
|
@@ -50,12 +54,12 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
50
54
|
|
51
55
|
def test_delete
|
52
56
|
assert_equal("GDK_DELETE",
|
53
|
-
Gdk::EventAny.new(:delete).
|
57
|
+
Gdk::EventAny.new(:delete).type.name)
|
54
58
|
end
|
55
59
|
|
56
60
|
def test_destroy
|
57
61
|
assert_equal("GDK_DESTROY",
|
58
|
-
Gdk::EventAny.new(:destroy).
|
62
|
+
Gdk::EventAny.new(:destroy).type.name)
|
59
63
|
end
|
60
64
|
end
|
61
65
|
|
@@ -72,12 +76,12 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
72
76
|
|
73
77
|
def test_key_press
|
74
78
|
assert_equal("GDK_KEY_PRESS",
|
75
|
-
Gdk::EventKey.new(:key_press).
|
79
|
+
Gdk::EventKey.new(:key_press).type.name)
|
76
80
|
end
|
77
81
|
|
78
82
|
def test_key_release
|
79
83
|
assert_equal("GDK_KEY_RELEASE",
|
80
|
-
Gdk::EventKey.new(:key_release).
|
84
|
+
Gdk::EventKey.new(:key_release).type.name)
|
81
85
|
end
|
82
86
|
|
83
87
|
def test_time
|
@@ -106,22 +110,22 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
106
110
|
|
107
111
|
def test_button_press
|
108
112
|
assert_equal("GDK_BUTTON_PRESS",
|
109
|
-
Gdk::EventButton.new(:button_press).
|
113
|
+
Gdk::EventButton.new(:button_press).type.name)
|
110
114
|
end
|
111
115
|
|
112
116
|
def test_button2_press
|
113
117
|
assert_equal("GDK_2BUTTON_PRESS",
|
114
|
-
Gdk::EventButton.new(:button2_press).
|
118
|
+
Gdk::EventButton.new(:button2_press).type.name)
|
115
119
|
end
|
116
120
|
|
117
121
|
def test_button3_press
|
118
122
|
assert_equal("GDK_3BUTTON_PRESS",
|
119
|
-
Gdk::EventButton.new(:button3_press).
|
123
|
+
Gdk::EventButton.new(:button3_press).type.name)
|
120
124
|
end
|
121
125
|
|
122
126
|
def test_button_release
|
123
127
|
assert_equal("GDK_BUTTON_RELEASE",
|
124
|
-
Gdk::EventButton.new(:button_release).
|
128
|
+
Gdk::EventButton.new(:button_release).type.name)
|
125
129
|
end
|
126
130
|
|
127
131
|
def test_time
|
@@ -188,28 +192,26 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
188
192
|
|
189
193
|
def test_touch_begin
|
190
194
|
assert_equal("GDK_TOUCH_BEGIN",
|
191
|
-
Gdk::EventTouch.new(:touch_begin).
|
195
|
+
Gdk::EventTouch.new(:touch_begin).type.name)
|
192
196
|
end
|
193
197
|
|
194
198
|
def test_touch_update
|
195
199
|
assert_equal("GDK_TOUCH_UPDATE",
|
196
|
-
Gdk::EventTouch.new(:touch_update).
|
200
|
+
Gdk::EventTouch.new(:touch_update).type.name)
|
197
201
|
end
|
198
202
|
|
199
203
|
def test_touch_cancel
|
200
204
|
assert_equal("GDK_TOUCH_CANCEL",
|
201
|
-
Gdk::EventTouch.new(:touch_cancel).
|
205
|
+
Gdk::EventTouch.new(:touch_cancel).type.name)
|
202
206
|
end
|
203
207
|
|
204
208
|
def test_touch_end
|
205
209
|
assert_equal("GDK_TOUCH_END",
|
206
|
-
Gdk::EventTouch.new(:touch_end).
|
210
|
+
Gdk::EventTouch.new(:touch_end).type.name)
|
207
211
|
end
|
208
212
|
|
209
213
|
def test_emulating_pointer
|
210
|
-
|
211
|
-
@touch.emulating_pointer
|
212
|
-
end
|
214
|
+
assert_boolean(@touch.emulating_pointer?)
|
213
215
|
end
|
214
216
|
|
215
217
|
def test_device
|
@@ -231,7 +233,7 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
231
233
|
include TestAnyMethods
|
232
234
|
|
233
235
|
def setup
|
234
|
-
@scroll = Gdk::EventScroll.new
|
236
|
+
@scroll = Gdk::EventScroll.new(:scroll)
|
235
237
|
end
|
236
238
|
|
237
239
|
def event
|
@@ -255,7 +257,7 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
255
257
|
end
|
256
258
|
|
257
259
|
def test_direction
|
258
|
-
assert_kind_of(Gdk::
|
260
|
+
assert_kind_of(Gdk::ScrollDirection, @scroll.direction)
|
259
261
|
end
|
260
262
|
|
261
263
|
def test_x_root
|
@@ -271,7 +273,7 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
271
273
|
include TestAnyMethods
|
272
274
|
|
273
275
|
def setup
|
274
|
-
@motion = Gdk::EventMotion.new
|
276
|
+
@motion = Gdk::EventMotion.new(:motion_notify)
|
275
277
|
end
|
276
278
|
|
277
279
|
def event
|
@@ -321,7 +323,7 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
321
323
|
end
|
322
324
|
|
323
325
|
def test_state
|
324
|
-
assert_kind_of(Gdk::
|
326
|
+
assert_kind_of(Gdk::VisibilityState, @visibility.state)
|
325
327
|
end
|
326
328
|
end
|
327
329
|
|
@@ -338,12 +340,12 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
338
340
|
|
339
341
|
def test_enter_notify
|
340
342
|
assert_equal("GDK_ENTER_NOTIFY",
|
341
|
-
Gdk::EventCrossing.new(:enter_notify).
|
343
|
+
Gdk::EventCrossing.new(:enter_notify).type.name)
|
342
344
|
end
|
343
345
|
|
344
346
|
def test_leave_notify
|
345
347
|
assert_equal("GDK_LEAVE_NOTIFY",
|
346
|
-
Gdk::EventCrossing.new(:leave_notify).
|
348
|
+
Gdk::EventCrossing.new(:leave_notify).type.name)
|
347
349
|
end
|
348
350
|
|
349
351
|
def test_time
|
@@ -351,13 +353,11 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
351
353
|
end
|
352
354
|
|
353
355
|
def test_x
|
354
|
-
|
355
|
-
assert_kind_of(Integer, @crossing.x)
|
356
|
+
assert_kind_of(Float, @crossing.x)
|
356
357
|
end
|
357
358
|
|
358
359
|
def test_y
|
359
|
-
|
360
|
-
assert_kind_of(Integer, @crossing.y)
|
360
|
+
assert_kind_of(Float, @crossing.y)
|
361
361
|
end
|
362
362
|
|
363
363
|
def test_x_root
|
@@ -369,7 +369,7 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
369
369
|
end
|
370
370
|
|
371
371
|
def test_mode
|
372
|
-
assert_kind_of(Gdk::
|
372
|
+
assert_kind_of(Gdk::CrossingMode, @crossing.mode)
|
373
373
|
end
|
374
374
|
|
375
375
|
def test_detail
|
@@ -385,7 +385,7 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
385
385
|
include TestAnyMethods
|
386
386
|
|
387
387
|
def setup
|
388
|
-
@focus = Gdk::EventFocus.new
|
388
|
+
@focus = Gdk::EventFocus.new(:focus_change)
|
389
389
|
end
|
390
390
|
|
391
391
|
def event
|
@@ -401,7 +401,7 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
401
401
|
include TestAnyMethods
|
402
402
|
|
403
403
|
def setup
|
404
|
-
@configure = Gdk::EventConfigure.new
|
404
|
+
@configure = Gdk::EventConfigure.new(:configure)
|
405
405
|
end
|
406
406
|
|
407
407
|
def event
|
@@ -429,7 +429,7 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
429
429
|
include TestAnyMethods
|
430
430
|
|
431
431
|
def setup
|
432
|
-
@property = Gdk::EventProperty.new
|
432
|
+
@property = Gdk::EventProperty.new(:property_notify)
|
433
433
|
end
|
434
434
|
|
435
435
|
def event
|
@@ -447,7 +447,7 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
447
447
|
end
|
448
448
|
|
449
449
|
def test_state
|
450
|
-
assert_equal(Gdk::
|
450
|
+
assert_equal(Gdk::PropertyState::NEW_VALUE, @property.state)
|
451
451
|
end
|
452
452
|
end
|
453
453
|
|
@@ -464,17 +464,17 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
464
464
|
|
465
465
|
def test_selection_clear
|
466
466
|
assert_equal("GDK_SELECTION_CLEAR",
|
467
|
-
Gdk::EventSelection.new(:selection_clear).
|
467
|
+
Gdk::EventSelection.new(:selection_clear).type.name)
|
468
468
|
end
|
469
469
|
|
470
470
|
def test_selection_notify
|
471
471
|
assert_equal("GDK_SELECTION_NOTIFY",
|
472
|
-
Gdk::EventSelection.new(:selection_notify).
|
472
|
+
Gdk::EventSelection.new(:selection_notify).type.name)
|
473
473
|
end
|
474
474
|
|
475
475
|
def test_selection_request
|
476
476
|
assert_equal("GDK_SELECTION_REQUEST",
|
477
|
-
Gdk::EventSelection.new(:selection_request).
|
477
|
+
Gdk::EventSelection.new(:selection_request).type.name)
|
478
478
|
end
|
479
479
|
|
480
480
|
def test_selection
|
@@ -513,32 +513,32 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
513
513
|
|
514
514
|
def test_drag_enter
|
515
515
|
assert_equal("GDK_DRAG_ENTER",
|
516
|
-
Gdk::EventDND.new(:drag_enter).
|
516
|
+
Gdk::EventDND.new(:drag_enter).type.name)
|
517
517
|
end
|
518
518
|
|
519
519
|
def test_drag_leave
|
520
520
|
assert_equal("GDK_DRAG_LEAVE",
|
521
|
-
Gdk::EventDND.new(:drag_leave).
|
521
|
+
Gdk::EventDND.new(:drag_leave).type.name)
|
522
522
|
end
|
523
523
|
|
524
524
|
def test_drag_motion
|
525
525
|
assert_equal("GDK_DRAG_MOTION",
|
526
|
-
Gdk::EventDND.new(:drag_motion).
|
526
|
+
Gdk::EventDND.new(:drag_motion).type.name)
|
527
527
|
end
|
528
528
|
|
529
529
|
def test_drag_status
|
530
530
|
assert_equal("GDK_DRAG_STATUS",
|
531
|
-
Gdk::EventDND.new(:drag_status).
|
531
|
+
Gdk::EventDND.new(:drag_status).type.name)
|
532
532
|
end
|
533
533
|
|
534
534
|
def test_drop_start
|
535
535
|
assert_equal("GDK_DROP_START",
|
536
|
-
Gdk::EventDND.new(:drop_start).
|
536
|
+
Gdk::EventDND.new(:drop_start).type.name)
|
537
537
|
end
|
538
538
|
|
539
539
|
def test_drop_finished
|
540
540
|
assert_equal("GDK_DROP_FINISHED",
|
541
|
-
Gdk::EventDND.new(:drop_finished).
|
541
|
+
Gdk::EventDND.new(:drop_finished).type.name)
|
542
542
|
end
|
543
543
|
|
544
544
|
def test_context
|
@@ -573,12 +573,12 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
573
573
|
|
574
574
|
def test_proximity_in
|
575
575
|
assert_equal("GDK_PROXIMITY_IN",
|
576
|
-
Gdk::EventProximity.new(:proximity_in).
|
576
|
+
Gdk::EventProximity.new(:proximity_in).type.name)
|
577
577
|
end
|
578
578
|
|
579
579
|
def test_proximity_out
|
580
580
|
assert_equal("GDK_PROXIMITY_OUT",
|
581
|
-
Gdk::EventProximity.new(:proximity_out).
|
581
|
+
Gdk::EventProximity.new(:proximity_out).type.name)
|
582
582
|
end
|
583
583
|
|
584
584
|
def test_time
|
@@ -596,7 +596,7 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
596
596
|
include TestAnyMethods
|
597
597
|
|
598
598
|
def setup
|
599
|
-
@window_state = Gdk::EventWindowState.new
|
599
|
+
@window_state = Gdk::EventWindowState.new(:window_state)
|
600
600
|
end
|
601
601
|
|
602
602
|
def event
|
@@ -620,7 +620,7 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
620
620
|
include TestAnyMethods
|
621
621
|
|
622
622
|
def setup
|
623
|
-
@setting = Gdk::EventSetting.new
|
623
|
+
@setting = Gdk::EventSetting.new(:setting)
|
624
624
|
end
|
625
625
|
|
626
626
|
def event
|
@@ -642,7 +642,7 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
642
642
|
|
643
643
|
class TestOwnerChange < self
|
644
644
|
def setup
|
645
|
-
@owner_change = Gdk::EventOwnerChange.new
|
645
|
+
@owner_change = Gdk::EventOwnerChange.new(:owner_change)
|
646
646
|
end
|
647
647
|
|
648
648
|
def event
|
@@ -680,7 +680,7 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
680
680
|
include TestAnyMethods
|
681
681
|
|
682
682
|
def setup
|
683
|
-
@grab_broken = Gdk::EventGrabBroken.new
|
683
|
+
@grab_broken = Gdk::EventGrabBroken.new(:grab_broken)
|
684
684
|
end
|
685
685
|
|
686
686
|
def event
|
@@ -696,9 +696,7 @@ class TestGdkEvent < Test::Unit::TestCase
|
|
696
696
|
end
|
697
697
|
|
698
698
|
def test_grab_window
|
699
|
-
|
700
|
-
@grab_broken.grab_window
|
701
|
-
end
|
699
|
+
assert_nil(@grab_broken.grab_window)
|
702
700
|
end
|
703
701
|
end
|
704
702
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Copyright (C) 2014 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
class TestGdkKeyval < Test::Unit::TestCase
|
18
|
+
def test_consntant_name
|
19
|
+
assert_equal("a".unpack("c")[0], Gdk::Keyval::KEY_a)
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 Ruby-GNOME2 Project Team
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
|
19
|
+
class TestGdkPixbuf < Test::Unit::TestCase
|
20
|
+
def test_window
|
21
|
+
gdk_window = Gdk.default_root_window
|
22
|
+
src_x = 0
|
23
|
+
src_y = 0
|
24
|
+
width = 290
|
25
|
+
height = 200
|
26
|
+
|
27
|
+
pixbuf = gdk_window.to_pixbuf(src_x,
|
28
|
+
src_y,
|
29
|
+
width,
|
30
|
+
height)
|
31
|
+
assert_equal([width, height],
|
32
|
+
[pixbuf.width, pixbuf.height])
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_surface
|
36
|
+
surface = Cairo::ImageSurface.new(:argb32, 290, 200)
|
37
|
+
src_x = 0
|
38
|
+
src_y = 0
|
39
|
+
width = 290
|
40
|
+
height = 200
|
41
|
+
|
42
|
+
pixbuf = surface.to_pixbuf(src_x,
|
43
|
+
src_y,
|
44
|
+
width,
|
45
|
+
height)
|
46
|
+
assert_equal([width, height],
|
47
|
+
[pixbuf.width, pixbuf.height])
|
48
|
+
end
|
49
|
+
end
|
data/test/test-gdk-rectangle.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
|
-
# Copyright (C) 2013 Ruby-GNOME2 Project Team
|
3
|
+
# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
|
4
4
|
#
|
5
5
|
# This library is free software; you can redistribute it and/or
|
6
6
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -17,8 +17,39 @@
|
|
17
17
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
18
|
|
19
19
|
class TestGdkRectangle < Test::Unit::TestCase
|
20
|
-
def
|
21
|
-
|
22
|
-
|
20
|
+
def test_intersect
|
21
|
+
rectangle1 = Gdk::Rectangle.new(0, 10, 20, 30)
|
22
|
+
rectangle2 = Gdk::Rectangle.new(5, 15, 10, 20)
|
23
|
+
intersected = rectangle1.intersect(rectangle2)
|
24
|
+
assert_equal([
|
25
|
+
5,
|
26
|
+
15,
|
27
|
+
10,
|
28
|
+
20,
|
29
|
+
],
|
30
|
+
[
|
31
|
+
intersected.x,
|
32
|
+
intersected.y,
|
33
|
+
intersected.width,
|
34
|
+
intersected.height,
|
35
|
+
])
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_union
|
39
|
+
rectangle1 = Gdk::Rectangle.new(0, 10, 20, 30)
|
40
|
+
rectangle2 = Gdk::Rectangle.new(5, 15, 40, 20)
|
41
|
+
unioned_rectangle = rectangle1.union(rectangle2)
|
42
|
+
assert_equal([
|
43
|
+
0,
|
44
|
+
10,
|
45
|
+
45,
|
46
|
+
30,
|
47
|
+
],
|
48
|
+
[
|
49
|
+
unioned_rectangle.x,
|
50
|
+
unioned_rectangle.y,
|
51
|
+
unioned_rectangle.width,
|
52
|
+
unioned_rectangle.height,
|
53
|
+
])
|
23
54
|
end
|
24
55
|
end
|
data/test/test-gdk-rgba.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
|
-
# Copyright (C) 2013 Ruby-GNOME2 Project Team
|
3
|
+
# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
|
4
4
|
#
|
5
5
|
# This library is free software; you can redistribute it and/or
|
6
6
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -21,4 +21,9 @@ class TestGdkRGBA < Test::Unit::TestCase
|
|
21
21
|
rgba = Gdk::RGBA.new(0.2, 0.4, 0.6, 0.5)
|
22
22
|
assert_equal("rgba(51,102,153,0.5)", rgba.to_s)
|
23
23
|
end
|
24
|
+
|
25
|
+
def test_to_a
|
26
|
+
rgba = Gdk::RGBA.new(0.2, 0.4, 0.6, 0.5)
|
27
|
+
assert_equal([0.2, 0.4, 0.6, 0.5], rgba.to_a)
|
28
|
+
end
|
24
29
|
end
|