gtk4 3.5.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/gtk4.gemspec +1 -5
  3. data/lib/gtk4/{menu-item.rb → application.rb} +11 -10
  4. data/lib/gtk4/box.rb +1 -1
  5. data/lib/gtk4/builder.rb +14 -61
  6. data/lib/gtk4/button.rb +1 -2
  7. data/lib/gtk4/combo-box.rb +1 -6
  8. data/lib/gtk4/deprecated.rb +234 -246
  9. data/lib/gtk4/dialog.rb +10 -21
  10. data/lib/gtk4/{action.rb → entry.rb} +11 -8
  11. data/lib/gtk4/{gdk-drag-context.rb → gdk-display.rb} +12 -10
  12. data/lib/gtk4/icon-theme.rb +9 -12
  13. data/lib/gtk4/image.rb +12 -56
  14. data/lib/gtk4/list-store.rb +8 -0
  15. data/lib/gtk4/loader.rb +153 -27
  16. data/lib/gtk4/message-dialog.rb +1 -1
  17. data/lib/gtk4/paned.rb +17 -11
  18. data/lib/gtk4/{clipboard.rb → response-type.rb} +11 -6
  19. data/lib/gtk4/ruby-builder-scope.rb +47 -0
  20. data/lib/gtk4/scale-button.rb +6 -13
  21. data/lib/gtk4/stack.rb +23 -27
  22. data/lib/gtk4/style-context.rb +20 -4
  23. data/lib/gtk4/text-buffer.rb +14 -10
  24. data/lib/gtk4/{style-properties.rb → tree-model-sort.rb} +7 -9
  25. data/lib/gtk4/tree-model.rb +21 -1
  26. data/lib/gtk4/{target-list.rb → tree-sortable.rb} +8 -11
  27. data/lib/gtk4/tree-view-column.rb +9 -1
  28. data/lib/gtk4/version.rb +2 -2
  29. data/lib/gtk4/widget.rb +44 -71
  30. data/lib/gtk4.rb +4 -35
  31. data/sample/demos/README.md +4 -0
  32. data/sample/examples/README.md +4 -0
  33. data/sample/{action-namespace.rb → examples/action-namespace.rb} +0 -0
  34. data/sample/{builder.rb → examples/builder.rb} +0 -0
  35. data/sample/{builder.ui → examples/builder.ui} +0 -0
  36. data/sample/{drawing.rb → examples/drawing.rb} +0 -0
  37. data/sample/{grid_packing.rb → examples/grid_packing.rb} +0 -0
  38. data/sample/{hello_world.rb → examples/hello_world.rb} +0 -0
  39. data/sample/{utils.rb → examples/utils.rb} +0 -0
  40. data/sample/getting-started/README.md +4 -0
  41. metadata +26 -92
  42. data/lib/gtk4/action-group.rb +0 -131
  43. data/lib/gtk4/calendar.rb +0 -30
  44. data/lib/gtk4/check-menu-item.rb +0 -34
  45. data/lib/gtk4/container.rb +0 -62
  46. data/lib/gtk4/icon-size.rb +0 -32
  47. data/lib/gtk4/image-menu-item.rb +0 -37
  48. data/lib/gtk4/radio-action.rb +0 -28
  49. data/lib/gtk4/radio-button.rb +0 -49
  50. data/lib/gtk4/recent-chooser-dialog.rb +0 -38
  51. data/lib/gtk4/selection-data.rb +0 -42
  52. data/lib/gtk4/stock-item.rb +0 -36
  53. data/lib/gtk4/stock.rb +0 -70
  54. data/lib/gtk4/table.rb +0 -43
  55. data/lib/gtk4/target-entry.rb +0 -27
  56. data/lib/gtk4/toggle-action.rb +0 -27
  57. data/lib/gtk4/tool-button.rb +0 -36
  58. data/lib/gtk4/ui-manager.rb +0 -35
  59. data/lib/gtk4/window.rb +0 -42
  60. data/test/fixture/gnome-logo-icon.png +0 -0
  61. data/test/gtk-test-utils.rb +0 -36
  62. data/test/run-test.rb +0 -42
  63. data/test/test-gtk-box.rb +0 -36
  64. data/test/test-gtk-button.rb +0 -46
  65. data/test/test-gtk-dialog.rb +0 -74
  66. data/test/test-gtk-menu-item.rb +0 -42
  67. data/test/test-gtk-message-dialog.rb +0 -62
  68. data/test/test-gtk-version.rb +0 -47
  69. data/test/test-gtk-window.rb +0 -34
@@ -1,42 +0,0 @@
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
- module Gtk
18
- class SelectionData
19
- alias_method :set_raw, :set
20
- def set(type, data, options={})
21
- format ||= options[:format]
22
- if format.nil?
23
- case type
24
- when Gdk::Selection::TYPE_INTEGER
25
- format = 32
26
- when Gdk::Selection::TYPE_STRING
27
- format = 8
28
- else
29
- message = "specify :format as the number of bits of each data"
30
- raise ArgumentError, message
31
- end
32
- end
33
- set_raw(type, format, data)
34
- end
35
-
36
- alias_method :set_text_raw, :set_text
37
- def set_text(text)
38
- set_text_raw(text, text.bytesize)
39
- end
40
- alias_method :text=, :set_text
41
- end
42
- end
@@ -1,36 +0,0 @@
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
- module Gtk
18
- class StockItem
19
- def [](*args)
20
- warn("#{self.class}\##{__method__} is deprecated. " +
21
- "Use \#stock_id, \#label, \#modifier, \#keyval and " +
22
- "\#translation_domain instead.")
23
- to_a[*args]
24
- end
25
-
26
- def to_a
27
- [
28
- stock_id,
29
- label,
30
- modifier,
31
- keyval,
32
- translation_domain,
33
- ]
34
- end
35
- end
36
- end
data/lib/gtk4/stock.rb DELETED
@@ -1,70 +0,0 @@
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
- module Gtk
18
- module Stock
19
- class << self
20
- alias_method :add_raw, :add
21
- def add(stock_id, label, *rest)
22
- case rest.size
23
- when 0
24
- options = {}
25
- when 1
26
- if rest[0].is_a?(Hash)
27
- options = rest[0]
28
- else
29
- options = {:modifier => rest[0]}
30
- end
31
- else
32
- options = {
33
- :modifier => rest[0],
34
- :key_value => rest[1],
35
- :translation_domain => rest[2],
36
- }
37
- end
38
-
39
- item = StockItem.new
40
-
41
- stock_id = stock_id.to_s if stock_id.is_a?(Symbol)
42
- item.stock_id = stock_id
43
-
44
- item.label = label
45
-
46
- modifier = options[:modifier]
47
- item.modifier = modifier if modifier
48
-
49
- key_value = options[:key_value]
50
- item.keyval = key_value if key_value
51
-
52
- translation_domain = options[:translation_domain]
53
- item.translation_domain = translation_domain if translation_domain
54
-
55
- add_raw([item])
56
- end
57
-
58
- alias_method :lookup_raw, :lookup
59
- def lookup(stock_id)
60
- stock_id = stock_id.to_s if stock_id.is_a?(Symbol)
61
- found, item = lookup_raw(stock_id)
62
- if found
63
- item
64
- else
65
- nil
66
- end
67
- end
68
- end
69
- end
70
- end
data/lib/gtk4/table.rb DELETED
@@ -1,43 +0,0 @@
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
- module Gtk
18
- class Table
19
- alias_method :initialize_raw, :initialize
20
- def initialize(n_rows, n_columns, homogeneous=false)
21
- initialize_raw(n_rows, n_columns, homogeneous)
22
- end
23
-
24
- alias_method :default_column_spacing, :default_col_spacing
25
-
26
- def column_spacings(column)
27
- get_col_spacings(column)
28
- end
29
- alias_method :set_column_spacings, :set_col_spacings
30
- alias_method :column_spacings=, :col_spacings=
31
-
32
- alias_method :attach_raw, :attach
33
- def attach(child, left, right, top, bottom,
34
- x_options=nil, y_options=nil,
35
- x_space=nil, y_space=nil)
36
- attach_raw(child, left, right, top, bottom,
37
- x_options || [:expand, :fill],
38
- y_options || [:expand, :fill],
39
- x_space || 0,
40
- y_space || 0)
41
- end
42
- end
43
- end
@@ -1,27 +0,0 @@
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
- module Gtk
18
- class TargetEntry
19
- alias_method :initialize_raw, :initialize
20
- def initialize(target, flags, info)
21
- unless flags.is_a?(TargetFlags)
22
- flags = TargetFlags.new(flags)
23
- end
24
- initialize_raw(target, flags.to_i, info)
25
- end
26
- end
27
- end
@@ -1,27 +0,0 @@
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
- module Gtk
18
- class ToggleAction
19
- alias_method :initialize_raw, :initialize
20
- def initialize(name, options={})
21
- initialize_raw(name,
22
- options[:label],
23
- options[:tooltip],
24
- options[:stock_id])
25
- end
26
- end
27
- end
@@ -1,36 +0,0 @@
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
- module Gtk
18
- class ToolButton
19
- alias_method :initialize_raw, :initialize
20
- def initialize(options={})
21
- icon_widget = options[:icon_widget]
22
- label = options[:label]
23
- stock_id = options[:stock_id]
24
-
25
- if icon_widget
26
- initialize_new(icon_widget)
27
- elsif stock_id
28
- initialize_new_from_stock(stock_id)
29
- else
30
- initialize_new
31
- end
32
-
33
- set_label(label) if label
34
- end
35
- end
36
- end
@@ -1,35 +0,0 @@
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
- module Gtk
18
- class UIManager
19
- alias_method :add_ui_raw, :add_ui
20
- def add_ui(buffer_or_filename, *args)
21
- if args.empty?
22
- if buffer_or_filename =~ /<ui>/
23
- add_ui_from_string(buffer_or_filename,
24
- buffer_or_filename.length)
25
- else
26
- add_ui_from_file(buffer_or_filename)
27
- end
28
- else
29
- merge_id = buffer_or_filename
30
- path, name, action, type, top, = args
31
- add_ui_raw(merge_id, path, name, action, type, top)
32
- end
33
- end
34
- end
35
- end
data/lib/gtk4/window.rb DELETED
@@ -1,42 +0,0 @@
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
- module Gtk
18
- class Window
19
- alias_method :initialize_raw, :initialize
20
- def initialize(type=:toplevel)
21
- if type.is_a?(String)
22
- initialize_raw(:toplevel)
23
- self.title = type
24
- else
25
- initialize_raw(type)
26
- end
27
- end
28
-
29
- alias_method :set_icon_raw, :set_icon
30
- def set_icon(icon_or_file_name)
31
- case icon_or_file_name
32
- when String
33
- set_icon_from_file(icon_or_file_name)
34
- else
35
- set_icon_raw(icon_or_file_name)
36
- end
37
- end
38
-
39
- remove_method :icon=
40
- alias_method :icon=, :set_icon
41
- end
42
- end
Binary file
@@ -1,36 +0,0 @@
1
- # Copyright (C) 2011-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
- require "tempfile"
18
- require "fileutils"
19
-
20
- module GtkTestUtils
21
- private
22
- def only_gtk_version(major, minor, micro=nil)
23
- micro ||= 0
24
- unless Gtk::Version.or_later?(major, minor, micro)
25
- omit("Require GTK+ >= #{major}.#{minor}.#{micro}")
26
- end
27
- end
28
-
29
- def window_system_type_name
30
- Gdk::Screen.default.class.gtype.name
31
- end
32
-
33
- def fixture_path(*components)
34
- File.join(File.dirname(__FILE__), "fixture", *components)
35
- end
36
- end
data/test/run-test.rb DELETED
@@ -1,42 +0,0 @@
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
- "gtk4",
31
- ]) do
32
- begin
33
- require "gtk4"
34
- rescue GObjectIntrospection::RepositoryError
35
- puts("Omit because typelib file doesn't exist: #{$!.message}")
36
- exit(true)
37
- end
38
-
39
- Gtk.init
40
-
41
- require_relative "gtk-test-utils"
42
- end
data/test/test-gtk-box.rb DELETED
@@ -1,36 +0,0 @@
1
- # Copyright (C) 2015-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
- class TestGtkBox < Test::Unit::TestCase
18
- include GtkTestUtils
19
-
20
- sub_test_case ".new" do
21
- sub_test_case "spacing" do
22
- def test_nil
23
- box = Gtk::Box.new(:vertical, nil)
24
- assert_equal(0, box.spacing)
25
- end
26
- end
27
- end
28
-
29
- test "set_child_packing" do
30
- box = Gtk::Box.new(:vertical)
31
- child = Gtk::Label.new("test")
32
- box.add(child)
33
- box.set_child_packing(child, :end)
34
- assert_equal(Gtk::PackType::END, box.query_child_packing(child))
35
- end
36
- end
@@ -1,46 +0,0 @@
1
- # Copyright (C) 2015-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
- class TestGtkButton < Test::Unit::TestCase
18
- include GtkTestUtils
19
-
20
- sub_test_case(".new") do
21
- test "no argument" do
22
- button = Gtk::Button.new
23
- assert_nil(button.label)
24
- end
25
-
26
- test ":label" do
27
- label = "Button"
28
- button = Gtk::Button.new(:label => label)
29
- assert_equal(label, button.label)
30
- end
31
-
32
- test ":label and :use_underline" do
33
- label = "Button"
34
- button = Gtk::Button.new(:label => label,
35
- :use_underline => true)
36
- assert_equal([label, true],
37
- [button.label, button.use_underline?])
38
- end
39
-
40
- test ":icon_name" do
41
- icon_name = "document-open"
42
- button = Gtk::Button.new(:icon_name => icon_name)
43
- assert_not_nil(button.image)
44
- end
45
- end
46
- end
@@ -1,74 +0,0 @@
1
- # Copyright (C) 2015-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
- class TestGtkDialog < Test::Unit::TestCase
18
- include GtkTestUtils
19
-
20
- sub_test_case ".new" do
21
- test "no argument" do
22
- dialog = Gtk::Dialog.new
23
- assert_nil(dialog.title)
24
- end
25
-
26
- test "title" do
27
- dialog = Gtk::Dialog.new(:title => "title")
28
- assert_equal("title", dialog.title)
29
- end
30
-
31
- test "parent" do
32
- parent = Gtk::Window.new
33
- dialog = Gtk::Dialog.new(:parent => parent)
34
- assert_equal(parent, dialog.transient_for)
35
- end
36
-
37
- test "flags - modal" do
38
- dialog = Gtk::Dialog.new(:flags => Gtk::DialogFlags::MODAL)
39
- assert do
40
- dialog.modal?
41
- end
42
- end
43
-
44
- test "flags - destroy_with_parent" do
45
- dialog = Gtk::Dialog.new(:flags => Gtk::DialogFlags::DESTROY_WITH_PARENT)
46
- assert do
47
- dialog.destroy_with_parent?
48
- end
49
- end
50
-
51
- test "buttons" do
52
- response_id = 1
53
- buttons = [
54
- ["title", response_id],
55
- ]
56
- dialog = Gtk::Dialog.new(:buttons => buttons)
57
- button = dialog.get_widget_for_response(response_id)
58
- assert_equal("title", button.label)
59
- end
60
- end
61
-
62
- sub_test_case "instance methods" do
63
- def setup
64
- @dialog = Gtk::Dialog.new
65
- end
66
-
67
- test "#use_header_bar?" do
68
- only_gtk_version(3, 12, 0)
69
- assert do
70
- not @dialog.use_header_bar?
71
- end
72
- end
73
- end
74
- end
@@ -1,42 +0,0 @@
1
- # Copyright (C) 2015-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
- class TestGtkMenuItem < Test::Unit::TestCase
18
- include GtkTestUtils
19
-
20
- sub_test_case ".new" do
21
- test "without arguments" do
22
- item = Gtk::MenuItem.new()
23
- assert_equal("", item.label)
24
- end
25
-
26
- test "with label" do
27
- item = Gtk::MenuItem.new(:label => "Label")
28
- assert_equal("Label", item.label)
29
- assert do
30
- not item.use_underline?
31
- end
32
- end
33
-
34
- test "with mnemonic" do
35
- item = Gtk::MenuItem.new(:label => "_Label", :use_underline => true)
36
- assert_equal("Label", item.label)
37
- assert do
38
- item.use_underline?
39
- end
40
- end
41
- end
42
- end