#!perl
BEGIN {
unless
(
exists
$ENV
{
'DISPLAY'
}) {
plan
skip_all
=>
'$DISPLAY is not set.'
;
exit
;
}
if
( $@ ) {
plan
skip_all
=>
"Graphics::PLplot module not installed."
;
exit
;
}
else
{
plan
tests
=> 9;
}
Graphics::PLplot->
import
(
qw/ :all /
);
};
require_ok(
"Starlink::AST"
);
require_ok(
"Starlink::AST::PLplot"
);
plsdev(
"xwin"
);
plinit();
pladv(0);
plvpor(0, 1, 0, 1);
plwind(0, 1, 0, 1);
plcol0(2);
plenv(0, 1, 0, 1, 0, 1);
my
(
@x
,
@y
);
$x
[0] = 0.1;
$y
[0] = 0.1;
$x
[1] = 0.2;
$y
[1] = 0.2;
$x
[2] = 0.3;
$y
[2] = 0.3;
$x
[3] = 0.4;
$y
[3] = 0.4;
plcol0(1);
is( Starlink::AST::PLplot::_GLine( \
@x
, \
@y
), 1,
"Calling _GLine()"
);
is( Starlink::AST::PLplot::_GMark( \
@x
, \
@y
, 6 ), 1,
"Calling _GMark()"
);
draw_and_plot(
"Testing1"
, 0.2, 0.4,
"CC"
, 0, 1 );
draw_and_plot(
"Testing2"
, 0.2, 0.6,
"BR"
, 0.5, 0.5);
my
$upxx
= 4;
my
$upyy
= 3;
Graphics::PLplot::plptex( 0.4,0.6,
$upxx
,
$upyy
, 0.7,
"$upxx,$upyy,j=0.7"
);
Graphics::PLplot::plcol0(2);
Graphics::PLplot::plpoin( [0.4],[0.6],5);
print
"# Angle = "
. (
atan2
(
$upyy
,
$upxx
) * 180/ 3.141592654).
"\n"
;
plschr(3.5,3);
draw_and_plot (
"ASTText"
, 0.6, 0.75,
"CC"
, 0, 1);
draw_and_plot (
"Down Right"
, 0.7, 0.4,
"CC"
, -3, 4);
is( Starlink::AST::PLplot::_GFlush(), 1,
"Calling _GFlush()"
);
sleep
(1);
plspause(0);
plend();
exit
;
sub
draw_and_plot {
Starlink::AST::PLplot::_GText(
@_
);
my
(
$status
,
$xb
,
$yb
) =
Starlink::AST::PLplot::_GTxExt(
@_
);
is(
$status
, 1,
"Status check from GTxExt"
);
$xb
->[4] =
$xb
->[0];
$yb
->[4] =
$yb
->[0];
Starlink::AST::PLplot::_GLine(
$xb
,
$yb
);
Starlink::AST::PLplot::_GMark([
$_
[1]],[
$_
[2]],5);
}