File: rrd_019.phpt

package info (click to toggle)
php-rrd 2.0.3%2B1.1.3-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 496 kB
  • sloc: ansic: 2,447; xml: 665; makefile: 58; php: 3
file content (55 lines) | stat: -rw-r--r-- 1,141 bytes parent folder | download | duplicates (10)
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
--TEST--
RRDGraph saveVerbose full export test
--SKIPIF--
<?php
include('skipif.inc');
include('data/definition.inc');
if (!file_exists($data_updatedDb)) {
	die("skip $data_updatedDb doesn't exist");
}
?>
--FILE--
<?php
include('data/definition.inc');
$rrdFile = $data_updatedDb;
$outputPngFile = "-";
$graphObj = new RRDGraph($outputPngFile);
$graphObj->setOptions(array(
	"--start" => "920804400",
	"--end" => 920808000,
	"--vertical-label" => "m/s",
	"DEF:myspeed=$rrdFile:speed:AVERAGE",
	"CDEF:realspeed=myspeed,1000,*",
	"LINE2:realspeed#FF0000"
));
$output = $graphObj->saveVerbose();
$imgData = $output["image"]; unset($output["image"]);
//output without img data
var_dump($output);
//detection of correct PNG header
var_dump(substr($imgData, 0, 8) == "\x89PNG\x0d\x0a\x1a\x0a");
?>
--EXPECTF--
array(10) {
  ["graph_left"]=>
  int(67)
  ["graph_top"]=>
  int(%d)
  ["graph_width"]=>
  int(400)
  ["graph_height"]=>
  int(100)
  ["image_width"]=>
  int(497)
  ["image_height"]=>
  int(%d)
  ["graph_start"]=>
  int(920804400)
  ["graph_end"]=>
  int(920808000)
  ["value_min"]=>
  float(0)
  ["value_max"]=>
  float(40)
}
bool(true)