³ò
¡Hc        
   @   sµ   d  d k  Z  d  d k i Z d  d k  l Z d  d k Z d  d k Z d  d k Tg  d „ Z d d d f d d d f e d „ Z	 d e i
 f d „  ƒ  YZ e d	 j o e i ƒ  n d S(
   iÿÿÿÿN(   t   test_not_implemented(   t   *c         C   sc  |  i  ƒ  d } t i i | ƒ } | i |  d ƒ t i i ƒ  t i i ƒ  t } d } xê | oâ t i i	 ƒ  } xÌ | D]Ä } | i
 t j o
 t } n | i
 t j o” | i t t g j ot | i t j o | d 7} n | i t j o | d 8} n | | }  | i |  d ƒ t i i ƒ  t i i ƒ  q<t } qx qx Wq[ Wt i i ƒ  t i i ƒ  d  S(   Ni   i    i   (   i    i    (   i    i    (   t   get_rectt   pygamet   displayt   set_modet   blitt   flipt   eventt   pumpt   Truet   gett   typet   QUITt   Falset   KEYDOWNt   keyt   K_st   K_at   quitt   init(   t   st   imagest   sizet   screent   goingt   idxt   eventst   e(    (    sS   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test\transform_test.pyt
   show_image	   s0    
 

i    c         C   sn  | i  ƒ  | i ƒ  } } | o |  i | ƒ n y | \ } }	 }
 Wn% t j
 o | \ } }	 }
 } n Xy | \ } } } Wn% t j
 o | \ } } } } n Xd } xº t | ƒ D]¬ } x£ t | ƒ D]• } | i | | f ƒ } t | d | ƒ | j  t | d |	 ƒ | j  @t | d |
 ƒ | j  @o/ | o |  i | | f | ƒ n | d 7} qÍ qÍ Wqº W| S(   sQ    given the color it makes return_surf only have areas with the given colour.
    i    i   i   (   t	   get_widtht
   get_heightt   fillt
   ValueErrort   xranget   get_att   abst   set_at(   t   return_surft   surft   colort	   thresholdt
   diff_colort   change_returnt   widtht   heightt   rt   gt   bt   at   trt   tgt   tbt   tat   similart   yt   xt   c1(    (    sS   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test\transform_test.pyR)   $   s.      /t   TransformModuleTestc           B   s†   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z d „  Z RS(   c         C   s«   t  i d ƒ } | i d ƒ |  i | i ƒ  d ƒ t  i d ƒ } | i d ƒ t  i i | d ƒ } | i ƒ  } |  i | i ƒ  | i ƒ  ƒ |  i | i ƒ  | i ƒ  ƒ d S(   s/    see if set_alpha information is kept.
        i    i7   i@   N(   i    i    (   i    i    (   i@   i@   (   R   t   Surfacet	   set_alphat   assertEqualt	   get_alphat	   transformt   scalet   copy(   t   selfR   t   s2t   s3(    (    sS   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test\transform_test.pyt   test_scale__alphaN   s    c         C   sþ   t  i d ƒ } t  i i | d ƒ } | i ƒ  } t  i i | d | ƒ } t  i i | d | ƒ |  i t t  i i | d	 | ƒ t  i d
 ƒ } t  i i | d ƒ } | i ƒ  } t  i i | d | ƒ } t  i i | d | ƒ |  i t t  i i | d | ƒ d S(   sA    see if the destination surface can be passed in to use.
        i    i@   i!   N(   i    i    (   i@   i@   (   i@   i@   (   i@   i@   (   i!   i@   (   i    i    (   i@   i@   (   i@   i@   (   i@   i@   (   i!   i@   (   R   R;   R?   R@   RA   t   assertRaisesR!   t   smoothscale(   RB   R   RC   RD   (    (    sS   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test\transform_test.pyt   test_scale__destination^   s    c      
   C   s  d \ } } } d	 } d
 } d } t  i | t  i d ƒ } t  i | t  i d ƒ } t  i | t  i d ƒ }	 | i | ƒ |	 i | ƒ t  i i | | | | d d ƒ }
 |  i | | |
 ƒ t  i i | | d | d d |	 ƒ }
 |  i | | |
 ƒ d } t  i i | | d | | d |	 ƒ }
 |  i | | |
 ƒ | i ƒ  } | i } |  i | | ƒ x3 t	 i
 | ƒ D]" } |  i | i | ƒ | j ƒ qdWt  i i | | d d | d |	 ƒ }
 |  i d |
 ƒ | i ƒ  } | i } |  i | | ƒ x0 t	 i
 | ƒ D] } |  i | i | ƒ | ƒ qóWd  S(   Ni    i   i   i
   i    iÿ   i   (   i    i    (   i   i   i   i   (   i   i   i   i   (   i
   i
   i
   i
   (   iÿ   i
   i
   i
   (   R   R;   t   SRCALPHAR    R?   R)   R=   R   R   t
   test_utilst   rect_area_ptst   assert_R#   (   RB   t   wt   hR   R)   t   original_colort   threshold_colort   original_surfacet   dest_surfacet   third_surfacet   pixels_within_thresholdt   change_colort	   dest_rectt	   dest_sizet   pt(    (    sS   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test\transform_test.pyt$   test_threshold__honors_third_surfacex   sn    								  			 c      	   C   sè   d	 \ } } } t  i | t  i d ƒ } t  i | t  i d ƒ } | i d ƒ d d d d g } d d d d g } xp t t d ƒ ƒ D]\ } | }	 | }
 d |	 | <d |
 | <t  i i | | |	 |
 d d ƒ } |  i | | | ƒ q„ Wd  S(
   Ni   i    i    i   i   t   rgbi-   i2   (   i   i   (	   R   R;   RI   R    t   ranget   lenR?   R)   R=   (   RB   RM   RN   R   RQ   RR   t   threshold_color_templatet   threshold_templatet   posRP   R)   RT   (    (    sS   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test\transform_test.pyt   test_threshold__uneven_colorsð   s$     

			c         C   s  t  i i } t  i d ƒ } t  i d ƒ } t  i d ƒ } | i d ƒ | i d ƒ | | | d d d t ƒ } |  i | | i ƒ  | i ƒ  ƒ |  i | i	 d ƒ d ƒ | i d ƒ | i d ƒ | i
 d d ƒ | | | d d d t ƒ } |  i | | i ƒ  | i ƒ  d ƒ |  i | i	 d ƒ d ƒ |  i | i	 d  ƒ d! ƒ |  i | i	 d" ƒ d# ƒ | i d$ ƒ | i d% ƒ | | | d& d' d( t ƒ } |  i | | i ƒ  | i ƒ  ƒ | i d) ƒ | i d* ƒ | i
 d+ d, ƒ | | | d- d. d/ t ƒ } |  i | | i ƒ  | i ƒ  d ƒ d S(0   s	   
        i    i   i(   iÿ   i   i   i    iª   i   i    id   N(   i    i    (   i    i    (   i   i   (   i(   i(   i(   (   iÿ   iÿ   iÿ   (   i   i   i   (   i   i   i   (   iÿ   i    i    (   i    i    (   i(   i(   i(   iÿ   (   i(   i(   i(   (   iÿ   iÿ   iÿ   (   i    i    (   iª   iª   iª   (   i   i   i   (   i   i   i   (   i    i    i    (   i    i    (   i    i    i    iÿ   (   i    i   (   i(   i(   i(   iÿ   (   i   i   (   i(   i(   i(   iÿ   (   i    i    i    (   iÿ   iÿ   iÿ   (   iÿ   iÿ   iÿ   (   id   id   id   (   i    i    i    (   i(   i(   i(   (   iÿ   iÿ   iÿ   (   i    i    (   iª   iª   iª   (   i   i   i   (   i   i   i   (   i    i    i    (   R   R?   R)   R;   R    R
   R=   R   R   R#   R%   R   (   RB   R)   t   s1RC   RD   t   num_threshold_pixels(    (    sS   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test\transform_test.pyt   test_threshold__surface  s4     $ c         C   s`  d } t  i | | f ƒ } t  i | | f ƒ } | i d
 ƒ t  i i | d d d ƒ t  i i | d d d ƒ t  i i | | ƒ |  i | i d ƒ d ƒ |  i | i d ƒ d ƒ |  i | i d ƒ d ƒ |  i | i d ƒ d ƒ t  i i | ƒ } |  i | i d ƒ d ƒ |  i | i d ƒ d ƒ |  i | i d ƒ d ƒ |  i | i d ƒ d  ƒ d	 S(!   s	   
        i    i
   iF   iÿ   i    i   i   i   N(   i
   i
   iF   (   iÿ   i    i    (   i   i
   (   i   i   (   iÿ   i    i    (   i    i   (   i   i   (   i    i    (   i    i    i    iÿ   (   i   i
   (   iÿ   i    i    iÿ   (   i    i   (   iÿ   i    i    iÿ   (   i   i   (   iÿ   i    i    iÿ   (   i    i    (   i    i    i    iÿ   (   i   i
   (   iÿ   i    i    iÿ   (   i    i   (   iÿ   i    i    iÿ   (   i   i   (   iÿ   i    i    iÿ   (	   R   R;   R    t   drawt   lineR?   t	   laplacianR=   R#   (   RB   t   SIZERa   RC   (    (    sS   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test\transform_test.pyt   test_laplacianI  s     c         C   s  d } t  i | | f ƒ } t  i | | f ƒ } t  i | | f ƒ } | i d ƒ | i d ƒ | i d ƒ | | | g } | | g } t  i i | ƒ } |  i | i d ƒ d ƒ |  i t t  i i d	 ƒ |  i t t  i i g  ƒ |  i t t  i i d	 g ƒ |  i t t  i i | d	 g ƒ |  i t t  i i d	 | g ƒ |  i t t  i i | | d	 g ƒ |  i t t  i i d
 „  | | | g Dƒ ƒ d S(   s	   
        i    i
   iF   i   i‚   i    i   iÿ   i   c         s   s   x |  ] } | Vq Wd  S(   N(    (   t   .0R   (    (    sS   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test\transform_test.pys	   <genexpr>…  s    N(   i
   i
   iF   (   i
   i   iF   (   i
   i‚   i
   (   i    i    (   i
   i   iF   iÿ   (	   R   R;   R    R?   t   average_surfacesR=   R#   RF   t	   TypeError(   RB   Rg   Ra   RC   RD   t   surfacest   sr(    (    sS   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test\transform_test.pyt   test_average_surfacesj  s$    "c         C   s   |  i  t ƒ  ƒ d  S(   N(   RL   R    (   RB   (    (    sS   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test\transform_test.pyt	   test_chopˆ  s    c         C   s   |  i  t ƒ  ƒ d  S(   N(   RL   R    (   RB   (    (    sS   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test\transform_test.pyt	   test_flip‘  s    c         C   s   |  i  t ƒ  ƒ d  S(   N(   RL   R    (   RB   (    (    sS   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test\transform_test.pyt   test_rotateš  s    c         C   sÃ   d \ } } t  i | | f t  i ƒ } t t i | | ƒ ƒ } x$ | D] \ } } | i | | ƒ qF Wx# d D] } t  i i | | ƒ } qm Wx0 | D]( \ } } |  i	 | i
 | ƒ | j ƒ q“ Wd  S(   Ni    iZ   i¦ÿÿÿ(   i    i    (   iZ   i¦ÿÿÿ(   R   R;   RI   t   listRJ   t   gradientR%   R?   t   rotateRL   R#   (   RB   RM   RN   R   Rs   RX   R(   t   rotation(    (    sS   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test\transform_test.pyt#   test_rotate__lossless_at_90_degrees¬  s        c         C   s   |  i  t ƒ  ƒ d  S(   N(   RL   R    (   RB   (    (    sS   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test\transform_test.pyt   test_rotozoomº  s    c         C   s   |  i  t ƒ  ƒ d  S(   N(   RL   R    (   RB   (    (    sS   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test\transform_test.pyt   test_scale2xÃ  s    c         C   s   |  i  t ƒ  ƒ d  S(   N(   RL   R    (   RB   (    (    sS   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test\transform_test.pyt   test_smoothscaleÌ  s    (   t   __name__t
   __module__RE   RH   RY   R`   Rc   Rh   Rn   Ro   Rp   Rq   Rv   Rw   Rx   Ry   (    (    (    sS   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test\transform_test.pyR:   M   s   			x		:	!											t   __main__(   RJ   t   test.unittestt   unittestR    R   t   pygame.transformt   pygame.localsR   R
   R)   t   TestCaseR:   Rz   t   main(    (    (    sS   C:\cygwin\home\rene\pygame_mingw32_compile_pack\PyGame\trunk\test\transform_test.pys   <module>   s   
$)ÿ ‰