Annotation of embedaddon/php/ext/gd/tests/dashedlines.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: imageline, dashed
! 3: --SKIPIF--
! 4: <?php
! 5: if (!function_exists('imagecreatefromstring')) die("skip gd extension not available\n");
! 6: ?>
! 7: --FILE--
! 8: <?php
! 9: $im = imagecreatetruecolor(6,6);
! 10: imagefill($im, 0,0, 0xffffff);
! 11:
! 12: $r = 0xff0000;
! 13: $b = 0x0000ff;
! 14:
! 15: $style = array($r, $b);
! 16: imagesetstyle($im, $style);
! 17:
! 18: // Horizontal line
! 19: imageline($im, 0,5, 5,5, IMG_COLOR_STYLED);
! 20: $p1 = imagecolorat($im, 0,5) == $r;
! 21: $p2 = imagecolorat($im, 1,5) == $b;
! 22: $p3 = imagecolorat($im, 2,5) == $r;
! 23: $p4 = imagecolorat($im, 3,5) == $b;
! 24: $p5 = imagecolorat($im, 4,5) == $r;
! 25: $p5 = imagecolorat($im, 5,5) == $b;
! 26:
! 27:
! 28: if ($p1 && $p2 && $p3 && $p4 && $p5) {
! 29: echo "Horizontal: ok\n";
! 30: }
! 31: imagedestroy($im);
! 32:
! 33: $im = imagecreatetruecolor(6,6);
! 34: imagefill($im, 0,0, 0xffffff);
! 35:
! 36: $style = array($r, $b);
! 37: imagesetstyle($im, $style);
! 38:
! 39:
! 40: imageline($im, 2,0, 2,5, IMG_COLOR_STYLED);
! 41: $p1 = imagecolorat($im, 2,0) == $r;
! 42: $p2 = imagecolorat($im, 2,1) == $b;
! 43: $p3 = imagecolorat($im, 2,2) == $r;
! 44: $p4 = imagecolorat($im, 2,3) == $b;
! 45: $p5 = imagecolorat($im, 2,4) == $r;
! 46: $p6 = imagecolorat($im, 2,5) == $b;
! 47:
! 48: if ($p1 && $p2 && $p3 && $p4 && $p5 && $p6) {
! 49: echo "Vertical: ok\n";
! 50: }
! 51: imagedestroy($im);
! 52:
! 53:
! 54: $im = imagecreatetruecolor(6,6);
! 55: imagefill($im, 0,0, 0xffffff);
! 56:
! 57: $style = array($r, $b);
! 58: imagesetstyle($im, $style);
! 59:
! 60: imageline($im, 0,0, 5,5, IMG_COLOR_STYLED);
! 61: $p1 = imagecolorat($im, 0,0) == $r;
! 62: $p2 = imagecolorat($im, 1,1) == $b;
! 63: $p3 = imagecolorat($im, 2,2) == $r;
! 64: $p4 = imagecolorat($im, 3,3) == $b;
! 65: $p5 = imagecolorat($im, 4,4) == $r;
! 66: $p6 = imagecolorat($im, 5,5) == $b;
! 67:
! 68: if ($p1 && $p2 && $p3 && $p4 && $p5 && $p6) {
! 69: echo "Diagonal: ok\n";
! 70: }
! 71: imagedestroy($im);
! 72:
! 73:
! 74: ?>
! 75: --EXPECTF--
! 76: Horizontal: ok
! 77: Vertical: ok
! 78: Diagonal: ok
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>