| 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 some new PGPLOT 5.2.0 routines"; |
| 13 |
|
| 14 |
PGPLOT::pgqinf("VERSION", my $val, my $len); |
| 15 |
# Accept real PGPLOT >= 5.2.0, or giza >= 1.3 (pgaxis/pgtick added in 1.3.1); |
| 16 |
# giza reports a version string like "giza-1.5.0" which is not numeric. |
| 17 |
my $new_enough; |
| 18 |
if ($val =~ /^giza-?v?(\d+)\.(\d+)/i) { |
| 19 |
$new_enough = ($1 > 1 || ($1 == 1 && $2 >= 3)); |
| 20 |
} else { |
| 21 |
(my $numver = $val) =~ s/\.//g; $numver =~ s/v//; |
| 22 |
$new_enough = ($numver =~ /^\d+$/ && $numver >= 520); |
| 23 |
} |
| 24 |
plan skip_all => "PGPLOT version must be > 5.2.0 (or giza >= 1.3) for this test: $val\n" unless $new_enough; |
| 25 |
|
| 26 |
# Read in image (int*2) |
| 27 |
|
| 28 |
my $img=""; |
| 29 |
open(my $fh,"test.img") || die "Data file test.img not found"; |
| 30 |
if($^O =~ /mswin32/i) {binmode($fh)} |
| 31 |
read($fh, $img, 32768); |
| 32 |
close($fh) or die "can't close test.img: $!"; |
| 33 |
|
| 34 |
note length($img)," bytes read"; |
| 35 |
|
| 36 |
my @image = unpack("n*",$img); |
| 37 |
|
| 38 |
note $#image+1," element image stored"; |
| 39 |
|
| 40 |
PGPLOT::pgbegin(0,$dev,1,1); |
| 41 |
|
| 42 |
note "Plotting"; |
| 43 |
|
| 44 |
PGPLOT::pgsci(3); |
| 45 |
PGPLOT::pgwnad(12000,13000,13000,12000); |
| 46 |
|
| 47 |
my @tr=(12000,8,0,12000,0,8); |
| 48 |
PGPLOT::pglabel("\\ga","\\gd","Galaxy"); |
| 49 |
PGPLOT::pgtbox("ZYHBCNST",0,0,"ZYDBCNST",0,0); |
| 50 |
|
| 51 |
PGPLOT::pgsci(4); PGPLOT::pgconf(\@image, 128, 128, 1,128,1,128, 1000,2000, \@tr); |
| 52 |
PGPLOT::pgsci(2); PGPLOT::pgconf(\@image, 128, 128, 1,128,1,128, 2000,3000, \@tr); |
| 53 |
|
| 54 |
my @cont = (-1,1000,2000,3000,4000,5000); |
| 55 |
PGPLOT::pgsci(7); |
| 56 |
PGPLOT::pgcons(\@image, 128, 128, 1,128,1,128, \@cont, 6, \@tr); |
| 57 |
|
| 58 |
PGPLOT::pgsci(1); |
| 59 |
PGPLOT::pgaxis('LN2',12500,12800,12900,12100,1,4,0,0, 1,2,0.5, -2,30); |
| 60 |
|
| 61 |
PGPLOT::pgtick(12500,12800,12900,12100, 0.35, 3,5, 6,90,'pgperl!'); |
| 62 |
|
| 63 |
PGPLOT::pgqndt(my $ndrivers); |
| 64 |
|
| 65 |
note "Testing pgqdt() - $ndrivers drivers found"; |
| 66 |
for my $n (1..$ndrivers) { |
| 67 |
PGPLOT::pgqdt($n,my $type,my $tlen,my $descr,my $dlen,my $inter); |
| 68 |
note "$n: $type $tlen $descr $dlen $inter"; |
| 69 |
} |
| 70 |
|
| 71 |
PGPLOT::pgend(); |
| 72 |
|
| 73 |
pass; |
| 74 |
done_testing; |