gtk3 3.0.8-x64-mingw32 → 3.0.9-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/ext/gtk3/rb-gtk3.c +17 -0
  3. data/lib/2.2/gtk3.so +0 -0
  4. data/lib/2.3/gtk3.so +0 -0
  5. data/lib/gtk3/container.rb +0 -7
  6. data/lib/gtk3/deprecated.rb +3 -3
  7. data/lib/gtk3/image.rb +7 -7
  8. data/lib/gtk3/loader.rb +11 -5
  9. data/lib/gtk3/text-buffer.rb +33 -12
  10. data/lib/gtk3/text-view.rb +53 -0
  11. data/lib/gtk3/tree-model.rb +5 -0
  12. data/lib/gtk3/tree-view.rb +25 -0
  13. data/lib/gtk3/widget.rb +0 -5
  14. data/sample/gtk-demo/TODO +10 -6
  15. data/sample/gtk-demo/application.ui +93 -70
  16. data/sample/gtk-demo/appmenu.ui +19 -0
  17. data/sample/gtk-demo/assistant.rb +1 -0
  18. data/sample/gtk-demo/css_accordion.css +8 -8
  19. data/sample/gtk-demo/css_accordion.rb +2 -2
  20. data/sample/gtk-demo/css_basics.css +1 -1
  21. data/sample/gtk-demo/css_basics.rb +2 -2
  22. data/sample/gtk-demo/css_multiplebgs.rb +2 -2
  23. data/sample/gtk-demo/css_pixbufs.css +2 -2
  24. data/sample/gtk-demo/css_pixbufs.rb +2 -2
  25. data/sample/gtk-demo/css_shadows.css +5 -5
  26. data/sample/gtk-demo/css_shadows.rb +2 -2
  27. data/sample/gtk-demo/cssview.css +5 -5
  28. data/sample/gtk-demo/data/16x16/gtk3-demo-symbolic.symbolic.png +0 -0
  29. data/sample/gtk-demo/data/16x16/gtk3-demo.png +0 -0
  30. data/sample/gtk-demo/data/22x22/gtk3-demo-symbolic.symbolic.png +0 -0
  31. data/sample/gtk-demo/data/22x22/gtk3-demo.png +0 -0
  32. data/sample/gtk-demo/data/24x24/gtk3-demo-symbolic.symbolic.png +0 -0
  33. data/sample/gtk-demo/data/24x24/gtk3-demo.png +0 -0
  34. data/sample/gtk-demo/data/256x256/gtk3-demo-symbolic.symbolic.png +0 -0
  35. data/sample/gtk-demo/data/256x256/gtk3-demo.png +0 -0
  36. data/sample/gtk-demo/data/32x32/gtk3-demo-symbolic.symbolic.png +0 -0
  37. data/sample/gtk-demo/data/32x32/gtk3-demo.png +0 -0
  38. data/sample/gtk-demo/data/48x48/gtk3-demo-symbolic.symbolic.png +0 -0
  39. data/sample/gtk-demo/data/48x48/gtk3-demo.png +0 -0
  40. data/sample/gtk-demo/data/512x512/gtk3-demo-symbolic.symbolic.png +0 -0
  41. data/sample/gtk-demo/data/512x512/gtk3-demo.png +0 -0
  42. data/sample/gtk-demo/data/source.svg +2886 -0
  43. data/sample/gtk-demo/data/symbolic-source.svg +29 -0
  44. data/sample/gtk-demo/demo.gresource.xml +16 -5
  45. data/sample/gtk-demo/demo.ui +1 -0
  46. data/sample/gtk-demo/font_features.rb +1 -1
  47. data/sample/gtk-demo/main.rb +2 -2
  48. data/sample/gtk-demo/main.ui +18 -36
  49. data/sample/gtk-demo/markup.rb +53 -8
  50. data/sample/gtk-demo/markup.txt +2 -2
  51. data/sample/gtk-demo/org.gtk.Demo.gschema.xml +9 -0
  52. data/sample/gtk-demo/pixbufs.rb +105 -145
  53. data/sample/gtk-demo/reset.css +1 -58
  54. data/sample/gtk-demo/rotated_text.rb +119 -55
  55. data/sample/gtk-demo/shortcuts-boxes.ui +167 -0
  56. data/sample/gtk-demo/shortcuts-builder.ui +547 -0
  57. data/sample/gtk-demo/shortcuts-clocks.ui +166 -0
  58. data/sample/gtk-demo/shortcuts-gedit.ui +172 -0
  59. data/sample/gtk-demo/shortcuts.ui +65 -0
  60. data/sample/gtk-demo/stack.ui +5 -5
  61. data/sample/gtk-demo/textscroll.rb +106 -0
  62. data/sample/gtk-demo/theming.ui +58 -22
  63. data/sample/gtk-demo/theming_style_classes.rb +5 -4
  64. data/sample/gtk-demo/transparent.rb +143 -0
  65. data/sample/misc/aboutdialog.rb +1 -1
  66. data/sample/misc/bindings.rb +36 -15
  67. data/sample/misc/combobox.rb +1 -1
  68. data/sample/misc/dnd.rb +3 -3
  69. data/sample/misc/icons-theme-viewer.rb +1 -1
  70. data/sample/misc/iconview.rb +2 -2
  71. data/sample/misc/textbuffer-serialize.rb +18 -14
  72. data/sample/misc/to-drawable.rb +2 -2
  73. data/sample/misc/tooltips.rb +1 -0
  74. data/sample/misc/treeview.rb +1 -1
  75. data/sample/tutorial/README.md +18 -18
  76. data/test/test-gtk-clipboard.rb +1 -1
  77. data/test/test-gtk-combo-box.rb +2 -2
  78. data/test/test-gtk-icon-view.rb +2 -2
  79. data/test/test-gtk-image.rb +1 -1
  80. data/test/test-gtk-list-store.rb +9 -3
  81. data/test/test-gtk-text-view.rb +64 -0
  82. data/test/test-gtk-tree-path.rb +1 -3
  83. data/test/test-gtk-tree-view.rb +97 -0
  84. data/test/test-gtk-window.rb +2 -2
  85. data/test/test-pango-context.rb +56 -0
  86. metadata +46 -19
@@ -32,7 +32,7 @@ end
32
32
  #
33
33
  # Icon and text
34
34
  #
35
- model = Gtk::ListStore.new(Gdk::Pixbuf, String)
35
+ model = Gtk::ListStore.new(GdkPixbuf::Pixbuf, String)
36
36
  [[Gtk::Stock::QUIT, "quit"],
37
37
  [Gtk::Stock::CANCEL, "cancel"],
38
38
  [Gtk::Stock::OK, "ok"]].each do |stock, name|
@@ -2,7 +2,7 @@
2
2
  dnd.rb - Drag and Drop sample script.
3
3
 
4
4
  Copyright (C) 2002-2015 Masao Mutoh
5
- Copyright (c) 2002-2015 Ruby-GNOME2 Project Team
5
+ Copyright (c) 2002-2016 Ruby-GNOME2 Project Team
6
6
  This program is licenced under the same licence as Ruby-GNOME2.
7
7
  =end
8
8
 
@@ -44,9 +44,9 @@ class DestWindow < Gtk::Window
44
44
  context.targets.each do |target|
45
45
  if target.name == "test" ||
46
46
  selection_data.type == Gdk::Selection::TYPE_STRING
47
- data_len = selection_data.data[1]
47
+ data_len = selection_data.data.size
48
48
  puts "drag-data-received signal:"
49
- puts selection_data.data[0].pack("C#{data_len}")
49
+ puts selection_data.data.pack("C#{data_len}")
50
50
  puts selection_data.text
51
51
  else
52
52
  next
@@ -9,7 +9,7 @@
9
9
  require "gtk3"
10
10
 
11
11
  def fill_model(icons)
12
- model = Gtk::ListStore.new(String, Gdk::Pixbuf)
12
+ model = Gtk::ListStore.new(String, GdkPixbuf::Pixbuf)
13
13
  icons.each do |icon|
14
14
  pixbuf = Gtk::IconTheme.default.load_icon(icon, 32, 0)
15
15
  iter = model.append
@@ -11,7 +11,7 @@ require "gtk3"
11
11
  TEXT_COLUMN = 0
12
12
  PIXBUF_COLUMN = 1
13
13
 
14
- model = Gtk::ListStore.new(String, Gdk::Pixbuf)
14
+ model = Gtk::ListStore.new(String, GdkPixbuf::Pixbuf)
15
15
 
16
16
  iv = Gtk::IconView.new
17
17
  iv.set_model(model)
@@ -21,7 +21,7 @@ iv.pixbuf_column = PIXBUF_COLUMN
21
21
  Dir.glob("#{File.expand_path(File.dirname(__FILE__))}/../gtk-demo/gnome*.png").each do |f|
22
22
  iter = model.append
23
23
  iter[TEXT_COLUMN] = File.basename(f)
24
- iter[PIXBUF_COLUMN] = Gdk::Pixbuf.new(f)
24
+ iter[PIXBUF_COLUMN] = GdkPixbuf::Pixbuf.new(:file => f)
25
25
  end
26
26
 
27
27
  iv.signal_connect("item_activated") do |iv, path|
@@ -84,16 +84,18 @@ button_color = Gtk::ToolButton.new(:icon_widget => nil, :label => "Color the reg
84
84
  button_color.signal_connect "clicked" do
85
85
  dialog = Gtk::ColorChooserDialog.new(:title => "Color the region", :parent => window)
86
86
  if dialog.run == Gtk::ResponseType::OK
87
- bounds = buffer.selection_bounds # returns an array [Gtk::TextIter, Gtk::TextIter]
88
- rgba = dialog.rgba
89
- color = Gdk::Color.new(rgba.red*65535, rgba.green*65535, rgba.blue*65535)
90
- tag_name = color.to_s
91
- unless tag = buffer.tag_table.lookup(tag_name)
92
- tag = Gtk::TextTag.new(tag_name)
93
- tag.set_foreground_gdk(color)
87
+ bounds = buffer.selection_bounds # returns an array [Gtk::TextIter, Gtk::TextIter] or nil
88
+ if bounds
89
+ rgba = dialog.rgba
90
+ color = Gdk::Color.new(rgba.red*65535, rgba.green*65535, rgba.blue*65535)
91
+ tag_name = color.to_s
92
+ unless tag = buffer.tag_table.lookup(tag_name)
93
+ tag = Gtk::TextTag.new(tag_name)
94
+ tag.set_foreground_gdk(color)
95
+ end
96
+ buffer.tag_table.add(tag)
97
+ buffer.apply_tag(tag, bounds[0], bounds[1])
94
98
  end
95
- buffer.tag_table.add(tag)
96
- buffer.apply_tag(tag, bounds[0], bounds[1])
97
99
  end
98
100
  dialog.destroy
99
101
  end
@@ -103,12 +105,14 @@ button_font.signal_connect "clicked" do
103
105
  dialog = Gtk::FontChooserDialog.new(:label => "Set font to the region", :parent => window)
104
106
  if dialog.run == Gtk::ResponseType::OK
105
107
  bounds = buffer.selection_bounds
106
- font = dialog.font
107
- unless tag = buffer.tag_table.lookup(font)
108
- tag = Gtk::TextTag.new(font).set_font(font)
108
+ if bounds
109
+ font = dialog.font
110
+ unless tag = buffer.tag_table.lookup(font)
111
+ tag = Gtk::TextTag.new(font).set_font(font)
112
+ end
113
+ buffer.tag_table.add(tag)
114
+ buffer.apply_tag(tag, bounds[0], bounds[1])
109
115
  end
110
- buffer.tag_table.add(tag)
111
- buffer.apply_tag(tag, bounds[0], bounds[1])
112
116
  end
113
117
  dialog.destroy
114
118
  end
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  =begin
3
- to_drawable.rb - Gdk::Pixbuf(GDK methods) sample script.
3
+ to_drawable.rb - GdkPixbuf::Pixbuf(GDK methods) sample script.
4
4
 
5
5
  Copyright (c) 2002-2015 Ruby-GNOME2 Project Team
6
6
  This program is licenced under the same licence as Ruby-GNOME2.
@@ -13,7 +13,7 @@ filename = "#{File.expand_path(File.dirname(__FILE__))}/gnome-logo-icon.png"
13
13
  window = Gtk::Window.new("Drawable sample")
14
14
  window.set_border_width(10)
15
15
 
16
- pixbuf = Gdk::Pixbuf.new(filename)
16
+ pixbuf = GdkPixbuf::Pixbuf.new(:file => filename)
17
17
 
18
18
  drawing_area = Gtk::DrawingArea.new
19
19
  window.add(drawing_area)
@@ -41,6 +41,7 @@ def textview_query_tooltip(textview, keyboard_tip, x, y, tooltip, tag)
41
41
  else
42
42
  bx, by = textview.window_to_buffer_coords(Gtk::TextWindowType::TEXT, x, y)
43
43
  iter, = textview.get_iter_at_position(bx, by)
44
+ return false if iter.nil?
44
45
  end
45
46
  if iter.has_tag?(tag)
46
47
  tooltip.text = 'Tooltip on text tag'
@@ -10,7 +10,7 @@ require "gtk3"
10
10
  window = Gtk::Window.new("Gtk::TreeView sample")
11
11
 
12
12
  # Create data
13
- model = Gtk::TreeStore.new(String, String, Gdk::RGBA, Float, Gdk::Pixbuf)
13
+ model = Gtk::TreeStore.new(String, String, Gdk::RGBA, Float, GdkPixbuf::Pixbuf)
14
14
 
15
15
  # column 1
16
16
  root_iter = model.append(nil)
@@ -16,7 +16,7 @@ Here is the most basic example that illustrate the principles of widget hierarch
16
16
  require "gtk3"
17
17
 
18
18
  window = Gtk::Window.new("First example")
19
- window.set_request_size(400, 400)
19
+ window.set_size_request(400, 400)
20
20
  window.set_border_width(10)
21
21
 
22
22
  button = Gtk::Button.new(:label => "Say hello")
@@ -157,7 +157,7 @@ app.signal_connect "activate" do |application|
157
157
  window.set_title("Window")
158
158
  window.set_border_width(10)
159
159
 
160
- # Here we construct the container that is going pack our buttons
160
+ # Here we construct the container that is going pack our buttons
161
161
  grid = Gtk::Grid.new
162
162
 
163
163
  # Pack the container in the window
@@ -281,7 +281,7 @@ Here is the "builder.ui" file that describes the interface:
281
281
  The usage of the `Gtk::Builder` is really easy, we just create an instance from the
282
282
  file "builder.ui" with `Gtk::Builder.new(:file => builder_file)`. Then you can access every widget or part of the interface thanks to its name: `window = builder.get_object("window")`. Note that `Gtk::Builder` can also be used to construct objects that are not widgets, such as tree models, adjustments, etc.
283
283
 
284
- The XML definition of the interface can be loaded from a file, a string or a path in a gresource binary. More informations related to this XML definition can be found [here](https://developer.gnome.org/gtk3/stable/GtkBuilder.html#BUILDER-UI). Those files are generally built with [glade](https://glade.gnome.org/).
284
+ The XML definition of the interface can be loaded from a file, a string or a path in a gresource binary. More informations related to this XML definition can be found [here](https://developer.gnome.org/gtk3/stable/GtkBuilder.html#BUILDER-UI). Those files are generally built with [glade](https://glade.gnome.org/).
285
285
 
286
286
 
287
287
  ## Building applications
@@ -296,7 +296,7 @@ require "gtk3"
296
296
  class ExampleAppWindow < Gtk::ApplicationWindow
297
297
 
298
298
  def open(file)
299
-
299
+
300
300
  end
301
301
  end
302
302
 
@@ -318,7 +318,7 @@ class ExampleApp < Gtk::Application
318
318
  end
319
319
 
320
320
  files.each { |file| win.open(file) }
321
-
321
+
322
322
  win.present
323
323
  end
324
324
  end
@@ -393,7 +393,7 @@ Here is the "window.ui" file that contains the template of the window:
393
393
  ```
394
394
  Unlike regular interface descriptions, in template XML descriptions, a`<template>` tag is expected as a direct child of the toplevel `<interface>` tag. Yhe `<template>` tag must specify the "*class*" attribute which must be the class name of the widget. Optionally, the "*parent*" attribute may be specified to indicate the direct parent class (superclass).
395
395
 
396
- More informations can be found in the part [building composite widgets from template XML](https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget.description) of the `Gtk::Widget` documentation.
396
+ More informations can be found in the part [building composite widgets from template XML](https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget.description) of the `Gtk::Widget` documentation.
397
397
 
398
398
  #### Link a template to a custom class widget.
399
399
 
@@ -411,7 +411,7 @@ class ExampleAppWindow < Gtk::ApplicationWindow
411
411
  end
412
412
 
413
413
  def open(file)
414
-
414
+
415
415
  end
416
416
  end
417
417
  ```
@@ -482,7 +482,7 @@ This new way to access the stack widget is used in the following code. We have p
482
482
  ```ruby
483
483
  class ExampleAppWindow < Gtk::ApplicationWindow
484
484
  def open(file)
485
-
485
+
486
486
  end
487
487
  end
488
488
 
@@ -500,7 +500,7 @@ class ExampleApp < Gtk::Application
500
500
  end
501
501
 
502
502
  files.each { |file| win.open(file) }
503
-
503
+
504
504
  win.present
505
505
  end
506
506
  end
@@ -526,14 +526,14 @@ def open(file)
526
526
  view.buffer.text = stream.read
527
527
  end
528
528
  ```
529
- Each file is opened and loaded in a `Gtk::TextView` with
529
+ Each file is opened and loaded in a `Gtk::TextView` with
530
530
 
531
531
  ```ruby
532
532
  stream = file.read
533
533
  view.buffer.text = stream.read
534
534
  ```
535
535
 
536
- We get the basename, of the file in argument, that will be used as title for each tab of the stack widget:
536
+ We get the basename, of the file in argument, that will be used as title for each tab of the stack widget:
537
537
 
538
538
  ```
539
539
  stack.add_titled(scrolled, basename, basename)
@@ -611,7 +611,7 @@ application.add_action(action)
611
611
 
612
612
  #### Add accelerators for action.
613
613
 
614
- An accelerator is just a keys combination that acts as a shortcut for an action.
614
+ An accelerator is just a keys combination that acts as a shortcut for an action.
615
615
 
616
616
  ```ruby
617
617
  quit_accels = ["<Ctrl>Q"]
@@ -655,7 +655,7 @@ We are going to use `Gio::Settings` to store our preferences. `Gio::Settings` re
655
655
  </schemalist>
656
656
  ```
657
657
 
658
- Before we can make use of this schema in our application, we need to compile it into the binary form that `Gio::Settings` expects.
658
+ Before we can make use of this schema in our application, we need to compile it into the binary form that `Gio::Settings` expects.
659
659
 
660
660
  ```ruby
661
661
  system("glib-compile-schemas", data_path)
@@ -670,12 +670,12 @@ Gio::SettingsSchemaSource.new(data_path,
670
670
  false)
671
671
 
672
672
  ```
673
- This is the corresponding method to the function [g_settings_schema_source_new_from_directory](https://developer.gnome.org/gio/stable/gio-GSettingsSchema-GSettingsSchemaSource.html#g-settings-schema-source-new-from-directory).
673
+ This is the corresponding method to the function [g_settings_schema_source_new_from_directory](https://developer.gnome.org/gio/stable/gio-GSettingsSchema-GSettingsSchemaSource.html#g-settings-schema-source-new-from-directory).
674
674
 
675
675
  As an alternative, our schema can just be loaded by using the `GSETTINGS_SCHEMA_DIR` environment variable.
676
676
 
677
677
  ```ruby
678
- ENV["GSETTINGS_SCHEMA_DIR"] = data_path
678
+ ENV["GSETTINGS_SCHEMA_DIR"] = data_path
679
679
  ```
680
680
  More informations on the use of gschemas can be found [here](https://developer.gnome.org/gio/stable/gio-GSettingsSchema-GSettingsSchemaSource.html)
681
681
 
@@ -842,11 +842,11 @@ def open(file)
842
842
  stream = file.read
843
843
  buffer = view.buffer
844
844
  buffer.text = stream.read
845
- tag = buffer.create_tag()
845
+ tag = buffer.create_tag()
846
846
  @settings.bind("font", tag, "font", Gio::SettingsBindFlags::DEFAULT)
847
847
  buffer.apply_tag(tag, buffer.start_iter, buffer.end_iter)
848
848
  end
849
- ```
849
+ ```
850
850
 
851
851
  ### Adding a search bar
852
852
  https://developer.gnome.org/gtk3/stable/ch01s04.html#id-1.2.3.12.10
@@ -1297,4 +1297,4 @@ Our application already uses a `Gtk::HeaderBar`, but so far it still gets a 'nor
1297
1297
  </interface>
1298
1298
  ```
1299
1299
 
1300
- A small extra bonus of using a header bar is that we get a fallback application menu for free.
1300
+ A small extra bonus of using a header bar is that we get a fallback application menu for free.
@@ -66,7 +66,7 @@ class TestGtkClipboard < Test::Unit::TestCase
66
66
  received_image = image
67
67
  loop.quit
68
68
  end
69
- image = Gdk::Pixbuf.new(fixture_path("gnome-logo-icon.png"))
69
+ image = GdkPixbuf::Pixbuf.new(:file => fixture_path("gnome-logo-icon.png"))
70
70
  @clipboard.image = image
71
71
  loop.run
72
72
 
@@ -27,7 +27,7 @@ class TestGtkComboBox < Test::Unit::TestCase
27
27
  end
28
28
 
29
29
  test ":model" do
30
- model = Gtk::ListStore.new(Gdk::Pixbuf, String)
30
+ model = Gtk::ListStore.new(GdkPixbuf::Pixbuf, String)
31
31
  combo_box = Gtk::ComboBox.new(:entry => true, :model => model)
32
32
  assert do
33
33
  combo_box.has_entry?
@@ -55,7 +55,7 @@ class TestGtkComboBox < Test::Unit::TestCase
55
55
  end
56
56
 
57
57
  test ":model" do
58
- model = Gtk::ListStore.new(Gdk::Pixbuf, String)
58
+ model = Gtk::ListStore.new(GdkPixbuf::Pixbuf, String)
59
59
  combo_box = Gtk::ComboBox.new(:model => model)
60
60
  assert do
61
61
  not combo_box.has_entry?
@@ -41,7 +41,7 @@ class TestGtkIconView < Test::Unit::TestCase
41
41
  class TestGetCellRect < self
42
42
  def setup
43
43
  only_gtk_version(3, 6, 0)
44
- model = Gtk::ListStore.new(String, Gdk::Pixbuf)
44
+ model = Gtk::ListStore.new(String, GdkPixbuf::Pixbuf)
45
45
  iter = model.append
46
46
  model.set_values(iter, ["label", nil])
47
47
  @path = iter.path
@@ -53,7 +53,7 @@ class TestGtkIconView < Test::Unit::TestCase
53
53
  end
54
54
 
55
55
  def test_not_found
56
- indices, _ = @path.indices
56
+ indices = @path.indices
57
57
  not_found_path = Gtk::TreePath.new
58
58
  not_found_path.append_index(indices.last + 1)
59
59
  assert_nil(@icon_view.get_cell_rect(not_found_path))
@@ -40,13 +40,13 @@ class TestGtkImage < Test::Unit::TestCase
40
40
  end
41
41
 
42
42
  test "resource" do
43
+ only_gtk_version(3, 18, 0)
43
44
  resource = Gio::Resource.load(fixture_path("image.gresource"))
44
45
  Gio::Resources.register(resource)
45
46
  begin
46
47
  resource_path = "/org/ruby/gnome/gnome-logo-icon.png"
47
48
  image = Gtk::Image.new(:resource => resource_path,
48
49
  :size => :dialog)
49
- omit("GTK+ 3.16 doesn't support getting resource path. See GitHub#461.")
50
50
  assert_equal(resource_path,
51
51
  image.resource)
52
52
  ensure
@@ -194,20 +194,26 @@ class TestGtkListStore < Test::Unit::TestCase
194
194
  test "iter" do
195
195
  GC.start
196
196
  n_iterators = count_objects(Gtk::TreeIter)
197
- 50.times do |i|
197
+ n_items = 50
198
+ n_iterators_created = 100
199
+ n_iterators_for_remove = 1
200
+
201
+ n_items.times do |i|
198
202
  iter = @store.append
199
203
  iter[ID] = i
200
204
  iter[NAME] = i.to_s
201
205
  end
202
- 100.times do
206
+ n_iterators_created.times do
203
207
  @store.iter_first
204
208
  end
205
209
  iter = @store.iter_first
206
210
  while @store.remove(iter); end
207
211
  assert_equal(0, @store.to_enum(:each).to_a.size)
212
+
208
213
  GC.start
209
214
  assert do
210
- count_objects(Gtk::TreeIter) <= n_iterators + 1
215
+ count_objects(Gtk::TreeIter) <
216
+ (n_iterators + n_items + n_iterators_created + n_iterators_for_remove)
211
217
  end
212
218
  end
213
219
 
@@ -0,0 +1,64 @@
1
+ # Copyright (C) 2016 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 TestGtkTextView < Test::Unit::TestCase
18
+ include GtkTestUtils
19
+
20
+ sub_test_case "instance methods" do
21
+ def setup
22
+ only_gtk_version(3, 14)
23
+ @text_buffer = Gtk::TextBuffer.new
24
+ @text_buffer.text = "Hello"
25
+ @text_view = Gtk::TextView.new(@text_buffer)
26
+ end
27
+
28
+ sub_test_case "#get_iter_at" do
29
+ test ":location" do
30
+ iter = @text_view.get_iter_at(:location => [0, 0])
31
+ assert_equal("H", iter.char)
32
+ end
33
+
34
+ test ":position" do
35
+ iter, trailing = @text_view.get_iter_at(:position => [0, 0])
36
+ assert_equal(["H", 0],
37
+ [iter.char, trailing])
38
+ end
39
+ end
40
+
41
+ sub_test_case "#get_iter_at_location" do
42
+ test "found" do
43
+ iter = @text_view.get_iter_at_location(0, 0)
44
+ assert_equal("H", iter.char)
45
+ end
46
+
47
+ test "not found" do
48
+ assert_nil(@text_view.get_iter_at_location(100, 0))
49
+ end
50
+ end
51
+
52
+ sub_test_case "#get_iter_at_position" do
53
+ test "found" do
54
+ iter, trailing = @text_view.get_iter_at_position(0, 0)
55
+ assert_equal(["H", 0],
56
+ [iter.char, trailing])
57
+ end
58
+
59
+ test "not found" do
60
+ assert_nil(@text_view.get_iter_at_position(100, 0))
61
+ end
62
+ end
63
+ end
64
+ end
@@ -30,9 +30,7 @@ class TestGtkTreePath < Test::Unit::TestCase
30
30
  end
31
31
 
32
32
  def test_indices
33
- indices, depth = tree_path("2").indices
34
- assert_equal([[2], 1],
35
- [indices, depth])
33
+ assert_equal([2], tree_path("2").indices)
36
34
  end
37
35
 
38
36
  def test_down!