[perl-Gtk3] Add an override for Gtk3::TextBuffer::insert_markup



commit ebc9114d565e07b09aea7f58b1bbef2865666eec
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Tue Sep 15 21:22:45 2015 +0200

    Add an override for Gtk3::TextBuffer::insert_markup
    
    To make the length argument optional.

 lib/Gtk3.pm          |   10 ++++++++--
 t/zz-GtkTextBuffer.t |   13 ++++++++++++-
 2 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/lib/Gtk3.pm b/lib/Gtk3.pm
index aadaf80..5583056 100644
--- a/lib/Gtk3.pm
+++ b/lib/Gtk3.pm
@@ -1502,8 +1502,8 @@ sub Gtk3::TextBuffer::create_tag {
 }
 
 =item * The C<length> arguments of C<Gtk3::TextBuffer::insert>,
-C<insert_at_cursor>, C<insert_interactive>, C<insert_interactive_at_cursor> and
-C<set_text> are optional.
+C<insert_at_cursor>, C<insert_interactive>, C<insert_interactive_at_cursor>,
+C<insert_markup> and C<set_text> are optional.
 
 =cut
 
@@ -1531,6 +1531,12 @@ sub Gtk3::TextBuffer::insert_interactive_at_cursor {
     @_ == 4 ? @_ : (@_[0,1], -1, $_[2])); # wants length in bytes
 }
 
+sub Gtk3::TextBuffer::insert_markup {
+  return Glib::Object::Introspection->invoke (
+    $_GTK_BASENAME, 'TextBuffer', 'insert_markup',
+    @_ == 4 ? @_ : (@_[0,1,2], -1)); # wants length in bytes
+}
+
 =item * Perl reimplementations of C<Gtk3::TextBuffer::insert_with_tags> and
 C<insert_with_tags_by_name> are provided which do not require a C<length>
 argument.
diff --git a/t/zz-GtkTextBuffer.t b/t/zz-GtkTextBuffer.t
index 70d4784..d934fce 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 => 44;
+plan tests => 45;
 
 my $table = Gtk3::TextTagTable -> new();
 
@@ -169,3 +169,14 @@ $buffer -> end_user_action();
   is($e -> get_char, '年');
 }
 
+SKIP: {
+  skip 'insert_markup', 1
+    unless Gtk3::CHECK_VERSION (3, 16, 0);
+
+  my $table = Gtk3::TextTagTable -> new();
+  my $buffer = Gtk3::TextBuffer -> new($table);
+  my $markup = "<b>Lore ipsem dolor‽</b>\n";
+  $buffer -> insert_markup($buffer -> get_start_iter(), $markup);
+  cmp_ok ($table -> get_size(), '>', 0);
+}
+


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