gdk4 3.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/COPYING.LIB +502 -0
- data/README.md +58 -0
- data/Rakefile +26 -0
- data/dependency-check/Rakefile +44 -0
- data/gdk4.gemspec +47 -0
- data/lib/gdk4.rb +43 -0
- data/lib/gdk4/cairo.rb +71 -0
- data/lib/gdk4/loader.rb +80 -0
- data/lib/gdk4/rectangle.rb +56 -0
- data/lib/gdk4/rgba.rb +53 -0
- data/lib/gdk4/version.rb +27 -0
- data/lib/gdk4/x11-loader.rb +28 -0
- data/test/fixture/ruby-gnome2-logo.png +0 -0
- data/test/gdk-test-utils.rb +28 -0
- data/test/run-test.rb +42 -0
- data/test/test-gdk-cairo.rb +62 -0
- data/test/test-gdk-cursor.rb +44 -0
- data/test/test-gdk-event-mask.rb +21 -0
- data/test/test-gdk-event-type.rb +25 -0
- data/test/test-gdk-event.rb +698 -0
- data/test/test-gdk-geometry.rb +24 -0
- data/test/test-gdk-keyval.rb +80 -0
- data/test/test-gdk-pixbuf.rb +43 -0
- data/test/test-gdk-rectangle.rb +74 -0
- data/test/test-gdk-rgba.rb +94 -0
- data/test/test-gdk-selection.rb +29 -0
- data/test/test-gdk-window-attr.rb +32 -0
- metadata +113 -0
data/lib/gdk4/version.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Copyright (C) 2018 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
|
+
module Gdk
|
18
|
+
module Version
|
19
|
+
STRING = "#{MAJOR}.#{MINOR}.#{MICRO}"
|
20
|
+
class << self
|
21
|
+
def or_later?(major, minor, micro=nil)
|
22
|
+
micro ||= 0
|
23
|
+
([MAJOR, MINOR, MICRO] <=> [major, minor, micro]) >= 0
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Copyright (C) 2017-2018 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
|
+
module Gdk
|
18
|
+
class X11Loader < GObjectIntrospection::Loader
|
19
|
+
def load
|
20
|
+
self.version = "4.0"
|
21
|
+
begin
|
22
|
+
super("GdkX11")
|
23
|
+
rescue GObjectIntrospection::RepositoryError::TypelibNotFound
|
24
|
+
# Ignore. Some environments such as Windows don't have it.
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
Binary file
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Copyright (C) 2013-2021 Ruby-GNOME 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
|
+
module GdkTestUtils
|
18
|
+
private
|
19
|
+
def only_gdk_version(major, minor, micro=nil)
|
20
|
+
unless Gdk::Version.or_later?(major, minor, micro)
|
21
|
+
omit("Require GDK >= #{major}.#{minor}.#{micro}")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def fixture_path(*components)
|
26
|
+
File.join(File.dirname(__FILE__), "fixture", *components)
|
27
|
+
end
|
28
|
+
end
|
data/test/run-test.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright (C) 2013-2021 Ruby-GNOME 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_relative "../../glib2/test/run-test"
|
20
|
+
|
21
|
+
run_test(__dir__,
|
22
|
+
[
|
23
|
+
"glib2",
|
24
|
+
"gobject-introspection",
|
25
|
+
"atk",
|
26
|
+
"cairo-gobject",
|
27
|
+
"gdk_pixbuf2",
|
28
|
+
"gio2",
|
29
|
+
"gdk4",
|
30
|
+
]) do
|
31
|
+
begin
|
32
|
+
require "gdk4"
|
33
|
+
rescue GObjectIntrospection::RepositoryError
|
34
|
+
puts("Omit because typelib file doesn't exist: #{$!.message}")
|
35
|
+
exit(true)
|
36
|
+
end
|
37
|
+
|
38
|
+
Gdk.init
|
39
|
+
Gdk.init_check([$0])
|
40
|
+
|
41
|
+
require_relative "gdk-test-utils"
|
42
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Copyright (C) 2014-2018 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
|
+
require "stringio"
|
18
|
+
|
19
|
+
class TestGdkCairo < Test::Unit::TestCase
|
20
|
+
def setup
|
21
|
+
output = StringIO.new
|
22
|
+
surface = Cairo::PDFSurface.new(output, 10, 10)
|
23
|
+
@context = Cairo::Context.new(surface)
|
24
|
+
end
|
25
|
+
|
26
|
+
sub_test_case "#set_source_rgba" do
|
27
|
+
sub_test_case "RGBA" do
|
28
|
+
def test_rgba
|
29
|
+
rgba = Gdk::RGBA.new(0.1, 0.2, 0.3, 0.4)
|
30
|
+
@context.source_rgba = rgba
|
31
|
+
assert_equal(Cairo::Color::RGB.new(0.1, 0.2, 0.3, 0.4),
|
32
|
+
@context.source.color)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_values
|
36
|
+
@context.set_source_rgba(0.1, 0.2, 0.3, 0.4)
|
37
|
+
assert_equal([0.1, 0.2, 0.3, 0.4],
|
38
|
+
@context.source.rgba)
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_array
|
42
|
+
@context.set_source_rgba([0.1, 0.2, 0.3, 0.4])
|
43
|
+
assert_equal([0.1, 0.2, 0.3, 0.4],
|
44
|
+
@context.source.rgba)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
sub_test_case "RGB" do
|
49
|
+
def test_values
|
50
|
+
@context.set_source_rgb(0.1, 0.2, 0.3)
|
51
|
+
assert_equal([0.1, 0.2, 0.3, 1.0],
|
52
|
+
@context.source.rgba)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_array
|
56
|
+
@context.set_source_rgb([0.1, 0.2, 0.3])
|
57
|
+
assert_equal([0.1, 0.2, 0.3, 1.0],
|
58
|
+
@context.source.rgba)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Copyright (C) 2015 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 TestGdkCursor < Test::Unit::TestCase
|
18
|
+
include GdkTestUtils
|
19
|
+
|
20
|
+
sub_test_case ".new" do
|
21
|
+
test "type" do
|
22
|
+
cursor = Gdk::Cursor.new(:arrow)
|
23
|
+
assert_equal(Gdk::CursorType::ARROW, cursor.cursor_type)
|
24
|
+
end
|
25
|
+
|
26
|
+
test "pixbuf" do
|
27
|
+
pixbuf = GdkPixbuf::Pixbuf.new(:file => fixture_path("ruby-gnome2-logo.png"))
|
28
|
+
cursor = Gdk::Cursor.new(pixbuf, 0, 0)
|
29
|
+
assert_equal(Gdk::CursorType::CURSOR_IS_PIXMAP, cursor.cursor_type)
|
30
|
+
end
|
31
|
+
|
32
|
+
test "surface" do
|
33
|
+
only_gdk_version(3, 10, 0)
|
34
|
+
surface = Cairo::ImageSurface.new(100, 100)
|
35
|
+
cursor = Gdk::Cursor.new(surface, 0, 0)
|
36
|
+
assert_equal(Gdk::CursorType::CURSOR_IS_PIXMAP, cursor.cursor_type)
|
37
|
+
end
|
38
|
+
|
39
|
+
test "name" do
|
40
|
+
cursor = Gdk::Cursor.new("cross")
|
41
|
+
assert_equal(Gdk::CursorType::CURSOR_IS_PIXMAP, cursor.cursor_type)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Copyright (C) 2015 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 TestGdkEventMask < Test::Unit::TestCase
|
18
|
+
def test_button_press_mask
|
19
|
+
assert_equal("button-press-mask", Gdk::EventMask::BUTTON_PRESS_MASK.nick)
|
20
|
+
end
|
21
|
+
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
|
@@ -0,0 +1,698 @@
|
|
1
|
+
# Copyright (C) 2013-2017 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 TestGdkEvent < Test::Unit::TestCase
|
18
|
+
class TestConstant < self
|
19
|
+
def test_propagate
|
20
|
+
assert_false(Gdk::Event::PROPAGATE)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_stop
|
24
|
+
assert_true(Gdk::Event::STOP)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
module TestAnyMethods
|
29
|
+
def test_window
|
30
|
+
assert_nil(event.window)
|
31
|
+
attributes = Gdk::WindowAttr.new(100, 100, :input_only, :temp)
|
32
|
+
window = Gdk::Window.new(nil, attributes, 0)
|
33
|
+
event.window = window
|
34
|
+
assert_equal(window, event.window)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_send_event?
|
38
|
+
assert_false(event.send_event?)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class TestAny < self
|
43
|
+
include TestAnyMethods
|
44
|
+
|
45
|
+
def setup
|
46
|
+
@event = Gdk::EventAny.new(:delete)
|
47
|
+
end
|
48
|
+
|
49
|
+
def event
|
50
|
+
@event
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_delete
|
54
|
+
assert_equal("GDK_DELETE",
|
55
|
+
Gdk::EventAny.new(:delete).type.name)
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_destroy
|
59
|
+
assert_equal("GDK_DESTROY",
|
60
|
+
Gdk::EventAny.new(:destroy).type.name)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class TestKey < self
|
65
|
+
include TestAnyMethods
|
66
|
+
|
67
|
+
def setup
|
68
|
+
@key = Gdk::EventKey.new(:key_press)
|
69
|
+
end
|
70
|
+
|
71
|
+
def event
|
72
|
+
@key
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_key_press
|
76
|
+
assert_equal("GDK_KEY_PRESS",
|
77
|
+
Gdk::EventKey.new(:key_press).type.name)
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_key_release
|
81
|
+
assert_equal("GDK_KEY_RELEASE",
|
82
|
+
Gdk::EventKey.new(:key_release).type.name)
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_time
|
86
|
+
assert_kind_of(Integer, @key.time)
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_state
|
90
|
+
assert_not_nil(@key.state)
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_keyval
|
94
|
+
assert_kind_of(Integer, @key.keyval)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
class TestButton < self
|
99
|
+
include TestAnyMethods
|
100
|
+
|
101
|
+
def setup
|
102
|
+
@button = Gdk::EventButton.new(:button_press)
|
103
|
+
end
|
104
|
+
|
105
|
+
def event
|
106
|
+
@button
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_button_press
|
110
|
+
assert_equal("GDK_BUTTON_PRESS",
|
111
|
+
Gdk::EventButton.new(:button_press).type.name)
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_button2_press
|
115
|
+
assert_equal("GDK_2BUTTON_PRESS",
|
116
|
+
Gdk::EventButton.new(:button2_press).type.name)
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_button3_press
|
120
|
+
assert_equal("GDK_3BUTTON_PRESS",
|
121
|
+
Gdk::EventButton.new(:button3_press).type.name)
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_button_release
|
125
|
+
assert_equal("GDK_BUTTON_RELEASE",
|
126
|
+
Gdk::EventButton.new(:button_release).type.name)
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_time
|
130
|
+
assert_kind_of(Integer, @button.time)
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_x
|
134
|
+
assert_kind_of(Float, @button.x)
|
135
|
+
end
|
136
|
+
|
137
|
+
def test_y
|
138
|
+
assert_kind_of(Float, @button.y)
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_state
|
142
|
+
assert_not_nil(@button.state)
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_button
|
146
|
+
assert_kind_of(Integer, @button.button)
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_x_root
|
150
|
+
assert_kind_of(Float, @button.x_root)
|
151
|
+
end
|
152
|
+
|
153
|
+
def test_y_root
|
154
|
+
assert_kind_of(Float, @button.y_root)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
class TestTouch < self
|
159
|
+
include TestAnyMethods
|
160
|
+
|
161
|
+
def setup
|
162
|
+
@touch = Gdk::EventTouch.new(:touch_begin)
|
163
|
+
end
|
164
|
+
|
165
|
+
def event
|
166
|
+
@touch
|
167
|
+
end
|
168
|
+
|
169
|
+
def test_time
|
170
|
+
assert_kind_of(Integer, @touch.time)
|
171
|
+
end
|
172
|
+
|
173
|
+
def test_x
|
174
|
+
assert_kind_of(Float, @touch.x)
|
175
|
+
end
|
176
|
+
|
177
|
+
def test_y
|
178
|
+
assert_kind_of(Float, @touch.y)
|
179
|
+
end
|
180
|
+
|
181
|
+
def test_axis
|
182
|
+
assert_kind_of(Numeric, @touch.get_axis(:x))
|
183
|
+
end
|
184
|
+
|
185
|
+
def test_state
|
186
|
+
assert_not_nil(@touch.state)
|
187
|
+
end
|
188
|
+
|
189
|
+
def test_touch_begin
|
190
|
+
assert_equal("GDK_TOUCH_BEGIN",
|
191
|
+
Gdk::EventTouch.new(:touch_begin).type.name)
|
192
|
+
end
|
193
|
+
|
194
|
+
def test_touch_update
|
195
|
+
assert_equal("GDK_TOUCH_UPDATE",
|
196
|
+
Gdk::EventTouch.new(:touch_update).type.name)
|
197
|
+
end
|
198
|
+
|
199
|
+
def test_touch_cancel
|
200
|
+
assert_equal("GDK_TOUCH_CANCEL",
|
201
|
+
Gdk::EventTouch.new(:touch_cancel).type.name)
|
202
|
+
end
|
203
|
+
|
204
|
+
def test_touch_end
|
205
|
+
assert_equal("GDK_TOUCH_END",
|
206
|
+
Gdk::EventTouch.new(:touch_end).type.name)
|
207
|
+
end
|
208
|
+
|
209
|
+
def test_emulating_pointer
|
210
|
+
assert_boolean(@touch.emulating_pointer?)
|
211
|
+
end
|
212
|
+
|
213
|
+
def test_device
|
214
|
+
assert_nothing_raised do
|
215
|
+
@touch.device
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
def test_x_root
|
220
|
+
assert_kind_of(Float, @touch.x_root)
|
221
|
+
end
|
222
|
+
|
223
|
+
def test_y_root
|
224
|
+
assert_kind_of(Float, @touch.y_root)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
class TestScroll < self
|
229
|
+
include TestAnyMethods
|
230
|
+
|
231
|
+
def setup
|
232
|
+
@scroll = Gdk::EventScroll.new(:scroll)
|
233
|
+
end
|
234
|
+
|
235
|
+
def event
|
236
|
+
@scroll
|
237
|
+
end
|
238
|
+
|
239
|
+
def test_time
|
240
|
+
assert_kind_of(Integer, @scroll.time)
|
241
|
+
end
|
242
|
+
|
243
|
+
def test_x
|
244
|
+
assert_kind_of(Float, @scroll.x)
|
245
|
+
end
|
246
|
+
|
247
|
+
def test_y
|
248
|
+
assert_kind_of(Float, @scroll.y)
|
249
|
+
end
|
250
|
+
|
251
|
+
def test_state
|
252
|
+
assert_not_nil(@scroll.state)
|
253
|
+
end
|
254
|
+
|
255
|
+
def test_direction
|
256
|
+
assert_kind_of(Gdk::ScrollDirection, @scroll.direction)
|
257
|
+
end
|
258
|
+
|
259
|
+
def test_x_root
|
260
|
+
assert_kind_of(Float, @scroll.x_root)
|
261
|
+
end
|
262
|
+
|
263
|
+
def test_y_root
|
264
|
+
assert_kind_of(Float, @scroll.y_root)
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
class TestMotion < self
|
269
|
+
include TestAnyMethods
|
270
|
+
|
271
|
+
def setup
|
272
|
+
@motion = Gdk::EventMotion.new(:motion_notify)
|
273
|
+
end
|
274
|
+
|
275
|
+
def event
|
276
|
+
@motion
|
277
|
+
end
|
278
|
+
|
279
|
+
def test_time
|
280
|
+
assert_kind_of(Integer, @motion.time)
|
281
|
+
end
|
282
|
+
|
283
|
+
def test_x
|
284
|
+
assert_kind_of(Float, @motion.x)
|
285
|
+
end
|
286
|
+
|
287
|
+
def test_y
|
288
|
+
assert_kind_of(Float, @motion.y)
|
289
|
+
end
|
290
|
+
|
291
|
+
def test_state
|
292
|
+
assert_not_nil(@motion.state)
|
293
|
+
end
|
294
|
+
|
295
|
+
def test_x_root
|
296
|
+
assert_kind_of(Float, @motion.x_root)
|
297
|
+
end
|
298
|
+
|
299
|
+
def test_y_root
|
300
|
+
assert_kind_of(Float, @motion.y_root)
|
301
|
+
end
|
302
|
+
|
303
|
+
def test_request
|
304
|
+
assert_nothing_raised do
|
305
|
+
@motion.request
|
306
|
+
end
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
class TestVisibility < self
|
311
|
+
include TestAnyMethods
|
312
|
+
|
313
|
+
def setup
|
314
|
+
@visibility = Gdk::EventVisibility.new(:visibility_notify)
|
315
|
+
end
|
316
|
+
|
317
|
+
def event
|
318
|
+
@visibility
|
319
|
+
end
|
320
|
+
|
321
|
+
def test_state
|
322
|
+
assert_kind_of(Gdk::VisibilityState, @visibility.state)
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
class TestCrossing < self
|
327
|
+
include TestAnyMethods
|
328
|
+
|
329
|
+
def setup
|
330
|
+
@crossing = Gdk::EventCrossing.new(:enter_notify)
|
331
|
+
end
|
332
|
+
|
333
|
+
def event
|
334
|
+
@crossing
|
335
|
+
end
|
336
|
+
|
337
|
+
def test_enter_notify
|
338
|
+
assert_equal("GDK_ENTER_NOTIFY",
|
339
|
+
Gdk::EventCrossing.new(:enter_notify).type.name)
|
340
|
+
end
|
341
|
+
|
342
|
+
def test_leave_notify
|
343
|
+
assert_equal("GDK_LEAVE_NOTIFY",
|
344
|
+
Gdk::EventCrossing.new(:leave_notify).type.name)
|
345
|
+
end
|
346
|
+
|
347
|
+
def test_time
|
348
|
+
assert_kind_of(Integer, @crossing.time)
|
349
|
+
end
|
350
|
+
|
351
|
+
def test_x
|
352
|
+
assert_kind_of(Float, @crossing.x)
|
353
|
+
end
|
354
|
+
|
355
|
+
def test_y
|
356
|
+
assert_kind_of(Float, @crossing.y)
|
357
|
+
end
|
358
|
+
|
359
|
+
def test_x_root
|
360
|
+
assert_kind_of(Float, @crossing.x_root)
|
361
|
+
end
|
362
|
+
|
363
|
+
def test_y_root
|
364
|
+
assert_kind_of(Float, @crossing.y_root)
|
365
|
+
end
|
366
|
+
|
367
|
+
def test_mode
|
368
|
+
assert_kind_of(Gdk::CrossingMode, @crossing.mode)
|
369
|
+
end
|
370
|
+
|
371
|
+
def test_detail
|
372
|
+
assert_not_nil(@crossing.detail)
|
373
|
+
end
|
374
|
+
|
375
|
+
def test_state
|
376
|
+
assert_not_nil(@crossing.state)
|
377
|
+
end
|
378
|
+
end
|
379
|
+
|
380
|
+
class TestFocus < self
|
381
|
+
include TestAnyMethods
|
382
|
+
|
383
|
+
def setup
|
384
|
+
@focus = Gdk::EventFocus.new(:focus_change)
|
385
|
+
end
|
386
|
+
|
387
|
+
def event
|
388
|
+
@focus
|
389
|
+
end
|
390
|
+
|
391
|
+
def test_in
|
392
|
+
assert_false(@focus.in?)
|
393
|
+
end
|
394
|
+
end
|
395
|
+
|
396
|
+
class TestConfigure < self
|
397
|
+
include TestAnyMethods
|
398
|
+
|
399
|
+
def setup
|
400
|
+
@configure = Gdk::EventConfigure.new(:configure)
|
401
|
+
end
|
402
|
+
|
403
|
+
def event
|
404
|
+
@configure
|
405
|
+
end
|
406
|
+
|
407
|
+
def test_x
|
408
|
+
assert_kind_of(Numeric, @configure.x)
|
409
|
+
end
|
410
|
+
|
411
|
+
def test_y
|
412
|
+
assert_kind_of(Numeric, @configure.y)
|
413
|
+
end
|
414
|
+
|
415
|
+
def test_width
|
416
|
+
assert_kind_of(Integer, @configure.width)
|
417
|
+
end
|
418
|
+
|
419
|
+
def test_height
|
420
|
+
assert_kind_of(Integer, @configure.height)
|
421
|
+
end
|
422
|
+
end
|
423
|
+
|
424
|
+
class TestProperty < self
|
425
|
+
include TestAnyMethods
|
426
|
+
|
427
|
+
def setup
|
428
|
+
@property = Gdk::EventProperty.new(:property_notify)
|
429
|
+
end
|
430
|
+
|
431
|
+
def event
|
432
|
+
@property
|
433
|
+
end
|
434
|
+
|
435
|
+
def test_atom
|
436
|
+
assert_nothing_raised do
|
437
|
+
@property.atom
|
438
|
+
end
|
439
|
+
end
|
440
|
+
|
441
|
+
def test_time
|
442
|
+
assert_kind_of(Integer, @property.time)
|
443
|
+
end
|
444
|
+
|
445
|
+
def test_state
|
446
|
+
assert_equal(Gdk::PropertyState::NEW_VALUE, @property.state)
|
447
|
+
end
|
448
|
+
end
|
449
|
+
|
450
|
+
class TestSelection < self
|
451
|
+
include TestAnyMethods
|
452
|
+
|
453
|
+
def setup
|
454
|
+
@selection = Gdk::EventSelection.new(:selection_clear)
|
455
|
+
end
|
456
|
+
|
457
|
+
def event
|
458
|
+
@selection
|
459
|
+
end
|
460
|
+
|
461
|
+
def test_selection_clear
|
462
|
+
assert_equal("GDK_SELECTION_CLEAR",
|
463
|
+
Gdk::EventSelection.new(:selection_clear).type.name)
|
464
|
+
end
|
465
|
+
|
466
|
+
def test_selection_notify
|
467
|
+
assert_equal("GDK_SELECTION_NOTIFY",
|
468
|
+
Gdk::EventSelection.new(:selection_notify).type.name)
|
469
|
+
end
|
470
|
+
|
471
|
+
def test_selection_request
|
472
|
+
assert_equal("GDK_SELECTION_REQUEST",
|
473
|
+
Gdk::EventSelection.new(:selection_request).type.name)
|
474
|
+
end
|
475
|
+
|
476
|
+
def test_selection
|
477
|
+
assert_nothing_raised do
|
478
|
+
@selection.selection
|
479
|
+
end
|
480
|
+
end
|
481
|
+
|
482
|
+
def test_target
|
483
|
+
assert_nothing_raised do
|
484
|
+
@selection.target
|
485
|
+
end
|
486
|
+
end
|
487
|
+
|
488
|
+
def test_property
|
489
|
+
assert_nothing_raised do
|
490
|
+
@selection.property
|
491
|
+
end
|
492
|
+
end
|
493
|
+
|
494
|
+
def test_time
|
495
|
+
assert_kind_of(Integer, @selection.time)
|
496
|
+
end
|
497
|
+
end
|
498
|
+
|
499
|
+
class TestDND < self
|
500
|
+
include TestAnyMethods
|
501
|
+
|
502
|
+
def setup
|
503
|
+
@dnd = Gdk::EventDND.new(:drag_enter)
|
504
|
+
end
|
505
|
+
|
506
|
+
def event
|
507
|
+
@dnd
|
508
|
+
end
|
509
|
+
|
510
|
+
def test_drag_enter
|
511
|
+
assert_equal("GDK_DRAG_ENTER",
|
512
|
+
Gdk::EventDND.new(:drag_enter).type.name)
|
513
|
+
end
|
514
|
+
|
515
|
+
def test_drag_leave
|
516
|
+
assert_equal("GDK_DRAG_LEAVE",
|
517
|
+
Gdk::EventDND.new(:drag_leave).type.name)
|
518
|
+
end
|
519
|
+
|
520
|
+
def test_drag_motion
|
521
|
+
assert_equal("GDK_DRAG_MOTION",
|
522
|
+
Gdk::EventDND.new(:drag_motion).type.name)
|
523
|
+
end
|
524
|
+
|
525
|
+
def test_drag_status
|
526
|
+
assert_equal("GDK_DRAG_STATUS",
|
527
|
+
Gdk::EventDND.new(:drag_status).type.name)
|
528
|
+
end
|
529
|
+
|
530
|
+
def test_drop_start
|
531
|
+
assert_equal("GDK_DROP_START",
|
532
|
+
Gdk::EventDND.new(:drop_start).type.name)
|
533
|
+
end
|
534
|
+
|
535
|
+
def test_drop_finished
|
536
|
+
assert_equal("GDK_DROP_FINISHED",
|
537
|
+
Gdk::EventDND.new(:drop_finished).type.name)
|
538
|
+
end
|
539
|
+
|
540
|
+
def test_context
|
541
|
+
assert_nothing_raised do
|
542
|
+
@dnd.context
|
543
|
+
end
|
544
|
+
end
|
545
|
+
|
546
|
+
def test_time
|
547
|
+
assert_kind_of(Integer, @dnd.time)
|
548
|
+
end
|
549
|
+
|
550
|
+
def test_x_root
|
551
|
+
assert_kind_of(Numeric, @dnd.x_root)
|
552
|
+
end
|
553
|
+
|
554
|
+
def test_y_root
|
555
|
+
assert_kind_of(Numeric, @dnd.y_root)
|
556
|
+
end
|
557
|
+
end
|
558
|
+
|
559
|
+
class TestProximity < self
|
560
|
+
include TestAnyMethods
|
561
|
+
|
562
|
+
def setup
|
563
|
+
@proximity = Gdk::EventProximity.new(:proximity_in)
|
564
|
+
end
|
565
|
+
|
566
|
+
def event
|
567
|
+
@proximity
|
568
|
+
end
|
569
|
+
|
570
|
+
def test_proximity_in
|
571
|
+
assert_equal("GDK_PROXIMITY_IN",
|
572
|
+
Gdk::EventProximity.new(:proximity_in).type.name)
|
573
|
+
end
|
574
|
+
|
575
|
+
def test_proximity_out
|
576
|
+
assert_equal("GDK_PROXIMITY_OUT",
|
577
|
+
Gdk::EventProximity.new(:proximity_out).type.name)
|
578
|
+
end
|
579
|
+
|
580
|
+
def test_time
|
581
|
+
assert_kind_of(Integer, @proximity.time)
|
582
|
+
end
|
583
|
+
|
584
|
+
def test_device
|
585
|
+
assert_nothing_raised do
|
586
|
+
@proximity.device
|
587
|
+
end
|
588
|
+
end
|
589
|
+
end
|
590
|
+
|
591
|
+
class TestWindowState < self
|
592
|
+
include TestAnyMethods
|
593
|
+
|
594
|
+
def setup
|
595
|
+
@window_state = Gdk::EventWindowState.new(:window_state)
|
596
|
+
end
|
597
|
+
|
598
|
+
def event
|
599
|
+
@window_state
|
600
|
+
end
|
601
|
+
|
602
|
+
def test_changed_mask
|
603
|
+
assert_nothing_raised do
|
604
|
+
@window_state.changed_mask
|
605
|
+
end
|
606
|
+
end
|
607
|
+
|
608
|
+
def test_new_window_state
|
609
|
+
assert_nothing_raised do
|
610
|
+
@window_state.new_window_state
|
611
|
+
end
|
612
|
+
end
|
613
|
+
end
|
614
|
+
|
615
|
+
class TestSetting < self
|
616
|
+
include TestAnyMethods
|
617
|
+
|
618
|
+
def setup
|
619
|
+
@setting = Gdk::EventSetting.new(:setting)
|
620
|
+
end
|
621
|
+
|
622
|
+
def event
|
623
|
+
@setting
|
624
|
+
end
|
625
|
+
|
626
|
+
def test_action
|
627
|
+
assert_nothing_raised do
|
628
|
+
@setting.action
|
629
|
+
end
|
630
|
+
end
|
631
|
+
|
632
|
+
def test_name
|
633
|
+
assert_nothing_raised do
|
634
|
+
@setting.name
|
635
|
+
end
|
636
|
+
end
|
637
|
+
end
|
638
|
+
|
639
|
+
class TestOwnerChange < self
|
640
|
+
def setup
|
641
|
+
@owner_change = Gdk::EventOwnerChange.new(:owner_change)
|
642
|
+
end
|
643
|
+
|
644
|
+
def event
|
645
|
+
@owner_change
|
646
|
+
end
|
647
|
+
|
648
|
+
def test_owner
|
649
|
+
assert_nothing_raised do
|
650
|
+
@owner_change.owner
|
651
|
+
end
|
652
|
+
end
|
653
|
+
|
654
|
+
def test_reason
|
655
|
+
assert_nothing_raised do
|
656
|
+
@owner_change.reason
|
657
|
+
end
|
658
|
+
end
|
659
|
+
|
660
|
+
def test_selection
|
661
|
+
assert_nothing_raised do
|
662
|
+
@owner_change.selection
|
663
|
+
end
|
664
|
+
end
|
665
|
+
|
666
|
+
def test_time
|
667
|
+
assert_kind_of(Integer, @owner_change.time)
|
668
|
+
end
|
669
|
+
|
670
|
+
def test_selection_time
|
671
|
+
assert_kind_of(Integer, @owner_change.selection_time)
|
672
|
+
end
|
673
|
+
end
|
674
|
+
|
675
|
+
class TestGrabBroken < self
|
676
|
+
include TestAnyMethods
|
677
|
+
|
678
|
+
def setup
|
679
|
+
@grab_broken = Gdk::EventGrabBroken.new(:grab_broken)
|
680
|
+
end
|
681
|
+
|
682
|
+
def event
|
683
|
+
@grab_broken
|
684
|
+
end
|
685
|
+
|
686
|
+
def test_keyboard
|
687
|
+
assert_boolean(@grab_broken.keyboard?)
|
688
|
+
end
|
689
|
+
|
690
|
+
def test_implicit
|
691
|
+
assert_boolean(@grab_broken.implicit?)
|
692
|
+
end
|
693
|
+
|
694
|
+
def test_grab_window
|
695
|
+
assert_nil(@grab_broken.grab_window)
|
696
|
+
end
|
697
|
+
end
|
698
|
+
end
|