moriyoshi               Thu Nov 21 12:26:18 2002 EDT

  Added files:                 
    /php4/ext/gd/tests  imagettftext.phpt test8859.ttf 
  Log:
  Added a test case for imagettftext()
  
  
Index: php4/ext/gd/tests/imagettftext.phpt
+++ php4/ext/gd/tests/imagettftext.phpt
--TEST--
imagettftext() function test
--SKIPIF--
<?php 
        if (!extension_loaded('gd')) {
                die("skip gd extension not avaliable.");
        }
        if (!function_exists("imagettftext")) {
                die("skip imagettftext() not available.");
        }
?>
--FILE--
<?php
        $cwd = dirname(__FILE__);
        $fontfile_8859 = "$cwd/test8859.ttf";

        function testrun($im, $fontfile) {
                $sx = imagesx($im);
                $sy = imagesy($im);

                $colour_w = imagecolorallocate($im, 255, 255, 255);
                $colour_b = imagecolorallocate($im, 0, 0, 0);

                imagefilledrectangle($im, 0, 0, $sx - 1, $sy - 1, $colour_b);
                imagettftext($im, $sy * 0.75, 0, 0, $sy - 1, $colour_w, $fontfile, 
"A");

                $cnt = 0;
                for ($y = 0; $y < $sy; ++$y) {
                        for ($x = 0; $x < $sx; ++$x) {
                                if (imagecolorat($im, $x, $y) == $colour_b) {
                                        ++$cnt;
                                }
                        }
                }

                // imagecolordeallocate($im, $colour_w);
                // imagecolordeallocate($im, $colour_b);

                return ($cnt < ($sx * $sy));
        }

        $im = imagecreate(256, 256);
        var_dump(testrun($im, $fontfile_8859));
        imagedestroy($im);

        $im = imagecreatetruecolor(256, 256);
        var_dump(testrun($im, $fontfile_8859));
        imagedestroy($im);
?>
--EXPECT--
bool(true)
bool(true)

Index: php4/ext/gd/tests/test8859.ttf
+++ php4/ext/gd/tests/test8859.ttf
�`OS/2���`cmap�7*���cvt 
��fpgmR���gasp�glyf$���(��headaw�6hhea�b$$hmtx��%<tlocaw�!�xmaxp�BH
 naméB��post��0h 
prep%>�t�33;ӑQ_<��ppp�p0���
  
��0�p�4     
Take@ !"p�pp�@����  
�
       
                          
 public 
domaintestRegulartesttest1.00testtestpublic
 
domaintestRegulartesttest1.00testtest��
     
 
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~�,/�-�,/�<-�,/�<<-�,/�<<<-�,/<�-�,/<�<-�,/<�<<-�,/<�<<<-�,/<<�-�
      ,/<<�<-�
,/<<�<<-�,/<<�<<<-�
,/<<<�-�,/<<<�<-�,/<<<�<<-�,/<<<�<<<-�,<-�,/�*�-�,/��*-�,/�*��*-�������ED��ED��ED��ED��ED��ED��ED��ED�
        �ED�
�ED��ED�
�ED��ED��ED��ED��ED��ED��ED��ED��ED��ED��ED��ED��ED��ED��ED��ED��ED��ED��ED��ED�
 
�ED�!�ED�"�ED�#�ED�$�ED�%�ED�&�ED�'�ED�(�ED�)�ED�*�ED�+�ED�,�ED�-�ED�.�ED�/�ED�0�ED�1�ED�2�ED�3�ED�4�ED�5�ED�6�ED�7�ED�8�ED�9�ED�:�ED�;�ED�<�ED�=�ED�>�ED�?�ED�@�ED�A�ED�B�ED�C�ED�D�ED�E�ED�F�ED�G�ED�H�ED�I�ED�J�ED�K�ED�L�ED�M�ED�N�ED�O�ED�P�ED�Q�ED�R�ED�S�ED�T�ED�U�ED�V�ED�W�ED�X�ED�Y�ED�Z�ED�[�ED�\�ED�]�ED�^�ED�_�ED�`�ED�a�ED�b�ED�c�ED�d�ED�e�ED�f�ED�g�ED�h�ED�i�ED�j�ED�k�ED�l�ED�m�ED�n�ED�o�ED�p�ED�q�ED�r�ED�s�ED�t�ED�u�ED�v�ED�w�ED�x�ED�y�ED�z�ED�{�ED�|�ED�}�ED�~�ED��ED
  
 
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`�abcdefghijklmnopqrstuvwxyz{|}~��������������������������������������������������������������������������������������������������(
 ~�Sax~���    " & 0 : �!""�� �R`x}���      & 0 9 
�!""�������o�c�M�I�6������������.߹���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������0��2�53�d�dd0���`
        @0h
 +++�0    
@++01353'533533/#57#'3#0@��h880@80X�l$p`P�p�Ѐ@@���``�`P��
���0
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to