gtk3 2.0.2 → 2.0.3

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.
@@ -0,0 +1,69 @@
1
+ /* @import this colorsheet to get the default values for every property.
2
+ * This is useful when writing special CSS tests that should not be
3
+ * inluenced by themes - not even the default ones.
4
+ * Keep in mind that the output will be very ugly and not look like
5
+ * anything GTK.
6
+ * Also, when adding new style properties, please add them here.
7
+ */
8
+
9
+ * {
10
+ color: inherit;
11
+ font-size: inherit;
12
+ background-color: initial;
13
+ font-family: inherit;
14
+ font-style: inherit;
15
+ font-variant: inherit;
16
+ font-weight: inherit;
17
+ text-shadow: inherit;
18
+ icon-shadow: inherit;
19
+ box-shadow: initial;
20
+ margin-top: initial;
21
+ margin-left: initial;
22
+ margin-bottom: initial;
23
+ margin-right: initial;
24
+ padding-top: initial;
25
+ padding-left: initial;
26
+ padding-bottom: initial;
27
+ padding-right: initial;
28
+ border-top-style: initial;
29
+ border-top-width: initial;
30
+ border-left-style: initial;
31
+ border-left-width: initial;
32
+ border-bottom-style: initial;
33
+ border-bottom-width: initial;
34
+ border-right-style: initial;
35
+ border-right-width: initial;
36
+ border-top-left-radius: initial;
37
+ border-top-right-radius: initial;
38
+ border-bottom-right-radius: initial;
39
+ border-bottom-left-radius: initial;
40
+ outline-style: initial;
41
+ outline-width: initial;
42
+ outline-offset: initial;
43
+ background-clip: initial;
44
+ background-origin: initial;
45
+ background-size: initial;
46
+ background-position: initial;
47
+ border-top-color: initial;
48
+ border-right-color: initial;
49
+ border-bottom-color: initial;
50
+ border-left-color: initial;
51
+ outline-color: initial;
52
+ background-repeat: initial;
53
+ background-image: initial;
54
+ border-image-source: initial;
55
+ border-image-repeat: initial;
56
+ border-image-slice: initial;
57
+ border-image-width: initial;
58
+ transition-property: initial;
59
+ transition-duration: initial;
60
+ transition-timing-function: initial;
61
+ transition-delay: initial;
62
+ engine: initial;
63
+ gtk-key-bindings: initial;
64
+
65
+ -GtkWidget-focus-line-width: 0;
66
+ -GtkWidget-focus-padding: 0;
67
+ -GtkNotebook-initial-gap: 0;
68
+ }
69
+
@@ -10,7 +10,7 @@ class TestGC < Test::Unit::TestCase
10
10
 
11
11
  def test_inheritance_and_gc
12
12
  button = Class.new(Gtk::Button)
13
- box = Gtk::HBox.new
13
+ box = Gtk::Box.new(:horizontal)
14
14
  n = 10
15
15
  n.times do
16
16
  box.add(button.new)
@@ -0,0 +1,23 @@
1
+ # Copyright (C) 2013 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 TestGtk < Test::Unit::TestCase
18
+ include GtkTestUtils
19
+
20
+ def test_show_uri
21
+ assert_true(Gtk.respond_to?(:show_uri))
22
+ end
23
+ end
@@ -6,7 +6,6 @@ class TestGtkAboutDialog < Test::Unit::TestCase
6
6
  end
7
7
 
8
8
  def test_program_name
9
- only_gtk_version(2, 12, 0)
10
9
  assert_equal(File.basename($0), @dialog.program_name)
11
10
  @dialog.program_name = "my-program"
12
11
  assert_equal("my-program", @dialog.program_name)
@@ -2,12 +2,10 @@ class TestGtkBuildable < Test::Unit::TestCase
2
2
  include GtkTestUtils
3
3
 
4
4
  def setup
5
- @buildable = Gtk::HBox.new
5
+ @buildable = Gtk::Box.new(:horizontal)
6
6
  end
7
7
 
8
8
  def test_name
9
- only_gtk_version(2, 12, 0)
10
-
11
9
  assert_equal("", @buildable.name)
12
10
  @buildable.name = "YYY"
13
11
  assert_equal("YYY", @buildable.name)
@@ -17,8 +15,6 @@ class TestGtkBuildable < Test::Unit::TestCase
17
15
  end
18
16
 
19
17
  def test_add_child
20
- only_gtk_version(2, 12, 0)
21
-
22
18
  assert_equal([], @buildable.children)
23
19
 
24
20
  builder = Gtk::Builder.new
@@ -28,19 +24,15 @@ class TestGtkBuildable < Test::Unit::TestCase
28
24
  end
29
25
 
30
26
  def test_set_buildable_property
31
- only_gtk_version(2, 12, 0)
32
-
33
27
  assert_nil(@buildable.parent)
34
28
 
35
29
  builder = Gtk::Builder.new
36
- parent = Gtk::HBox.new
30
+ parent = Gtk::Box.new(:horizontal)
37
31
  @buildable.set_buildable_property(builder, "parent", parent)
38
32
  assert_equal(parent, @buildable.parent)
39
33
  end
40
34
 
41
35
  def test_construct_child
42
- only_gtk_version(2, 12, 0)
43
-
44
36
  assert_nil(@buildable.parent)
45
37
 
46
38
  @buildable = Gtk::UIManager.new
@@ -55,12 +47,10 @@ EOU
55
47
  end
56
48
 
57
49
  def test_get_internal_child
58
- only_gtk_version(2, 12, 0)
59
-
60
50
  assert_nil(@buildable.parent)
61
51
 
62
52
  @buildable = Gtk::Dialog.new
63
53
  builder = Gtk::Builder.new
64
- assert_kind_of(Gtk::VBox, @buildable.get_internal_child(builder, "vbox"))
54
+ assert_kind_of(Gtk::Box, @buildable.get_internal_child(builder, "vbox"))
65
55
  end
66
56
  end
@@ -2,20 +2,16 @@ class TestGtkBuilder < Test::Unit::TestCase
2
2
  include GtkTestUtils
3
3
 
4
4
  def test_constants
5
- only_gtk_version(2, 12, 0)
6
5
  assert_kind_of(Gtk::BuilderError, Gtk::BuilderError::INVALID_TAG)
7
6
  end
8
7
 
9
8
  def test_new
10
- only_gtk_version(2, 12, 0)
11
9
  assert_nothing_raised do
12
10
  Gtk::Builder.new
13
11
  end
14
12
  end
15
13
 
16
14
  def test_add_from_file
17
- only_gtk_version(2, 12, 0)
18
-
19
15
  builder = Gtk::Builder.new
20
16
  assert_nothing_raised do
21
17
  builder.add_from_file(ui_definition_file.path)
@@ -24,28 +20,22 @@ class TestGtkBuilder < Test::Unit::TestCase
24
20
  end
25
21
 
26
22
  def test_add_from_string
27
- only_gtk_version(2, 12, 0)
28
-
29
23
  builder = Gtk::Builder.new
30
24
  assert_nothing_raised do
31
25
  builder.add_from_string(ui_definition)
32
26
  end
33
- assert_kind_of(Gtk::VBox, builder["vbox1"])
27
+ assert_kind_of(Gtk::Box, builder["vbox1"])
34
28
  end
35
29
 
36
30
  def test_add_with_file
37
- only_gtk_version(2, 12, 0)
38
-
39
31
  builder = Gtk::Builder.new
40
32
  assert_nothing_raised do
41
33
  builder.add(ui_definition_file.path)
42
34
  end
43
- assert_kind_of(Gtk::HButtonBox, builder["hbuttonbox1"])
35
+ assert_kind_of(Gtk::ButtonBox, builder["hbuttonbox1"])
44
36
  end
45
37
 
46
38
  def test_add_with_string
47
- only_gtk_version(2, 12, 0)
48
-
49
39
  builder = Gtk::Builder.new
50
40
  assert_nothing_raised do
51
41
  builder.add(ui_definition)
@@ -54,8 +44,6 @@ class TestGtkBuilder < Test::Unit::TestCase
54
44
  end
55
45
 
56
46
  def test_add_chain
57
- only_gtk_version(2, 12, 0)
58
-
59
47
  builder = Gtk::Builder.new
60
48
  assert_nothing_raised do
61
49
  builder << ui_definition_file.path << ui_definition_simple
@@ -65,8 +53,6 @@ class TestGtkBuilder < Test::Unit::TestCase
65
53
  end
66
54
 
67
55
  def test_objects
68
- only_gtk_version(2, 12, 0)
69
-
70
56
  builder = Gtk::Builder.new
71
57
  assert_nothing_raised do
72
58
  builder << ui_definition_file.path << ui_definition_simple
@@ -77,8 +63,6 @@ class TestGtkBuilder < Test::Unit::TestCase
77
63
  end
78
64
 
79
65
  def test_translation_domain
80
- only_gtk_version(2, 12, 0)
81
-
82
66
  builder = Gtk::Builder.new
83
67
  assert_nil(builder.translation_domain)
84
68
  builder.translation_domain = "ruby-gnome2"
@@ -86,8 +70,6 @@ class TestGtkBuilder < Test::Unit::TestCase
86
70
  end
87
71
 
88
72
  def test_connect_signals
89
- only_gtk_version(2, 12, 0)
90
-
91
73
  handler_names = []
92
74
 
93
75
  builder = Gtk::Builder.new
@@ -107,8 +89,6 @@ class TestGtkBuilder < Test::Unit::TestCase
107
89
  end
108
90
 
109
91
  def test_connect_signals_with_no_signal_ui_definition
110
- only_gtk_version(2, 12, 0)
111
-
112
92
  handler_names = []
113
93
 
114
94
  builder = Gtk::Builder.new
@@ -127,11 +107,9 @@ class TestGtkBuilder < Test::Unit::TestCase
127
107
  end
128
108
 
129
109
  def test_get_type_from_name
130
- only_gtk_version(2, 12, 0)
131
-
132
110
  builder = Gtk::Builder.new
133
111
  assert_nil(builder.get_type("XXX"))
134
- assert_equal(Gtk::VBox, builder.get_type("GtkVBox"))
112
+ assert_equal(Gtk::Box, builder.get_type("GtkBox"))
135
113
  end
136
114
 
137
115
  private
@@ -0,0 +1,32 @@
1
+ # Copyright (C) 2013 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 TestGtkContainer < Test::Unit::TestCase
18
+ class TestFocusChain < self
19
+ def setup
20
+ @container = Gtk::Layout.new
21
+ end
22
+
23
+ def test_set_explicitly
24
+ @container.focus_chain = []
25
+ assert_equal([], @container.focus_chain)
26
+ end
27
+
28
+ def test_not_set_explicitly
29
+ assert_nil(@container.focus_chain)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,27 @@
1
+ # Copyright (C) 2013 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 TestGtkCssProvider < Test::Unit::TestCase
18
+ include GtkTestUtils
19
+
20
+ def setup
21
+ @provider = Gtk::CssProvider.new
22
+ end
23
+
24
+ def test_load_from_data
25
+ assert_true(@provider.load(:data => "GtkWindow {background-color: red;}"))
26
+ end
27
+ end
@@ -6,8 +6,6 @@ class TestGtkEntry < Test::Unit::TestCase
6
6
  end
7
7
 
8
8
  def test_cursor_hadjustment
9
- only_gtk_version(2, 12)
10
-
11
9
  assert_nil(@entry.cursor_hadjustment)
12
10
  adjustment = Gtk::Adjustment.new(0.0, 0.0,
13
11
  100.0, 100.0,
@@ -6,25 +6,26 @@ class TestGtkIconTheme < Test::Unit::TestCase
6
6
  end
7
7
 
8
8
  def test_choose_icon
9
- only_gtk_version(2, 12)
10
-
11
9
  assert_nil(@theme.choose_icon("non-existent", 100))
12
10
 
13
- icon = @theme.choose_icon("undo", 10)
11
+ icon = @theme.choose_icon("face-cool", 10)
14
12
  assert_not_nil(icon)
15
- assert_match(/undo/, icon.filename)
13
+ assert_match(/face-cool/, icon.filename)
16
14
 
17
- assert_not_nil(@theme.choose_icon("undo", 29, [:use_builtin, :no_svg]))
15
+ assert_not_nil(@theme.choose_icon("face-cool", 29, [:use_builtin, :no_svg]))
18
16
  end
19
17
 
20
18
  def test_contexts
21
- only_gtk_version(2, 12)
22
-
23
19
  assert_operator(@theme.contexts, :include?, "MimeTypes")
24
20
  end
25
21
 
26
- def test_icons
27
- assert_operator(@theme.icons, :include?, "undo")
28
- assert_operator(@theme.icons("Actions"), :include?, "remove")
22
+ class TestIcons < self
23
+ def test_no_argument
24
+ assert_operator(@theme.icons, :include?, "face-cool")
25
+ end
26
+
27
+ def test_context
28
+ assert_operator(@theme.icons("Actions"), :include?, "find")
29
+ end
29
30
  end
30
31
  end
@@ -2,7 +2,7 @@ class TestGtkImage < Test::Unit::TestCase
2
2
  include GtkTestUtils
3
3
 
4
4
  def test_stock
5
- image = Gtk::Image.new(Gtk::Stock::GO_FORWARD, Gtk::IconSize::DIALOG)
6
- assert_equal(Gtk::Stock::GO_FORWARD, image.stock)
5
+ image = Gtk::Image.new(Gtk::Stock::GO_FORWARD, :dialog)
6
+ assert_equal(Gtk::Stock::GO_FORWARD.to_s, image.stock)
7
7
  end
8
8
  end
@@ -34,8 +34,6 @@ class TestGtkListStore < Test::Unit::TestCase
34
34
  end
35
35
 
36
36
  def test_set_values
37
- only_gtk_version(2, 12)
38
-
39
37
  iter = @store.append
40
38
  assert_nothing_raised do
41
39
  @store.set_values(iter, [0, '1'])
@@ -55,8 +53,6 @@ class TestGtkListStore < Test::Unit::TestCase
55
53
  end
56
54
 
57
55
  def test_set_values_with_hash
58
- only_gtk_version(2, 12)
59
-
60
56
  iter = @store.append
61
57
  assert_nothing_raised do
62
58
  @store.set_values(iter, {ID => 0, NAME => 'me'})
@@ -0,0 +1,30 @@
1
+ # Copyright (C) 2013 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 TestGtkStyleContext < Test::Unit::TestCase
18
+ include GtkTestUtils
19
+
20
+ def setup
21
+ @style_context = Gtk::StyleContext.new
22
+ end
23
+
24
+ def test_add_provider
25
+ provider = Gtk::CssProvider.new
26
+ assert_nothing_raised do
27
+ @style_context.add_provider(provider, GLib::MAXUINT)
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,38 @@
1
+ # Copyright (C) 2013 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 TestGtkStyleProperties < Test::Unit::TestCase
18
+ def setup
19
+ @properties = Gtk::StyleProperties.new
20
+ end
21
+
22
+ class TestGet < self
23
+ def test_eixstent
24
+ key = "border-radius"
25
+ state = :normal
26
+ value = 29
27
+
28
+ g_value = GLib::Value.new(GLib::Type::INT, value)
29
+ # TODO: support direct Ruby object use
30
+ @properties.set_property(key, state, g_value)
31
+ assert_equal(value, @properties.get_property(key, state))
32
+ end
33
+
34
+ def test_noneixstent
35
+ assert_nil(@properties.get_property("nonexistent", :normal))
36
+ end
37
+ end
38
+ end