~ubuntu-branches/ubuntu/lucid/php5/lucid

« back to all changes in this revision

Viewing changes to ext/gd/tests/libgd00100.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-03-16 09:09:50 UTC
  • mfrom: (1.1.18 upstream) (0.3.10 sid)
  • Revision ID: james.westby@ubuntu.com-20100316090950-e36m0pzranoixifd
Tags: 5.3.2-1ubuntu1
* Merge from debian unstable: 
  - debian/control:
    * Dropped firebird2.1-dev, libc-client-dev, libmcrypt-dev as it is in universe.
    * Dropped libmysqlclient15-dev, build against mysql 5.1.
    * Dropped libcurl-dev not in the archive.
    * Suggest php5-suhosin rather than recommends.
    * Dropped php5-imap, php5-interbase, php5-mcrypt since we have versions already in
      universe.
    * Dropped libonig-dev and libqgdbm since its in universe. (will be re-added in lucid+1)
    * Dropped locales-all.
  - modulelist: Drop imap, interbase, and mcrypt.
  - debian/rules:
    * Dropped building of mcrypt, imap, and interbase.
    * Install apport hook for php5.
  - Dropped debian/patches/libedit_is_editline.patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--TEST--
 
2
libgd #100 (spurious horizontal line drawn by gdImageFilledPolygon)
 
3
--SKIPIF--
 
4
<?php
 
5
        if (!extension_loaded('gd')) die("skip gd extension not available\n");
 
6
        if (!GD_BUNDLED) die("skip requires bundled GD library\n");
 
7
?>
 
8
--FILE--
 
9
<?php
 
10
$im = imagecreatetruecolor(256, 256);
 
11
 
 
12
$white   = imagecolorallocatealpha($im, 255, 255, 255, 10);
 
13
$black   = imagecolorallocatealpha($im,   0,   0,   0, 10);
 
14
$red     = imagecolorallocatealpha($im, 255,   0,   0, 10);
 
15
$green   = imagecolorallocatealpha($im,   0, 255,   0, 10);
 
16
$blue    = imagecolorallocatealpha($im,   0,   0, 255, 10);
 
17
$yellow  = imagecolorallocatealpha($im, 255, 255,   0, 10);
 
18
$cyan    = imagecolorallocatealpha($im,   0, 255, 255, 10);
 
19
$magenta = imagecolorallocatealpha($im, 255,   0, 255, 10);
 
20
$purple  = imagecolorallocatealpha($im, 100,   0, 100, 10);
 
21
 
 
22
imagefilledrectangle($im, 0, 0, 255, 255, $white);
 
23
 
 
24
// M (bridge)
 
25
$top = 240;
 
26
$bot = 255;
 
27
$d = 30;
 
28
$x = 100;
 
29
$points = array(
 
30
  $x,      $top,
 
31
  $x+2*$d, $top,
 
32
  $x+2*$d, $bot,
 
33
  $x+$d,   ($top+$bot)/2,
 
34
  $x,      $bot
 
35
);
 
36
imagefilledpolygon($im, $points, 5, $yellow);
 
37
 
 
38
// left-facing M not on baseline
 
39
$top = 40;
 
40
$bot = 70;
 
41
$left = 120;
 
42
$right = 180;
 
43
$points = array(
 
44
  $left,  $top,
 
45
  $right, $top,
 
46
  $right, $bot,
 
47
  $left,  $bot,
 
48
  ($left+$right)/2, ($top+$bot)/2
 
49
);
 
50
imagefilledpolygon($im, $points, 5, $purple);
 
51
 
 
52
// left-facing M on baseline
 
53
$top = 240;
 
54
$bot = 270;
 
55
$left = 20;
 
56
$right = 80;
 
57
$points = array(
 
58
  $left,  $top,
 
59
  $right, $top,
 
60
  $right, $bot,
 
61
  $left,  $bot,
 
62
  ($left+$right)/2, ($top+$bot)/2
 
63
);
 
64
imagefilledpolygon($im, $points, 5, $magenta);
 
65
 
 
66
// left-facing M on ceiling
 
67
$top = -15;
 
68
$bot = 15;
 
69
$left = 20;
 
70
$right = 80;
 
71
$points = array(
 
72
  $left,  $top,
 
73
  $right, $top,
 
74
  $right, $bot,
 
75
  $left,  $bot,
 
76
  ($left+$right)/2, ($top+$bot)/2
 
77
);
 
78
imagefilledpolygon($im, $points, 5, $blue);
 
79
 
 
80
$d = 30;
 
81
$x = 150;
 
82
$y = 150;
 
83
$diamond = array($x-$d, $y, $x, $y+$d, $x+$d, $y, $x, $y-$d);
 
84
imagefilledpolygon($im, $diamond, 4, $green);
 
85
 
 
86
$x = 180;
 
87
$y = 225;
 
88
$diamond = array($x-$d, $y, $x, $y+$d, $x+$d, $y, $x, $y-$d);
 
89
imagefilledpolygon($im, $diamond, 4, $red);
 
90
 
 
91
$x = 225;
 
92
$y = 255;
 
93
$diamond = array($x-$d, $y, $x, $y+$d, $x+$d, $y, $x, $y-$d);
 
94
imagefilledpolygon($im, $diamond, 4, $cyan);
 
95
 
 
96
// M (bridge) not touching bottom boundary
 
97
$top = 100;
 
98
$bot = 150;
 
99
$x = 30;
 
100
$points = array(
 
101
  $x,      $top,
 
102
  $x+2*$d, $top,
 
103
  $x+2*$d, $bot,
 
104
  $x+$d,   ($top+$bot)/2,
 
105
  $x,      $bot
 
106
);
 
107
imagefilledpolygon($im, $points, 5, $black);
 
108
 
 
109
ob_start();
 
110
imagepng($im);
 
111
$png = ob_get_contents();
 
112
ob_end_clean();
 
113
 
 
114
echo md5($png);
 
115
 
 
116
imagedestroy($im);
 
117
?>
 
118
--EXPECTF--
 
119
2e6cf558bb4dadf60c8b608d5f8cda4e