| 1 | use strict; use warnings; |
| 2 | use Test::More; |
| 3 | use Config; |
| 4 | # Stop f77-linking causing spurious undefined symbols (alpha) |
| 5 | $ENV{'PERL_DL_NONLAZY'}=0 if $Config{'osname'} eq "dec_osf"; |
| 6 | require PGPLOT; |
| 7 | |
| 8 | my $dev = $ENV{PGPLOT_DEV} || '/NULL'; |
| 9 | |
| 10 | $ENV{PGPLOT_XW_WIDTH}=0.3; |
| 11 | |
| 12 | note "Testing greyscale, contour and vector routines"; |
| 13 | |
| 14 | # Read in image (int*2) |
| 15 | |
| 16 | my $img=""; |
| 17 | open my $fh, "test.img" or die "Data file test.img not found: $!"; |
| 18 | binmode $fh if $^O =~ /mswin32/i; |
| 19 | read($fh, $img, 32768); |
| 20 | close $fh or die "Can't close test.img: $!"; |
| 21 | |
| 22 | note length($img)," bytes read\n"; |
| 23 | |
| 24 | my @image = unpack("n*",$img); |
| 25 | |
| 26 | note $#image+1," element image stored\n"; |
| 27 | |
| 28 | PGPLOT::pgbegin(0,$dev,1,1); |
| 29 | |
| 30 | note "Plotting...\n"; |
| 31 | |
| 32 | PGPLOT::pgsci(3); |
| 33 | PGPLOT::pgwnad(12000,13000,13000,12000); |
| 34 | |
| 35 | my @tr=(12000,8,0,12000,0,8); |
| 36 | PGPLOT::pggray(\@image,128,128,1,128,1,128,5000,0,\@tr); |
| 37 | PGPLOT::pglabel("\\ga","\\gd","Galaxy"); |
| 38 | PGPLOT::pgtbox("ZYHBCNST",0,0,"ZYDBCNST",0,0); |
| 39 | |
| 40 | PGPLOT::pgwedg('R', 2, 5, 5000, 0, 'Counts'); |
| 41 | |
| 42 | PGPLOT::pgsci(4); PGPLOT::pgsls(1); |
| 43 | my @cont = (-1,1000,2000,3000,4000,5000); |
| 44 | PGPLOT::pgcons(\@image, 128, 128, 1,128,1,128, \@cont, 6, \@tr); |
| 45 | PGPLOT::pgwnad(0,1000,0,1000); |
| 46 | |
| 47 | @tr=(0,100,0,0,0,100); |
| 48 | PGPLOT::pgsah(1,30,0.5); |
| 49 | PGPLOT::pgsci(2); |
| 50 | PGPLOT::pgvect([(30) x 100], [(50) x 100], 10, 10, 1,9,1,9, 1, 1, \@tr, -10000); |
| 51 | |
| 52 | PGPLOT::pgend(); |
| 53 | |
| 54 | pass; |
| 55 | done_testing; |