[perl-Gtk3] Gtk3::TextBuffer::create_tag: handle all property pairs



commit bcd21a159211d39aa3060923c644fcbc35d0b06f
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Sun Sep 1 14:30:52 2013 +0200

    Gtk3::TextBuffer::create_tag: handle all property pairs
    
    Due to a typo, we skipped the first key/value pair.
    
    Spotted by control H.

 lib/Gtk3.pm          |    2 +-
 t/zz-GtkTextBuffer.t |    6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/lib/Gtk3.pm b/lib/Gtk3.pm
index ea71724..57a9044 100644
--- a/lib/Gtk3.pm
+++ b/lib/Gtk3.pm
@@ -966,7 +966,7 @@ sub Gtk3::TextBuffer::create_tag {
   my $tag = Gtk3::TextTag->new ($tag_name);
   my $tag_table = $buffer->get_tag_table;
   $tag_table->add ($tag);
-  for (my $i = 2 ; $i < @rest ; $i += 2) {
+  for (my $i = 0 ; $i < @rest ; $i += 2) {
     $tag->set_property ($rest[$i], $rest[$i+1]);
   }
   return $tag;
diff --git a/t/zz-GtkTextBuffer.t b/t/zz-GtkTextBuffer.t
index d400521..8f8f640 100644
--- a/t/zz-GtkTextBuffer.t
+++ b/t/zz-GtkTextBuffer.t
@@ -9,7 +9,7 @@ use warnings;
 use utf8;
 use Glib qw/TRUE FALSE/;
 
-plan tests => 38;
+plan tests => 40;
 
 my $table = Gtk3::TextTagTable -> new();
 
@@ -102,8 +102,10 @@ ok(!$buffer -> get_selection_bounds());
   $buffer -> select_range($bounds->());
 }
 
-my $tag_one = $buffer -> create_tag("alb", indent => 2);
+my $tag_one = $buffer -> create_tag("alb", indent => 2, justification => 'center');
 isa_ok($tag_one, "Gtk3::TextTag");
+is($tag_one->get ('indent'), 2);
+is($tag_one->get ('justification'), 'center');
 
 $buffer -> apply_tag($tag_one, $bounds->());
 $buffer -> apply_tag_by_name("alb", $bounds->());


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]