Gnome2-Vte

 view release on metacpan or  search on metacpan

t/VteTerminal.t  view on Meta::CPAN

#!/usr/bin/perl -w
use strict;
use Test::More;
use Glib qw(TRUE FALSE);
use Gnome2::Vte;

# $Id$

unless (Gtk2 -> init_check()) {
  plan skip_all => "Couldn't initialize Gtk2";
}
else {
  plan tests => 47;
}

###############################################################################

my $number = qr/^\d+$/;

###############################################################################

my $window = Gtk2::Window -> new("toplevel");

my $terminal = Gnome2::Vte::Terminal -> new();
isa_ok($terminal, "Gnome2::Vte::Terminal");

$window -> add($terminal);
$window -> show_all();

$terminal -> im_append_menuitems(Gtk2::Menu -> new());

like($terminal -> fork_command("/bin/ls",
                               ["/bin/ls", "--color", "-l", "bin"],
                               ["TERM=xterm-color"],
                               "/",
                               0, 0, 0), $number);
like($terminal -> fork_command("/bin/ls",
                               ["/bin/ls", "--color", "-l", "bin"],
                               ["TERM=xterm-color"],
                               undef,
                               0, 0, 0), $number);

$terminal -> feed("BLA!\n");
$terminal -> feed_child("BOH!\n");
$terminal -> copy_clipboard();
$terminal -> paste_clipboard();
$terminal -> copy_primary();
$terminal -> paste_primary();
$terminal -> set_size(81, 25);

SKIP: {
  skip "feed_child_binary", 0
    unless Gnome2::Vte -> CHECK_VERSION(0, 12, 1);

  $terminal -> feed_child_binary("...\0...");
}

$terminal -> set_audible_bell(1);
is($terminal -> get_audible_bell(), 1);

$terminal -> set_visible_bell(1);
is($terminal -> get_visible_bell(), 1);

$terminal -> set_allow_bold(1);
is($terminal -> get_allow_bold(), 1);

$terminal -> set_scroll_on_output(1);
$terminal -> set_scroll_on_keystroke(1);

my $white = Gtk2::Gdk::Color -> new(0xFFFF, 0xFFFF, 0xFFFF);
my $black = Gtk2::Gdk::Color -> new(0, 0, 0);

$terminal -> set_color_bold($black);
$terminal -> set_color_foreground($black);
$terminal -> set_color_background($white);
$terminal -> set_color_dim($black);
$terminal -> set_colors($black, $white, [$white, $black, $white, $black, $white, $black, $white, $black]);
$terminal -> set_colors(undef, undef, [$white, $black, $white, $black, $white, $black, $white, $black]);

SKIP: {
  skip("set_color_cursor and set_color_highlight", 0)
    unless (Gnome2::Vte -> CHECK_VERSION(0, 12, 0));

  $terminal -> set_color_cursor($black);
  $terminal -> set_color_cursor(undef);
  $terminal -> set_color_highlight($black);
  $terminal -> set_color_highlight(undef);
}

$terminal -> set_default_colors();



( run in 0.642 second using v1.01-cache-2.11-cpan-f56aa216473 )