
    &h#                     <   S SK r S SKr\ R                  R                  S5      S:X  a  SrS SKrS SKJr  S SKrS SKJ	r	   " S S\R                  5      r " S	 S
\R                  5      r " S S\R                  5      rSS jrS r\S:X  a  \R"                  " 5         gg)    NSDL_VIDEODRIVERdummy)ignoresubprocess_ignore)trunk_relative_path)scrapc                       \ rS rSr\S 5       r\S 5       rS rS rS r	S r
S rS	 rS
 rS rS rS r\R$                  " S\R(                  ;  S5      S 5       rS rSrg)ScrapModuleTest   c                     [         R                  R                  5         [         R                  R                  S5        [        R                  " 5         g N)   r   pygamedisplayinitset_moder   clss    O/var/www/auris/envauris/lib/python3.13/site-packages/pygame/tests/scrap_test.py
setUpClassScrapModuleTest.setUpClass   -    '

    c                 @    [         R                  R                  5         g N)r   r   quitr   s    r   tearDownClassScrapModuleTest.tearDownClass   s     	r   c                     [         R                  " 5         [         R                  " 5         U R                  [         R                  " 5       5        g)zAEnsures scrap module still initialized after multiple init calls.N)r   r   
assertTrueget_initselfs    r   	test_initScrapModuleTest.test_init   s'    



()r   c                     [         R                  nSn[        R                  " X5        [        R                  " 5         U R                  [        R                  " U5      U5        g)z?Ensures reinitializing the scrap module doesn't clear its data.s   test_init__reinitN)r   
SCRAP_TEXTr   putr   assertEqualget)r$   	data_typeexpected_datas      r   test_init__reinit!ScrapModuleTest.test_init__reinit    s@    %%	,		)+

9-}=r   c                 L    U R                  [        R                  " 5       5        g)z%Ensures get_init gets the init state.N)r!   r   r"   r#   s    r   test_get_initScrapModuleTest.test_get_init*   s    ()r   c                 $    U R                  5         g)z#Ensures contains works as expected.Nfailr#   s    r   todo_test_contains"ScrapModuleTest.todo_test_contains.       		r   c                 $    U R                  5         g)zEnsures get works as expected.Nr4   r#   s    r   todo_test_getScrapModuleTest.todo_test_get2   r8   r   c                 *   Sn[         R                  " 5       (       aP  [         R                  " [        R                  S5        [         R                  " 5       (       a  U R                  S5        [         R                  " U5      nU R                  U5        g)zEnsures get works when there is no data of the requested type
in the clipboard and the clipboard is owned by the pygame application.
test_get__owned_empty_types   text to clipboardz4requires the pygame application to own the clipboardN)r   lostr)   r   r(   skipTestr+   assertIsNoner$   	DATA_TYPEdatas      r   r=   *ScrapModuleTest.test_get__owned_empty_type6   s]     1	::<<IIf'')=>zz||TUyy#$r   c                 $    U R                  5         g)z$Ensures get_types works as expected.Nr4   r#   s    r   todo_test_get_types#ScrapModuleTest.todo_test_get_typesI   r8   r   c                 $    U R                  5         g)zEnsures lost works as expected.Nr4   r#   s    r   todo_test_lostScrapModuleTest.todo_test_lostM   r8   r   c                     [         R                  " [        R                  5        [         R                  " [        R                  5        U R                  [        [         R                  S5        g)z#Ensures set_mode works as expected.iK  N)r   r   r   SCRAP_SELECTIONSCRAP_CLIPBOARDassertRaises
ValueErrorr#   s    r   test_set_modeScrapModuleTest.test_set_modeQ   s<    v--.v--.*ennd;r   c                 h   [         R                  " [        R                  S5        U R	                  [         R
                  " [        R                  5      S5        [         R                  " [        R                  S5        U R	                  [         R
                  " [        R                  5      S5        g)z.Ensures put can place text into the clipboard.s   Hello worlds   Another StringN)r   r)   r   r(   r*   r+   r#   s    r   test_put__textScrapModuleTest.test_put__textX   sj    		&##^46#4#45~F		&##%676#4#457HIr   zpygame.imagezrequires pygame.image modulec                 F   [         R                  R                  [        S5      5      n[         R                  R	                  US5      n[
        R                  " [         R                  U5        U R                  [
        R                  " [         R                  5      U5        g)z5Ensures put can place a BMP image into the clipboard.zexamples/data/asprite.bmpRGBAN)
r   imageloadr   tostringr   r)   	SCRAP_BMPr*   r+   )r$   sfexpected_strings      r   test_put__bmp_image#ScrapModuleTest.test_put__bmp_imageb   sh     \\23NOP ,,//F;		&""O46#3#34oFr   c                     Sn[         R                  " US5        [         R                  " U5      nU R                  US5        g)zYEnsures put can place data into the clipboard
when using a user defined type identifier.
zarbitrary buffers   bufN)r   r)   r+   r*   )r$   rB   rs      r   test_putScrapModuleTest.test_putk   s5     '			)V$IIi F#r    N)__name__
__module____qualname____firstlineno__classmethodr   r   r%   r.   r1   r6   r:   r=   rF   rI   rP   rS   unittestskipIfsysmodulesr]   ra   __static_attributes__rc   r   r   r
   r
      s     
  *>* &<J __^3;;68VWG XG	$r   r
   c                   V    \ rS rSrSr\S 5       r\S 5       rS rS r	S r
S rS	 rS
rg) ScrapModuleClipboardNotOwnedTestw   zTest the scrap module's functionality when the pygame application is
not the current owner of the clipboard.

A separate class is used to prevent tests that acquire the clipboard from
interfering with these tests.
c                     [         R                  R                  5         [         R                  R                  S5        [        R                  " 5         g r   r   r   s    r   r   +ScrapModuleClipboardNotOwnedTest.setUpClass   r   r   c                 j    [         R                  " 5         [         R                  R                  5         g r   )r   r   r   r   s    r   r   .ScrapModuleClipboardNotOwnedTest.tearDownClass   s     	r   c                 \    [         R                  " 5       (       d  U R                  S5        g g )Nz8requires the pygame application to not own the clipboard)r   r>   r?   r#   s    r   _skip_if_clipboard_owned9ScrapModuleClipboardNotOwnedTest._skip_if_clipboard_owned   s!     zz||MMTU r   c                 v    U R                  5         Sn[        R                  " U5      nU R                  U5        g)zEnsures get works when there is no data of the requested type
in the clipboard and the clipboard is not owned by the pygame
application.
test_get__not_ownedN)rv   r   r+   r@   rA   s      r   ry   4ScrapModuleClipboardNotOwnedTest.test_get__not_owned   s3    
 	%%' *	yy#$r   c                 z    U R                  5         [        R                  " 5       nU R                  U[        5        g)zSEnsures get_types works when the clipboard is not owned
by the pygame application.
N)rv   r   	get_typesassertIsInstancelist)r$   
data_typess     r   test_get_types__not_owned:ScrapModuleClipboardNotOwnedTest.test_get_types__not_owned   s,     	%%'__&
j$/r   c                 v    U R                  5         Sn[        R                  " U5      nU R                  U5        g)zREnsures contains works when the clipboard is not owned
by the pygame application.
test_contains__not_ownedN)rv   r   containsassertFalse)r$   rB   r   s      r   r   9ScrapModuleClipboardNotOwnedTest.test_contains__not_owned   s3     	%%' /	>>),"r   c                 p    U R                  5         [        R                  " 5       nU R                  U5        g)zNEnsures lost works when the clipboard is not owned
by the pygame application.
N)rv   r   r>   r!   )r$   r>   s     r   test_lost__not_owned5ScrapModuleClipboardNotOwnedTest.test_lost__not_owned   s'     	%%'zz|r   rc   N)rd   re   rf   rg   __doc__rh   r   r   rv   ry   r   r   r   rm   rc   r   r   ro   ro   w   sI      
  
V 0#r   ro   c                       \ rS rSrSS/r \R                  R                  5         \R                  R                  5       S:X  a  S/r\R                  R                  5         S rSrg! \
 a     Nf = f)	X11InteractiveTest   r   r   x11interactivec                 8   SSK JnJnJn  SSKJnJn  SSKJnJnJ	n  Sn	UR                  5         UR                  SS5      n
UR                  5         UR                  S5        UR                  S	5      nUR                  [         R                  " S
5      5        SnSR!                  U5      n[#        XU
S5        UR%                  5         UR'                  5         [(        R                  " 5         [(        R                  " U5        [(        R*                  " X\R-                  S5      5         UR/                  5       nUR0                  U:X  a  O"UR0                  U:X  a  UR2                  U:H  n	OMC  [         R                  R5                  5         U R7                  U	5        g)zPATCH: pygame.scrap on X11, fix copying into PRIMARY selection

Copying into theX11 PRIMARY selection (mouse copy/paste) would not
work due to a confusion between content type and clipboard type.

r   )r   eventfreetype)rL   r(   )KEYDOWNK_yQUITFN   zInteractive X11 Paste Test)iX     whitezScrap put() succeeded.zSome text has been placed into the X11 clipboard. Please click the center mouse button in an open text window to retrieve it.

Did you get "{}"? (y/n)   zUTF-8)r   r   r   r   pygame.localsrL   r(   r   r   r   r   Fontset_captionr   fillColorformat	word_wrapflippumpr   r)   encodewaittypekeyr   r!   )r$   r   r   r   rL   r(   r   r   r   successfontscreentextmsges                  r   test_issue_208!X11InteractiveTest.test_issue_208   s-    	43=44}}T2&89!!*-FLL)*'* &, 	 	&tQ'



'		*kk'23

Avv~vv %%3,  	 r   rc   N)rd   re   rf   rg   __tags__r   r   r   
get_driverr   	Exceptionr   rm   rc   r   r   r   r      si    -.H >>$$&%/%H(!  s   A' 'A0/A0r   c                 n   SUl         U R                  5       u  pVUSU-  -
  nUSU-  -
  n[        SUR                  5       -  5      n	X3U	-   pUR	                  S5      n[        U5       H  nUS:X  a  X;U	-   pM  UR	                  U5      nXR                  -   UR                  -   U:  a  X;U	-   pXR                  -   UR                  -   U:  a  [        S5      eXR                  -   UR                  -
  U:  a  [        S5      eUR                  X
U4S U5        XR                  UR                  -   -  n
M     X4$ )NT   g      ? 
zword too wide for the surfaceztext to long for the surface)originget_sizeintget_sized_heightget_rectiwordswidthxrO   heighty	render_to)surfr   r   margincolor
surf_widthsurf_heightr   r   line_spacingr   r   spacewordboundss                  r   r   r      s,   DK"mmoJV#E1v:%Ftd33556LL(qMM#Et4<|+q]]4(F<<&((*e3</1<<&((*e3 !@AA== 688+v5 !?@@NN4Qu5++A  4Kr   c              #     #    SnUn[        U 5      nX:  ag  X   S:X  a  US-  nUS-   nOLX   S:X  a  US-  nSv   US-   nO5X#:X  a	  XS  v   UnO'X   S:X  a	  XU v   UnOX   S:X  a	  XU v   UnOUS-  nX:  a  Mf  g g 7f)Nr   r   r   r   )len)r   headtailends       r   r   r     s      DD
d)C
*:AID!8DZ4AIDJ!8D[u+DZ4D/!DZ3D/!DAID% *s   A9A?=A?__main__)r   )r   r   r   )osrk   environr+   r   ri   pygame.tests.test_utilsr   r   r   TestCaser
   ro   r   r   r   rd   mainrc   r   r   <module>r      s    	 
::>>#$/.H  7  g$h'' g$TIx'8'8 IX3!** 3!l06 zMMO r   