From: Kouhei S. <nu...@co...> - 2017-12-01 00:27:26
|
Kouhei Sutou 2017-12-01 09:26:09 +0900 (Fri, 01 Dec 2017) New Revision: 46b57b41ad6e477e2a6c79dfffc272b904f60000 https://github.com/ruby-gnome2/ruby-gnome2/commit/46b57b41ad6e477e2a6c79dfffc272b904f60000 Message: gtk3 Gtk::ToggleAction#active=: follow implicit nil check change Modified files: gtk3/lib/gtk3/action-group.rb gtk3/test/test-gtk-toggle-action.rb Modified: gtk3/lib/gtk3/action-group.rb (+2 -2) =================================================================== --- gtk3/lib/gtk3/action-group.rb 2017-11-28 01:19:01 +0900 (0c56418a7) +++ gtk3/lib/gtk3/action-group.rb 2017-12-01 09:26:09 +0900 (3f7edfabf) @@ -1,4 +1,4 @@ -# Copyright (C) 2015 Ruby-GNOME2 Project Team +# Copyright (C) 2015-2017 Ruby-GNOME2 Project Team # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -80,7 +80,7 @@ module Gtk :label => translate_string(label), :tooltip => translate_string(tooltip), :stock_id => stock_id) - action.active = is_active + action.active = true if is_active action.signal_connect("activate") do callback.call(self, action) end Modified: gtk3/test/test-gtk-toggle-action.rb (+29 -1) =================================================================== --- gtk3/test/test-gtk-toggle-action.rb 2017-11-28 01:19:01 +0900 (ddc413b93) +++ gtk3/test/test-gtk-toggle-action.rb 2017-12-01 09:26:09 +0900 (bef34338f) @@ -1,4 +1,4 @@ -# Copyright (C) 2015 Ruby-GNOME2 Project Team +# Copyright (C) 2015-2017 Ruby-GNOME2 Project Team # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -38,4 +38,32 @@ class TestGtkToggleAction < Test::Unit::TestCase assert_equal("gtk-add", action.stock_id) end end + + sub_test_case("instance methods") do + def setup + @action = Gtk::ToggleAction.new("add") + end + + sub_test_case("#active=") do + def test_nil + assert_raise(ArgumentError) do + @action.active = nil + end + end + + def test_true + @action.active = true + assert do + @action.active? + end + end + + def test_false + @action.active = false + assert do + not @action.active? + end + end + end + end end |