File: maps.t

package info (click to toggle)
mapserver 8.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 18,020 kB
  • sloc: ansic: 139,708; cpp: 111,541; python: 3,004; xml: 1,722; yacc: 1,108; cs: 997; lex: 747; sh: 606; java: 588; perl: 489; makefile: 370; tcl: 158; ruby: 55
file content (61 lines) | stat: -rw-r--r-- 1,435 bytes parent folder | download | duplicates (5)
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
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 10;
use mapscript;

sub msHas
{
	my ($mod) = @_;
	my $ver = mapscript::msGetVersion();
	if (index($ver, $mod) > -1) {
		return 1;
	} else {
		return 0;
	}
}

# we need to search up directories for the test folder
my $mapfile = '../../../msautotest/mspython/test_mapio.map';
if (! -e $mapfile)
{
	$mapfile = '../../../../msautotest/mspython/test_mapio.map';
}
ok(-e $mapfile, 'mapfile exists');

my $map = new mapscript::mapObj($mapfile);
ok($map, 'create mapObj');

mapscript::msIO_installStdoutToBuffer();
my $owreq = new mapscript::OWSRequest();
ok($owreq, 'create OWSRequest');
$owreq->loadParamsFromURL('service=WMS&version=1.1.1&request=GetMap&layers=grey&srs=EPSG:4326&bbox=-180,-90,180,90&format=image/png&width=80&height=40&STYLES=');
ok($owreq->getName(0) eq 'service');
ok($owreq->getValue(0) eq 'WMS');
ok($owreq->getValueByName('request') eq 'GetMap');

my $err = $map->OWSDispatch( $owreq );
ok($err == 0, 'OWSDispatch');

#	warn(mapscript::msGetErrorString("\n"));

my $h  = mapscript::msIO_getAndStripStdoutBufferMimeHeaders();
#my $k = $h->nextKey();
#while ($k)
#{
#	diag("$k == " . $h->get($k));
#	$k = $h->nextKey($k);
#}

ok($h->get('Cache-Control') eq 'max-age=86400');
ok($h->get('Content-Type') eq 'image/png');


my $x = mapscript::msIO_getStdoutBufferBytes();
#open(F, '>', 'x.png');
#print F $$x;
#close(F);

ok(substr($$x, 1, 3) eq 'PNG');