
    daf5                     J   d dl Z d dlZd dlZd dlZd dlmZ d dlmZmZ  ej                  d        G d deej                        Z G d deej                        Z G d	 d
eej                        Z G d deej                        ZddZedk(  r ej"                          yy)    N)support)AbstractTkTestAbstractDefaultRootTestguic                   r    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d Zd Zd Zd Zy)MiscTestc                    | j                  dt        j                         | j                  dt        j                         | j                  t        j                         | j                  dt        j                         | j                  dt        j                         | j                  dt        j                         | j                  dt        j                         | j                  dt        j                         y )NWidgetCASCADEresys	constants_tkerrorwantobjects)assertIntkinter__all__assertIsNotNoner   assertNotIn)selfs    6/root/Python-3.12.4/Lib/test/test_tkinter/test_misc.pytest_allzMiscTest.test_all   s    h0i1W__-w/0goo6W__58    c                     t        j                  | j                  d      }t        j                  |d      }| j	                  t        |      d       y )Ntop)namechildz!<tkinter.Frame object .top.child>)r   ToplevelrootFrameassertEqualrepr)r   tfs      r   	test_reprzMiscTest.test_repr   s=    TYYU3MM!'*a"EFr   c                 R   t        j                  | j                        }t        j                  |      }t        j                  |      }t        j                  |      }t        |      j                  d      D ],  }| j                  |j                         t        |             . y )N.)msg)
r   r   r   r    ButtonstrsplitassertFalseisidentifierr"   )r   r#   r$   f2br   s         r   test_generated_nameszMiscTest.test_generated_names   s~    TYY'MM!]]1NN2FLL% 	BDT..0d4jA	Br   c                 \   | j                   }|j                  d       | j                  |d   d       |j                  d       | j                  |d   d       | j                  t        j
                  d|j                  d       |j                  d       | j                  |d   d       |j                  dd	       | j                  |d   d       | j                  |d
   d       |j                  dd	       | j                  |d   d       | j                  |d
   d       | j                  t        j
                  d|j                  d       | j                  t        j
                  d|j                  d       | j                  t        j
                  d|j                  d       y )Nblack
backgroundwhitez^unknown color name "spam"$spam)r3   blueyellow)r3   highlightColorhighlightcolorz!^must specify a background color$)r5   )r8   )r   tk_setPaletter!   assertRaisesRegexr   TclErrorr   r   s     r   test_tk_setPalettezMiscTest.test_tk_setPalette'   s   yy7#l+W57#l+W5w//-""F	, 	g.l+W5fXFl+V4./:hvFl+X6./8w//-""v 	 	7 	w//3"" 	 	2 	w//3""6 	 	;r   c                    | j                   }d
fd	}| j                  |j                  d             d|j                  d|      }| j                  ||j                  j                  dd             |j                  j                  |j                  j                  dd|            \  }}|j                          | j                  d       | j                  t        j                        5  |j                  j                  |       d d d        d|j                  d|dd      }|j                          | j                  d       |j                  d	|      }| j                  ||j                  j                  dd             |j                  j                  |j                  j                  dd|            \  }}|j                  |       | j                  d       | j                  t        j                        5  |j                  j                  |       d d d        d|j                  dt        j                  |dd            }|j                          | j                  d       y # 1 sw Y   kxY w# 1 sw Y   bxY w)Nr      c                     | |z   y N startstepcounts     r   callbackz%MiscTest.test_after.<locals>.callbackF       DLEr   afterinfo*      5   i  r   r@   )r   assertIsNonerJ   r   tkcall	splitlistupdater!   assertRaisesr   r<   after_cancel	functoolspartial)r   r   rH   timer1script_rG   s         @r   
test_afterzMiscTest.test_afterC   s   yy	!
 	$**Q-( Ax(fdggll7F;<gg''Wff(MN"w//0 	!GGLL 	! AxR0# D(+fdggll7F;<gg''Wff(MN&!#w//0 	!GGLL 	! Ay002rBC#-	! 	!	! 	!s   .I3J 3I= J	c                 <   | j                   }d	fd	}d|j                  |      }| j                  ||j                  j	                  dd             |j                  j                  |j                  j	                  dd|            \  }}|j                          | j                  d       | j                  t        j                        5  |j                  j	                  |       d d d        d|j                  |dd      }|j                          | j                  d       |j                  |      }| j                  ||j                  j	                  dd             |j                  j                  |j                  j	                  dd|            \  }}|j                  |       | j                  d       | j                  t        j                        5  |j                  j	                  |       d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)
Nr   r@   c                     | |z   y rB   rC   rD   s     r   rH   z*MiscTest.test_after_idle.<locals>.callbacko   rI   r   rJ   rK   rL   rM   rN   rO   )r   
after_idler   rQ   rR   rS   update_idletasksr!   rU   r   r<   rV   )r   r   rH   idle1rZ   r[   rG   s         @r   test_after_idlezMiscTest.test_after_idlel   s   yy	!
 )eTWW\\'6:;gg''Wfe(LM"w//0 	!GGLL 	! "b1# )eTWW\\'6:;gg''Wfe(LM% #w//0 	!GGLL 	! 	!	! 	!	! 	!s   H HHHc                    | j                   }fd}|j                  d|      }|j                  |      }| j                  t              5  |j                  d        d d d        d|j                  j                  |j                  j                  dd|            \  }}|j                  j                  |       | j                  d       |j                  |       | j                  t        j                        5  |j                  j                  |       d d d        | j                  d       | j                  t        j                        5  |j                  j                  dd|       d d d        |j                  |       d|j                  j                  |j                  j                  dd|            \  }}|j                  j                  |       | j                  d       |j                  |       | j                  t        j                        5  |j                  j                  |       d d d        | j                  d       | j                  t        j                        5  |j                  j                  dd|       d d d        y # 1 sw Y   BxY w# 1 sw Y   xY w# 1 sw Y   IxY w# 1 sw Y   xY w# 1 sw Y   y xY w)Nc                       dz   y )Nr@   rC   )rG   s   r   rH   z,MiscTest.test_after_cancel.<locals>.callback   s    QJEr   i  r   rJ   rK   r@   )r   rJ   r_   rU   
ValueErrorrV   rQ   rS   rR   r!   r   r<   )r   r   rH   rY   ra   rZ   r[   rG   s          @r   test_after_cancelzMiscTest.test_after_cancel   sA   yy	 D(+) z* 	$d#	$ gg''Wff(MNV"&!w//0 	!GGLL 	!"w//0 	2GGLL&&1	2 	&! gg''Wfe(LMV"% w//0 	!GGLL 	!"w//0 	1GGLL&%0	1 	17	$ 	$	! 	!	2 	2	! 	!	1 	1s<   J=J*J7!K6KJ'*J47KKKc                    | j                   }|j                          |j                  d       | j                  |j	                         d       |j                  d       | j                  |j	                         d       |j                          | j                  t        j                        5  |j	                          d d d        y # 1 sw Y   y xY w)Nu   Ùñîu   çōđěu   Ùñîçōđěr   clipboard_clearclipboard_appendr!   clipboard_getrU   r   r<   r=   s     r   test_clipboardzMiscTest.test_clipboard   s    yyh'++-x8j)++-/?@w//0 	! 	! 	! 	!   .CCc                    | j                   }|j                          |j                  d       | j                  |j	                         d       |j                  d       | j                  |j	                         d       |j                          | j                  t        j                        5  |j	                          d d d        y # 1 sw Y   y xY w)Nu   𝔘𝔫𝔦u   𝔠𝔬𝔡𝔢u   𝔘𝔫𝔦𝔠𝔬𝔡𝔢rh   r=   s     r   test_clipboard_astralzMiscTest.test_clipboard_astral   s    yyn-++-~>01++-/MNw//0 	! 	! 	! 	!rm   c                      fd} j                   }|j                  } j                   |d      d        j                   |d      d        j                   |d      d        | |d      d	        | |d
      d        j                  t        j
                        5   |d       d d d         j                  t        j
                        5   |d       d d d        y # 1 sw Y   :xY w# 1 sw Y   y xY w)Nc                 V    t        | |      D ]  \  }}j                  ||d        y )N!   )delta)zipassertAlmostEqual)col1col2col1_channelcol2_channelr   s       r   assertApproxz-MiscTest.test_winfo_rgb.<locals>.assertApprox   s6     /2$o M*l&&|\&LMr   red)  r   r   zdark slate blue)iHH  i==  i  z#F0F)r|   r   r|   z#4a3c8c)iJJ  i<<  i  z#dede14143939)i  i  i99  z#123456789a)o   N   7   )r   	winfo_rgbr!   rU   r   r<   )r   rz   r   rgbs   `   r   test_winfo_rgbzMiscTest.test_winfo_rgb   s    	M yynn 	U]3./1FGV&>?S^%=>S)+CDw//0 		 w//0 		 		 		 	s   $	C&	C2&C/2C;c                 n   t        j                  | j                        }t        j                  |      }|j	                         }| j                  |t               | j                  | j                  j                  t        |            t        |             | j                  | j                  j                  t        |      d       t        |             | j                  | j                  j                  t        |      |      t        |             | j                  | j                  j                  |      t        |             | j                  | j                  j                  |d       t        |             | j                  | j                  j                  ||      t        |             y )N)	displayof)r   r   r   r)   winfo_idassertIsInstanceintr!   winfo_pathnamehexr*   )r   r#   wwids       r   test_winfo_pathnamezMiscTest.test_winfo_pathname   s2   TYY'NN1jjlc3'11#c(;SVD11#c(d1KSQRVT11#c(a1H#a&Q11#6A?11#1FAO11#1CSVLr   c                 P   t        j                         }d|_        d|_        d|_        d|_        d|_        d|_        d|_        d|_	        d|_
        d|_        d|_        d|_        d|_        d|_        d|_        d|_        d|_        | j'                  t)        |      d       y )N90  ??r   [ 100z<100 event>)r   Eventserialnumheightkeycodestatetimewidthxycharkeysym
keysym_numtypewidgetx_rooty_rootrs   r!   r"   r   es     r   test_event_repr_defaultsz!MiscTest.test_event_repr_defaults   s    MMO	a-0r   c                    t        j                         }d|_        d|_        d|_        d|_        d|_        d|_        d|_        d|_	        d	|_
        d
|_        d|_        d|_        d|_        t        d      |_        t         j"                  j$                  |_        d|_        d|_        d|_        d|_        | j1                  t3        |      d       y )Nr      T   A   i r   i,  
      AzKey-Az.texti  i  z<Configure event send_event=True state=Shift|Control|Button3|0x30000 keysym=Key-A keycode=65 char='A' num=3 delta=-1 focus=True x=10 y=20 width=300 height=200>)r   r   r   r   focusr   r   r   r   r   r   r   r   
send_eventr   ordr   	EventType	Configurer   r   r   r   rs   r!   r"   r   s     r   test_event_reprzMiscTest.test_event_repr  s    MMO	3x"",,a<	=r   c                 ~     G d dt         j                        }t        j                  |t        j                         y )Nc                       e Zd ZdZeZdZdZ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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#d Z$d!Z%d"Z&d#Z'd$Z(d%Z)y&)'6MiscTest.test_eventtype_enum.<locals>.CheckedEventType234567891011121314151617181920212223242526272829303132333435363738N)*__name__
__module____qualname__KeyPressKey
KeyReleaseButtonPressr)   ButtonReleaseMotionEnterLeaveFocusInFocusOutKeymapExposeGraphicsExposeNoExpose
VisibilityCreateDestroyUnmapMap
MapRequestReparentr   ConfigureRequestGravityResizeRequest	CirculateCirculateRequestPropertySelectionClearSelectionRequest	SelectionColormapClientMessageMappingVirtualEventActivate
Deactivate
MouseWheelrC   r   r   CheckedEventTyper   $  s    HCJK FMFEEGHFF!NHJFGECJHI#G MI#H!N#IH MGLHJJr   r  )enumStrEnum_test_simple_enumr   r   )r   r  s     r   test_eventtype_enumzMiscTest.test_eventtype_enum#  s,    '	t|| '	P 	/1B1BCr   c                 $   dD ]-  }| j                  | j                  j                  |      d       / dD ]-  }| j                  | j                  j                  |      d       / | j                  t        | j                  j                  d       | j                  t        | j                  j                  d       | j                  t
        | j                  j                  d        | j                  t
        | j                  j                  d       y )N)trueyeson1r#   r   r@   TT)falsenooff0r$   nr   FFyear   rC   )assertIsr   
getbooleanrU   re   	TypeError)r   vs     r   test_getbooleanzMiscTest.test_getbooleanN  s    < 	9AMM$))..q148	9> 	:AMM$))..q159	:*dii&:&:EB*dii&:&:B?)TYY%9%94@)TYY%9%92>r   c                 X    g  fd} j                   j                  d|        j                   j                  d        j                  g         j                   j                  d        j                  dg        j	                   j                   j                                y )Nc                       j                  d       j                  j                  dj                  j                         y )Nr@   d   )appendr   rJ   quit)logr   s   r   rH   z(MiscTest.test_mainloop.<locals>.callbackZ  s(    JJqMIIOOC0r   r  r@   r   )r   rJ   mainloopr!   
assertTruewinfo_exists)r   rH   r  s   ` @r   test_mainloopzMiscTest.test_mainloopX  s    	1 			X&		1b!		1qc"		..01r   c                    | j                   j                         }t        j                  | j                         }| j	                  |j                         |       | j                  |d d  t               | j	                  t        |      d       | j                  |d   t               | j                  |d   t               | j                  |d   t               | j                  |d   d       | j                  |d   t               | j                  |j                  t               | j                  |j                  t               | j                  |j                  t               | j                  |j                  d       | j                  |j                  t               | j	                  |d   |j                         | j	                  |d   |j                         | j	                  |d   |j                         | j	                  |d   |j                         | j	                  |d   |j                         | j                  |d	kD         |j                  d
k(  r| j	                  |j                  d       n| j	                  |j                  d       | j                  t!        |      j#                  |j                   d|j                                y )N   r   r@      r   )alphabeta	candidatefinal   )r'  r(  r*  )r@   r   r   r*  r'   )r   info_patchlevelr   r    r!   r   tuplelenr   r   majorminormicroreleaselevelr   r!  r*   
startswith)r   vir$   s      r   test_info_patchlevelzMiscTest.test_info_patchleveld  s   YY&&(MM$))$**,b1beU+R!$beS)beS)beS)beDEbeS)bhh,bhh,bhh,boo'ABbii-A)A)A)A0A		*W%??g%RYY*RXXq)B**bhhZq
+CDEr   N)r   r   r   r   r%   r0   r>   r\   rb   rf   rl   ro   r   r   r   r   r	  r  r#  r5  rC   r   r   r   r   
   s`    9G
B;8'$R!@'1R	!	!6
M1*=8)DV?
2Fr   r   c                   <    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
y	)
	EventTestc                 6   t        j                  | j                  dd      }|j                          | j                  j	                          | j                  j                          g }|j                  d|j                         |j                          | j                  j                          | j                  t        |      d|       |d   }| j                  |j                  t         j                  j                         | j                  |j                   |       | j#                  |j$                  t&               | j                  |j(                  d       | j                  |j*                  d       | j-                  t/        |d	             | j                  |j0                  d       | j                  |j2                  d       | j                  |j4                  d       | j                  |j6                  d       | j                  |j8                  d       | j                  |j:                  d       | j                  |j<                  d       | j                  |j>                  d       | j                  |j@                  d       | j                  |jB                  d       | j                  |jD                  d       | j                  |jF                  d       | j                  |jH                  d       | j                  tK        |      d
       y )N   r  r   r   z	<FocusIn>r@   r   r   Fr   z<FocusIn event>)&r   r    r   packwait_visibilityr`   bindr  focus_forcerT   r!   r.  r  r   r   r   r   r   r   r   r   r   r,   hasattrr   r   r   r   r   r   r   r   r   r   r   r   rs   r"   r   r$   eventsr   s       r   
test_focuszEventTest.test_focus  s(   MM$))3s;			!!#		""$	{FMM*			Va01Iaffg//778ahh"ahh,&allE*G,-%$'&D)4(t,$'4(d#d#4(4(!$a"34r   c                    t        j                  | j                  dd      }|j                          | j                  j	                          | j                  j                          g }|j                  d|j                         |j                  dd       | j                  t        |      d|       |d	   }| j                  |j                  t         j                  j                         | j                  |j                  |       | j!                  |j"                  t$               | j                  |j&                  d
       | j                  |j(                  d       | j+                  t-        |d             | j                  |j.                  d
       | j                  |j0                  d
       | j                  |j2                  d
       | j                  |j4                  d
       | j                  |j6                  d
       | j                  |j8                  d
       | j                  |j:                  d       | j                  |j<                  d       | j                  |j>                  d	       | j                  |j@                  d	       | j                  |jB                  d
       | j                  |jD                  d
       | j                  |jF                  d	       | j                  tI        |      d       y )Nr9  r  r:  z<Configure>x   r   )r   borderwidthr@   r   r   Fr   z.<Configure event x=0 y=0 width=150 height=100>)%r   r    r   r;  r<  r`   r=  r  	configurer!   r.  r  r   r   r   r   r   r   r   r   r   r,   r?  r   r   r   r   r   r   r   r   r   r   r   r   rs   r"   r@  s       r   test_configurezEventTest.test_configure  s   MM$))3s;			!!#		""$	}fmm,	3B/Va01Iaffg//99:ahh"ahh,&allE*G,-%$'&D)4(t,#&3'a a 4(4(!$a"RSr   c                 f   t        j                  | j                  dd      }|j                          | j                  j	                          | j                  j                          g }|j                  d|j                         |j                          |j                  d       | j                  t        |      d|       |d   }| j                  |j                  t         j                  j                         | j                  |j                   |       | j#                  |j$                  t&               | j                  |j(                  d       | j                  |j*                  d       | j-                  t/        |d	             | j                  |j0                  d
       | j#                  |j2                  t&               | j5                  |j2                  d       | j                  |j6                  d       | j#                  |j8                  t&               | j5                  |j8                  d       | j                  |j:                  d       | j                  |j<                  t?        d             | j                  |j@                  d
       | j                  |jB                  d
       | j                  |jD                  d|jG                         z
         | j                  |jH                  d|jK                         z
         | j                  |jL                  d       | j                  |jN                  d       | j                  |jP                  d       | j                  tS        |      d|j2                  dd|j8                   d|jD                   d|jH                   d	       y )Nr9  r  r:  z
<KeyPress>z<Alt-z>r@   r   Fr   r   zr   z<KeyPress event state=z#xz keysym=z keycode=z char='z' x=z y=>)*r   r    r   r;  r<  r`   r=  r  r>  event_generater!   r.  r  r   r   r   r   r   r   r   r   r   r,   r?  r   r   assertNotEqualr   r   r   r   r   r   r   r   winfo_rootxr   winfo_rootyr   r   rs   r"   r@  s       r   test_event_generate_key_pressz'EventTest.test_event_generate_key_press  s   MM$))3s;			!!#		""$	|V]]+		#Va01Iaffg//889ahh"ahh,#allE*G,-%aggs+AGGQ'%aii-AIIq)3's3x0$'4(b1==?23b1==?232&2&!$a$QWWRL 1  !		{,qsse3qsse1F	Gr   c                 P   t        j                  | j                  dd      }|j                          | j                  j	                          | j                  j                          g }|j                  d|j                         |j                  ddd       | j                  t        |      d|       |d   }| j                  |j                  t         j                  j                         | j                  |j                  |       | j!                  |j"                  t$               | j                  |j&                  d       | j                  |j(                  d	       | j                  |j*                  d	       | j                  |j,                  d
       | j                  |j.                  d       | j                  |j0                  d
       | j                  |j2                  d
       | j                  |j4                  d
       | j                  |j6                  d
       | j                  |j8                  d
       | j                  |j:                  d
       | j                  |j<                  d       | j                  |j>                  d       | j                  |j@                  d|jC                         z          | j                  |jD                  d|jG                         z          | j                  |jH                  d       | j                  tK        |      d       y )Nr9  r  r:  <Enter>2   r   r   r@   r   Fr   z$<Enter event focus=False x=100 y=50>)&r   r    r   r;  r<  r`   r=  r  rK  r!   r.  r  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rM  r   rN  rs   r"   r@  s       r   test_event_generate_enterz#EventTest.test_event_generate_enter  s7   MM$))3s;			!!#		""$	y&--(	cR0Va01Iaffg//556ahh"ahh,#allE*aggu%%!$&D)4(t,$'4(c"b!3#892#78!$a"HIr   c                 n   t        j                  | j                  dd      }|j                          | j                  j	                          | j                  j                          g }|j                  d|j                         |j                          |j                  ddd       | j                  t        |      d|       |d	   }| j                  |j                  t         j                  j                         | j                  |j                   |       | j#                  |j$                  t&               | j                  |j(                  d	       | j                  |j*                  d
       | j-                  t/        |d             | j                  |j0                  d       | j                  |j2                  d	       | j                  |j4                  d       | j                  |j6                  d       | j                  |j8                  d       | j                  |j:                  d       | j                  |j<                  d       | j                  |j>                  d       | j                  |j@                  d       | j                  |jB                  d       | j                  |jD                  |jG                         dz          | j                  |jH                  |jK                         dz          | j                  |jL                  d	       | j                  tO        |      d       y )Nr9  r  r:  z<ButtonPress>z
<Button-1>rR  rS  r@   r   Fr   r   z$<ButtonPress event num=1 x=100 y=50>)(r   r    r   r;  r<  r`   r=  r  r>  rK  r!   r.  r  r   r   r   r   r   r   r   r   r   r,   r?  r   r   r   r   r   r   r   r   r   r   r   rM  r   rN  rs   r"   r@  s       r    test_event_generate_button_pressz*EventTest.test_event_generate_button_press  sC   MM$))3s;			!!#		""$	.		3Va01Iaffg//;;<ahh"ahh,#allE*G,-"!$&D)4(t,$'4(c"b!1==?S#891==?R#78!$a"HIr   c                 n   t        j                  | j                  dd      }|j                          | j                  j	                          | j                  j                          g }|j                  d|j                         |j                          |j                  ddd       | j                  t        |      d|       |d	   }| j                  |j                  t         j                  j                         | j                  |j                   |       | j#                  |j$                  t&               | j                  |j(                  d	       | j                  |j*                  d
       | j-                  t/        |d             | j                  |j0                  d       | j                  |j2                  d       | j                  |j4                  d       | j                  |j6                  d       | j                  |j8                  d       | j                  |j:                  d       | j                  |j<                  d       | j                  |j>                  d       | j                  |j@                  d       | j                  |jB                  d       | j                  |jD                  |jG                         dz          | j                  |jH                  |jK                         dz          | j                  |jL                  d	       | j                  tO        |      d       y )Nr9  r  r:  z<Motion>z<B1-Motion>rR  rS  r@   r   Fr   r      z'<Motion event state=Button1 x=100 y=50>)(r   r    r   r;  r<  r`   r=  r  r>  rK  r!   r.  r  r   r   r   r   r   r   r   r   r   r,   r?  r   r   r   r   r   r   r   r   r   r   r   rM  r   rN  rs   r"   r@  s       r   test_event_generate_motionz$EventTest.test_event_generate_motion0  sC   MM$))3s;			!!#		""$	z6==)		#4Va01Iaffg//667ahh"ahh,#allE*G,-%%(&D)4(t,$'4(c"b!1==?S#891==?R#78!$a"KLr   c                 p   t        j                  | j                  dd      }|j                          | j                  j	                          | j                  j                          g }|j                  d|j                         |j                          |j                  dddd       | j                  t        |      d|       |d	   }| j                  |j                  t         j                  j                         | j                  |j                   |       | j#                  |j$                  t&               | j                  |j(                  d
       | j+                  t-        |d             | j                  |j.                  d	       | j                  |j0                  d       | j                  |j2                  d	       | j                  |j4                  d       | j                  |j6                  d       | j                  |j8                  d       | j                  |j:                  d       | j                  |j<                  d       | j                  |j>                  d       | j                  |j@                  d       | j                  |jB                  d       | j                  |jD                  |jG                         dz          | j                  |jH                  |jK                         dz          | j                  |jL                  d       | j                  tO        |      d       y )Nr9  r  r:  z<MouseWheel>rR  )r   r   rs   r@   r   Fr   r   z&<MouseWheel event delta=-5 x=100 y=50>)(r   r    r   r;  r<  r`   r=  r  r>  rK  r!   r.  r  r   r   r  r   r   r   r   r   r,   r?  r   r   r   r   r   r   r   r   r   r   r   r   rM  r   rN  rs   r"   r@  s       r   test_event_generate_mouse_wheelz)EventTest.test_event_generate_mouse_wheelR  sE   MM$))3s;			!!#		""$	~v}}-		3"B?Va01Iaffg//::;ahh"ahh,allE*G,-#%!$&D)4(t,$'4(c"b!1==?S#891==?R#78"%a"JKr   c                 J   t        j                  | j                  dd      }|j                          | j                  j	                          | j                  j                          g }|j                  d|j                         |j                          |j                  dd       | j                  t        |      d|       |d   }| j                  |j                  t         j                  j                         | j                  |j                   |       | j#                  |j$                  t&               | j                  |j(                  d       | j                  |j*                  d	       | j-                  t/        |d
             | j                  |j0                  d       | j                  |j2                  d       | j                  |j4                  d       | j                  |j6                  d       | j                  |j8                  d       | j                  |j:                  d       | j                  |j<                  d       | j                  |j>                  d       | j                  |j@                  d       | j                  |jB                  d       | j                  |jD                  |jG                         dz          | j                  |jH                  d       | j                  |jJ                  d       | j                  tM        |      d       y )Nr9  r  r:  z<<Spam>>rR  )r   r@   r   Fr   r   r   z<VirtualEvent event x=50 y=0>)'r   r    r   r;  r<  r`   r=  r  r>  rK  r!   r.  r  r   r   r  r   r   r   r   r   r   r,   r?  r   r   r   r   r   r   r   r   r   r   r   rM  r   rs   r"   r@  s       r   !test_generate_event_virtual_eventz+EventTest.test_generate_event_virtual_eventt  s8   MM$))3s;			!!#		""$	z6==)		r*Va01Iaffg//<<=ahh"ahh,#allE*G,-%!$&D)4(t,$'4(b!a 1==?R#782&!$a+	.r   N)r   r   r   rB  rG  rO  rT  rV  rY  r\  r^  rC   r   r   r7  r7    s7     5DTB$GLJB JD MD LD!.r   r7  c                        e Zd Z f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d Zd Zd Zd Zd Zd Zd Zd Zd Zd Z xZS )BindTestc                     t         |           | j                  }t        j                  | j                  ddd      | _        | j
                  j                          y )NTestr9  r  class_r   r   )supersetUpr   r   r    framer;  )r   r   	__class__s     r   rf  zBindTest.setUp  s@    yy]]499V),S:


r   c                 R    | j                  t        | j                  |      |f       y rB   r!   _info_commandsr   r   funcids     r   assertCommandExistzBindTest.assertCommandExist  s    		6:VIFr   c                 P    | j                  t        | j                  |      d       y )NrC   rj  rl  s     r   assertCommandNotExistzBindTest.assertCommandNotExist  s    		6:B?r   c                 R   d}| j                   }| j                  |j                         d       | j                  |j                  |      d       d }d }|j                  ||      }| j                  |j                         |f       |j                  |      }| j                  ||       | j	                  |       |j                  ||d      }|j                  |      }| j                  ||       | j                  ||       | j	                  |       | j	                  |       y )N<Control-Alt-Key-a>rC   r   c                      y rB   rC   r   s    r   test1z!BindTest.test_bind.<locals>.test1      dr   c                      y rB   rC   rt  s    r   test2z!BindTest.test_bind.<locals>.test2  rv  r   Tadd)rg  r!   r=  r   rn  )r   eventr$   ru  rx  rm  rZ   funcid2s           r   	test_bindzBindTest.test_bind  s    %JJ2&+u%E8,ff%'&&4&0ff%gv&'(r   c                    d}| j                   }| j                  |j                         d       | j                  |j                  |      d       d }d }|j                  ||      }|j                  ||d      }| j                  t        |j
                         |j                  |       | j                  |j                  |      d       | j                  |j                         d       y )N<Control-Alt-Key-b>rC   r   c                      y rB   rC   rt  s    r   ru  z#BindTest.test_unbind.<locals>.test1  rv  r   c                      y rB   rC   rt  s    r   rx  z#BindTest.test_unbind.<locals>.test2  rv  r   Try  )rg  r!   r=  rU   r  unbind)r   r{  r$   ru  rx  rm  r|  s          r   test_unbindzBindTest.test_unbind  s    %JJ2&+u%&&4&0)QXX.	+2&r   c                 ^  
 | j                   }|j                          |j                          |j                          d}| j	                  |j                         d       | j	                  |j                  |      d       
fd}
fd}
fd}|j                  ||      }|j                  ||d      }|j                  ||d      }g 
|j                  |       | j	                  
g d	       |j                  ||       |j                  |      }	| j                  ||	       | j                  ||	       | j                  ||	       | j	                  |j                         |f       | j                  |       | j                  |       | j                  |       g 
|j                  |       | j	                  
d
dg       |j                  ||       |j                  ||       | j	                  |j                  |      d       | j	                  |j                         d       | j                  |       | j                  |       | j                  |       g 
|j                  |       | j	                  
g        | j                  t        j                  |j                  ||       y )Nz<Control-Alt-Key-c>rC   r   c                 (    j                  d       y )Nar  r   rA  s    r   ru  z$BindTest.test_unbind2.<locals>.test1      fmmC(r   c                 (    j                  d       y )Nr/   r  r  s    r   rx  z$BindTest.test_unbind2.<locals>.test2  r  r   c                 (    j                  d       y )Ncr  r  s    r   test3z$BindTest.test_unbind2.<locals>.test3  r  r   Try  )r  r/   r  r  r  )rg  r<  r>  r`   r!   r=  rK  r  r   r   rp  rn  rU   r   r<   )r   r$   r{  ru  rx  r  rm  r|  funcid3rZ   rA  s             @r   test_unbind2zBindTest.test_unbind2  s+   JJ			%2&+(((u%&&4&0&&4&0	1	 &)ff%gv&E8,""7+'(	#s,		 +2&""6*""7+""7+	$ 	'**AHHeWEr   c                    d}| j                   }| j                  |j                         d       | j                  |j                  |      d       d }d }d }|j                  ||      }|j                  ||d      }|j                  |      }| j                  ||       | j                  ||       | j	                  |       | j	                  |       |j                  ||      }	|j                  |      }| j                  ||       | j                  ||       | j                  |	|       | j	                  |	       y )	N<Control-Alt-Key-d>rC   r   c                      y rB   rC   rt  s    r   ru  z(BindTest.test_bind_rebind.<locals>.test1  rv  r   c                      y rB   rC   rt  s    r   rx  z(BindTest.test_bind_rebind.<locals>.test2   rv  r   c                      y rB   rC   rt  s    r   r  z(BindTest.test_bind_rebind.<locals>.test3  rv  r   Try  )rg  r!   r=  r   rn  r   )
r   r{  r$   ru  rx  r  rm  r|  rZ   r  s
             r   test_bind_rebindzBindTest.test_bind_rebind  s	   %JJ2&+u%&&4&0gv&ff%'(&&&(&)gv&(r   c                 t   d}| j                   j                  }| j                   j                  }| j                  t        |       | j                   |d      d       | j                   |d|      d       | j                  |d|       d }d } |d||      }| j                   |d      |f        |d|      }| j                  ||       | j                  |        |d||d      } |d|      }| j                  ||       | j                  ||       | j                  |       | j                  |       y )	Nz<Control-Alt-Key-e>rb  rC   r   c                      y rB   rC   rt  s    r   ru  z'BindTest.test_bind_class.<locals>.test1  rv  r   c                      y rB   rC   rt  s    r   rx  z'BindTest.test_bind_class.<locals>.test2  rv  r   Try  )	r   
bind_classunbind_classrU   r  r!   
addCleanupr   rn  )	r   r{  r  r  ru  rx  rm  rZ   r|  s	            r   test_bind_classzBindTest.test_bind_class  s   %YY))
yy--)Z0F+R0FE2B7fe4FE51F+eX6FE*ff%'VUEt<FE*ff%gv&'(r   c                 D   d}| j                   j                  }| j                   j                  }| j                   |d      d       | j                   |d|      d       | j	                  |d|       d }d } |d||      } |d||d      }| j                  t        |       | j                  t        |d        |d|       | j                   |d|      d       | j                   |d      d       | j                  |       | j                  |        |d|       y )	Nz<Control-Alt-Key-f>rb  rC   r   c                      y rB   rC   rt  s    r   ru  z)BindTest.test_unbind_class.<locals>.test11  rv  r   c                      y rB   rC   rt  s    r   rx  z)BindTest.test_unbind_class.<locals>.test22  rv  r   Try  )r   r  r  r!   r  rU   r  rn  )r   r{  r  r  ru  rx  rm  r|  s           r   test_unbind_classzBindTest.test_unbind_class*  s   %YY))
yy--F+R0FE2B7fe4FE51VUEt<)\2)\6:VU#FE2B7F+R0'(VU#r   c                    d}| j                   j                  }| j                   j                  }| j                   |d      d       | j                   |d|      d       | j	                  |d|       d }d }d } |d||      } |d||d	      } |d|      }	| j                  ||	       | j                  ||	       | j                  |       | j                  |        |d||      }
 |d|      }	| j                  ||	       | j                  ||	       | j                  |
|	       | j                  |       | j                  |       | j                  |
       y )
Nz<Control-Alt-Key-g>rb  rC   r   c                      y rB   rC   rt  s    r   ru  z.BindTest.test_bind_class_rebind.<locals>.test1H  rv  r   c                      y rB   rC   rt  s    r   rx  z.BindTest.test_bind_class_rebind.<locals>.test2I  rv  r   c                      y rB   rC   rt  s    r   r  z.BindTest.test_bind_class_rebind.<locals>.test3J  rv  r   Try  )r   r  r  r!   r  r   rn  r   )r   r{  r  r  ru  rx  r  rm  r|  rZ   r  s              r   test_bind_class_rebindzBindTest.test_bind_class_rebindA  s>   %YY))
yy--F+R0FE2B7fe4FE51VUEt<FE*gv&ff%'(VUE2FE*(&)gv&'((r   c                 6   d}| j                   j                  }| j                   j                  }| j                  | |              | j	                   ||      d       | j                  ||       d }d } |||      }| j                  | |               ||      }| j                  ||       | j                  |        |||d      } ||      }| j                  ||       | j                  ||       | j                  |       | j                  |       y )Nz<Control-Alt-Key-h>r   c                      y rB   rC   rt  s    r   ru  z%BindTest.test_bind_all.<locals>.test1d  rv  r   c                      y rB   rC   rt  s    r   rx  z%BindTest.test_bind_all.<locals>.test2e  rv  r   Try  r   bind_all
unbind_allr   r!   r  r   rn  )	r   r{  r  r  ru  rx  rm  rZ   r|  s	            r   test_bind_allzBindTest.test_bind_all]  s    %99%%YY))

+%"-
E*%'eXZ(%ff%'5%T2%ff%gv&'(r   c                    d}| j                   j                  }| j                   j                  }| j                  | |              | j	                   ||      d       | j                  ||       d }d } |||      } |||d      } ||       | j	                   ||      d       | j                  | |              | j                  |       | j                  |        ||       y )Nz<Control-Alt-Key-i>r   c                      y rB   rC   rt  s    r   ru  z'BindTest.test_unbind_all.<locals>.test1{  rv  r   c                      y rB   rC   rt  s    r   rx  z'BindTest.test_unbind_all.<locals>.test2|  rv  r   Try  )r   r  r  r   r!   r  rn  )r   r{  r  r  ru  rx  rm  r|  s           r   test_unbind_allzBindTest.test_unbind_allt  s    %99%%YY))

+%"-
E*%'5%T25%"-
+'(5r   c                    d}| j                   j                  }| j                   j                  }| j                  | |              | j	                   ||      d       | j                  ||       d }d }d } |||      } |||d      } ||      }	| j                  ||	       | j                  ||	       | j                  |       | j                  |        |||      }
 ||      }	| j                  ||	       | j                  ||	       | j                  |
|	       | j                  |       | j                  |       | j                  |
       y )Nz<Control-Alt-Key-j>r   c                      y rB   rC   rt  s    r   ru  z,BindTest.test_bind_all_rebind.<locals>.test1  rv  r   c                      y rB   rC   rt  s    r   rx  z,BindTest.test_bind_all_rebind.<locals>.test2  rv  r   c                      y rB   rC   rt  s    r   r  z,BindTest.test_bind_all_rebind.<locals>.test3  rv  r   Try  r  )r   r{  r  r  ru  rx  r  rm  r|  rZ   r  s              r   test_bind_all_rebindzBindTest.test_bind_all_rebind  s*   %99%%YY))

+%"-
E*%'5%T2%gv&ff%'(5%(%(&)gv&'((r   c                 p   d}d}|j                          | j                  t        |j                         t	        |t
        j                        r|j                  n|j                  }t	        |t
        j                        rC| j                  t        |j                  |       | j                  t        |j                  ||       | j                   ||      d       | j                   |||      d       d }d }|j                  |||      }| j                   ||      |f        |||      }| j                  ||       | j                  |       |j                  |||d      }	 |||      }| j                  ||       | j                  |	|       | j                  |       | j                  |	       y )	Nselrr  rC   r   c                      y rB   rC   rt  s    r   ru  z&BindTest._test_tag_bind.<locals>.test1  rv  r   c                      y rB   rC   rt  s    r   rx  z&BindTest._test_tag_bind.<locals>.test2  rv  r   Try  )r;  rU   r  tag_bind
isinstancer   Text	_tag_bindr!   r   rn  )
r   r   tagr{  r  ru  rx  rm  rZ   r|  s
             r   _test_tag_bindzBindTest._test_tag_bind  s\   %	)QZZ0",Q"=1;;1::a&iS9iS%@#+#u-r2C.#1#u%ff%'**S%D*9#u%ff%gv&'(r   c                    d}d}|j                          t        |t        j                        r|j                  n|j
                  }| j                   ||      d       | j                   |||      d       d }d }|j                  |||      }|j                  |||d      }| j                  t        |j                  |       |j                  ||       | j                   |||      d       | j                   ||      d       y )	Nr  r  rC   r   c                      y rB   rC   rt  s    r   ru  z(BindTest._test_tag_unbind.<locals>.test1  rv  r   c                      y rB   rC   rt  s    r   rx  z(BindTest._test_tag_unbind.<locals>.test2  rv  r   Try  )
r;  r  r   r  r  r  r!   rU   r  
tag_unbind)	r   r   r  r{  r  ru  rx  rm  r|  s	            r   _test_tag_unbindzBindTest._test_tag_unbind  s    %	",Q"=1;;1::#+#u-r2C.**S%D*9)Q\\37	S% #u-r2#+r   c                    d}d}|j                          t        |t        j                        r|j                  n|j
                  }| j                   ||      d       | j                   |||      d       d }d }d }|j                  |||      }|j                  |||d	      }	 |||      }
| j                  |	|
       | j                  ||
       | j                  |       | j                  |	       |j                  |||      } |||      }
| j                  ||
       | j                  |	|
       | j                  ||
       | j                  |       y )
Nr  r  rC   r   c                      y rB   rC   rt  s    r   ru  z-BindTest._test_tag_bind_rebind.<locals>.test1  rv  r   c                      y rB   rC   rt  s    r   rx  z-BindTest._test_tag_bind_rebind.<locals>.test2  rv  r   c                      y rB   rC   rt  s    r   r  z-BindTest._test_tag_bind_rebind.<locals>.test3  rv  r   Try  )
r;  r  r   r  r  r  r!   r   rn  r   )r   r   r  r{  r  ru  rx  r  rm  r|  rZ   r  s               r   _test_tag_bind_rebindzBindTest._test_tag_bind_rebind  s+   %	",Q"=1;;1::#+#u-r2C.**S%D*9#u%gv&ff%'(**S%/#u%(&)gv&(r   c                 d    t        j                  | j                        }| j                  |       y rB   )r   Canvasrg  r  r   r  s     r   test_canvas_tag_bindzBindTest.test_canvas_tag_bind  s"    NN4::&Ar   c                 d    t        j                  | j                        }| j                  |       y rB   )r   r  rg  r  r  s     r   test_canvas_tag_unbindzBindTest.test_canvas_tag_unbind  s"    NN4::&a r   c                 d    t        j                  | j                        }| j                  |       y rB   )r   r  rg  r  r  s     r   test_canvas_tag_bind_rebindz$BindTest.test_canvas_tag_bind_rebind  s"    NN4::&""1%r   c                 d    t        j                  | j                        }| j                  |       y rB   )r   r  rg  r  r   r#   s     r   test_text_tag_bindzBindTest.test_text_tag_bind  s"    LL$Ar   c                 d    t        j                  | j                        }| j                  |       y rB   )r   r  rg  r  r  s     r   test_text_tag_unbindzBindTest.test_text_tag_unbind  s"    LL$a r   c                 d    t        j                  | j                        }| j                  |       y rB   )r   r  rg  r  r  s     r   test_text_tag_bind_rebindz"BindTest.test_text_tag_bind_rebind   s"    LL$""1%r   c                 ,   | j                   }| j                  | j                  j                         d       | j                  |j                         t	        |      dddf       |j                  d       | j                  |j                         d       y )N)r'   Tkallrb  r'   r  )r  zb c)rg  r!   r   bindtagsr*   )r   r$   s     r   test_bindtagszBindTest.test_bindtags  sn    JJ++-/ABAU'CD	

< |4r   c                    d}| j                   }t        j                  |      }t        j                  |ddd      }|j	                          |j                          |j                          | j                  |j                  d|       | j                  |j                  d|       | j                  |j                  d|       | j                  |j                  d|       | j                  |j                  |       fd	}|j                  | |d
             |j                  d| |d             |j                  d| |d             |j                  d| |d             |j                  d| |d             |j                  | |d             |j                  | |d             g |j                  |       | j                  d|fd|fd|fd
|fg       g |j                  |       | j                  d|fd|fd
|fg       |j                  d       g |j                  |       | j                  d|fg       y )NrQ  rb  r9  r  rc  r   r  tag2c                       fdS )Nc                 >    j                  | j                  f      S rB   )r  r   )r   rA  whats    r   <lambda>z9BindTest.test_bind_events.<locals>.test.<locals>.<lambda>  s    V]]D!((+;< r   rC   )r  rA  s   `r   testz'BindTest.test_bind_events.<locals>.test  s	    <<r   r  zframe classztoplevel classrg  toplevel)r  tag3)r   r   r   r    r;  r<  r`   r  r  r  r  r  r=  rK  r!   r  )r   r{  r   r#   r$   r  rA  s         @r   test_bind_eventszBindTest.test_bind_events  s   yyT"MM!F#cB	))659)):u=))5%8))659/	= 	eT%[)tM':;
E40@+ABud5k2tF|4	ud7m$	ud:&'	aLAOAJ	"
 	 	Oq!AJ"
 	 	


?#	5!*.r   )r   r   r   rf  rn  rp  r}  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  __classcell__)rh  s   @r   r`  r`    s    G@)*' ,F\)0)0$.)8).*)8)6,$)4!&!&5,/r   r`  c                   $    e Zd Zd Zd Zd Zd Zy)DefaultRootTestc                 V   | j                  t        j                  d       | j                  t        j                         t        j
                         }t        j
                         }t        j
                         }| j                  t        j                  |       |j                          | j                  t        j                  |       |j                          | j                  t        j                         |j                          | j                  t        j                         y )NT)r  r   _support_default_rootrP   _default_rootr  destroy)r   r   root2root3s       r   test_default_rootz!DefaultRootTest.test_default_root<  s    g33T:'//0zz|



g++T2g++T2'//0'//0r   c                    | j                  t        j                  d       | j                  t        j                         t        j
                         }| j                  t        j                  |       t        j                          | j                  t        j                  d       | j                  t        t        d             t        j                          | j                  t        j                  d       | j                  t        t        d             |j                          | j                  t        j                  d       | j                  t        t        d             t        j
                         }| j                  t        j                  d       | j                  t        t        d             |j                          y )NTFr  )
r  r   r  rP   r  r  NoDefaultRootr,   r?  r  r=   s     r   test_no_default_rootz$DefaultRootTest.test_no_default_rootJ  s"   g33T:'//0zz|g++T2g33U;/:;g33U;/:;g33U;/:;zz|g33U;/:;r   c                    | j                  t        t        j                  d       t        j                         }| j                  t        j                  d      d       | j                  t        t        j                  d       |j                          t        j                          | j                  t        t        j                  d       y )Nr  Tr  )	rU   RuntimeErrorr   r  r  r  re   r  r  r=   s     r   r  zDefaultRootTest.test_getboolean^  s    ,(:(:C@zz|g((-t4*g&8&8%@,(:(:C@r   c                 b   | j                  t        t        j                         t        j                         }|j                  |j                         t        j                          |j                          t        j                          | j                  t        t        j                         y rB   )	rU   r  r   r   r  r_   r  r  r  r=   s     r   r#  zDefaultRootTest.test_mainloopg  sj    ,(8(89zz|		",(8(89r   N)r   r   r   r  r  r  r#  rC   r   r   r  r  :  s    1(A:r   r  c                 n    | j                   j                  | j                   j                  dd|            S )NrK   commands)rQ   rS   rR   )r   patterns     r   rk  rk  q  s(    99vyy~~fj'JKKr   __main__rB   )rW   unittestr   r  r  r   test.test_tkinter.supportr   r   requiresTestCaser   r7  r`  r  rk  r   mainrC   r   r   <module>r     s         M    uF~x00 uFpS. 1 1 S.l_/~x00 _/D4:-x/@/@ 4:nL zHMMO r   