File: 0.GtkSpell.t

package info (click to toggle)
libgtk2-spell-perl 1.04-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 140 kB
  • ctags: 5
  • sloc: perl: 40; ansic: 7; makefile: 4
file content (90 lines) | stat: -rw-r--r-- 2,139 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#
# $Id$
#

#########################
# Gtk2 Tests
# 	- rm
#########################

$ENV{LANG} = 'C';

use Gtk2;
use Test::More;

if( Gtk2->init_check )
{
	plan tests => 8;
	require_ok('Gtk2::Spell');
}
else
{
	plan skip_all =>
		'Gtk2->init_check failed, probably unable to open DISPLAY';
}

use constant TRUE => 1;
use constant FALSE => 0;

Gtk2->init;

my $view = Gtk2::TextView->new;
$view->set_wrap_mode('word');
ok(1);

# could be $spell = Gtk2::Spell->new;
ok( my $spell = Gtk2::Spell->new_attach($view) );

my $scroll = Gtk2::ScrolledWindow->new( );
$scroll->set_policy('automatic', 'automatic');
$scroll->set_shadow_type('in');
$scroll->add($view);
ok(1);

my $box = Gtk2::VBox->new( FALSE, 5 );
$box->pack_start(Gtk2::Label->new("Type some text into the text box.\n".
		"Try misspelling some words.  Then right-click on them."),
				FALSE, FALSE, 0);
$box->pack_start($scroll, TRUE, TRUE, 0);
$box->show_all;
ok(1);

my $win = Gtk2::Window->new;
$win->set_default_size(400, 300);
$win->set_title("Simple GtkSpell Demonstration");
$win->set_border_width(10);
$win->add($box);
$win->show;
ok(1);

Glib::Idle->add( sub {
		$buf = $view->get_buffer;
		ok(1);
		$buf->insert_at_cursor("Hello world, this is a teast, with "
			              ."various mis-speellings on puorpuse.");
		ok(1);
		Gtk2->main_quit;
		0;
	});

Gtk2->main;

1;
__END__

Copyright (C) 2003 by the gtk2-perl team (see the file AUTHORS for the
full list)

This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Library General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option) any
later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.  See the GNU Library General Public License for more
details.

You should have received a copy of the GNU Library General Public License along
with this library; if not, write to the Free Software Foundation, Inc., 59
Temple Place - Suite 330, Boston, MA  02111-1307  USA.