"Fossies" - the Fresh Open Source Software Archive

Member "Tk-804.036/t/adjuster.t" (15 Nov 2013, 887 Bytes) of package /linux/misc/Tk-804.036.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/perl -w
    2 # -*- perl -*-
    3 
    4 #
    5 # $Id: $
    6 # Author: Slaven Rezic
    7 #
    8 
    9 use strict;
   10 
   11 use Tk;
   12 
   13 BEGIN {
   14     if (!eval q{
   15     use Test::More;
   16     1;
   17     }) {
   18     print "1..0 # skip: no Test::More module\n";
   19     exit;
   20     }
   21 }
   22 
   23 plan tests => 4;
   24 
   25 if (!defined $ENV{BATCH}) { $ENV{BATCH} = 1 }
   26 
   27 use_ok("Tk::Adjuster");
   28 
   29 my $mw = tkinit;
   30 $mw->geometry("+10+10");
   31 
   32 {
   33     my $f = $mw->Frame->pack(qw(-fill both -expand 1));
   34 
   35     my $adj = $f->Adjuster;
   36     isa_ok($adj, "Tk::Adjuster");
   37 
   38     $f->Label(-text => "top", -bg => "red")->pack;
   39     $adj->pack(-fill => "x");
   40     $f->Label(-text => "bottom", -bg => "blue")->pack;
   41 
   42     pass("Adjuster packed");
   43 }
   44 
   45 {
   46     my $f = $mw->Frame->pack(qw(-fill both -expand 1));
   47     $f->Label(-text => "top")->packAdjust;
   48     $f->Label(-text => "bottom")->pack;
   49 
   50     pass("packAdjust");
   51 }
   52 
   53 if ($ENV{BATCH}) {
   54     $mw->after(300, sub { $mw->destroy });
   55 }
   56 MainLoop;
   57 
   58 __END__