Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/tkinter/test/test_ttk/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/tkinter/test/test_ttk/__pycache__/test_widgets.cpython-34.pyo

�
h f���@s7ddlZddlZddlmZmZddlmZddlZddlmZddl	m
Z
mZmZm
Z
ddlmZmZmZmZmZmZmZed�Gdd	�d	e�ZGd
d�de
ej�ZGdd
�d
ee�Zee�Gdd�deej��Zee�Gdd�deej��ZGdd�de�Zee�Gdd�deej��Zee�Gdd�deej��Zee�Gdd�deej��Zeee�Gdd�deej��Z eee�Gdd�deej��Z!eee�Gdd�deej��Z"ee�Gd d!�d!eej��Z#Gd"d#�d#eej�Z$ee�Gd$d%�d%eej��Z%ee�Gd&d'�d'eej��Z&ej'ej(d(kd)�ee�Gd*d+�d+eej���Z)eee�Gd,d-�d-eej��Z*ee�Gd.d/�d/eej��Z+ee�Gd0d1�d1eej��Z,ee�Gd2d3�d3eej��Z-eee e!eeee$e*e"e&e#e%e)e,e-e+efZ.e/d4kr3ej0�ndS)5�N)�ttk�TclError)�requires)�
MockTclObj)�AbstractTkTest�tcl_version�get_tk_patchlevel�simulate_mouse_click)�add_standard_options�noconv�AbstractWidgetTest�StandardOptionsTests�IntegerSizeTests�PixelSizeTests�setUpModuleZguic@s4eZdZdd�Zdd�Zdd�ZdS)�StandardTtkOptionsTestscCs�|j�}|j|dd�d}t�d
kr>d	}n|j|dd
d|�|jdd
�}|j|dd
�dS)N�class�z"attempt to change read-only option��r�beta�z"Attempt to change read-only option�Foo�errmsg�class_)rrrrr)�create�assertEqualr�checkInvalidParam)�self�widgetr�widget2�r!�G/opt/alt/python34/lib64/python3.4/tkinter/test/test_ttk/test_widgets.py�
test_classs	z"StandardTtkOptionsTests.test_classc	Cs�|j�}|j|dddd�|j|dddd�|j|dddd�|j|dddd�|j|dddd�|j|dd�|j|dfdd�dS)N�paddingr�expected�0��5r�6��7r�8�5p�6p�7p�8pr)r&)r()r'r)r(r))r'rr*)r(r)r+)r'rr*r)r(r)r+r,)r-r.r/r0)r�
checkParam)rrr!r!r"�test_paddingsz$StandardTtkOptionsTests.test_paddingcCs�|j�}|j|dd�d}t|d�rQdt|d�j�}n|j|ddd|�|jdd�}|j|d	d�dS)
N�stylerzLayout Foo not found�default_orientzLayout %s.Foo not foundrrrr)rr�hasattr�getattr�titler)rrrr r!r!r"�
test_style)sz"StandardTtkOptionsTests.test_styleN)�__name__�
__module__�__qualname__r#r2r8r!r!r!r"rs
rcs@eZdZdZ�fdd�Zdd�Zdd�Z�S)�
WidgetTestz,Tests methods available in every ttk widget.csLt�j�tj|jdddd�|_|jj�|jj�dS)N�widthr�textZText)�super�setUpr�Button�rootr�pack�wait_visibility)r)�	__class__r!r"r@;s
!
zWidgetTest.setUpcCs�|jj�|j|jjt|jj�d�t|jj�d��d�|j|jjdd�d�|jtj	|jjdd�|jtj	|jjdd�|jtj	|jjdd�dS)N��label�rr'���rI)
r�update_idletasksr�identify�int�winfo_width�winfo_height�assertRaises�tkinterr)rr!r!r"�
test_identifyBs
zWidgetTest.test_identifycCs�|j|jj�f�|j|jjdg�d�|j|jjdg�d�|j|jjdg�f�|j|jjddg�d
�|j|jjddg�f�|j|jjddg�f�dd�}|j|jjdg|did	d
6�did	d
6f�|jj�}|jtj|jjdg�|jtj|jjddg�|j||jj��|jjddg�|j|jj�d�dS)N�	!disabledT�disabled�active�!activec[s
||fS)Nr!)Zarg1�kwr!r!r"�test_cb_sz-WidgetTest.test_widget_state.<locals>.test_cb�hiZthere�msgZbadstate)rR)rUrS)rT)rr�stateZinstaterOrPr)rrWZ	currstater!r!r"�test_widget_stateOs(""

zWidgetTest.test_widget_state)r9r:r;�__doc__r@rQr[r!r!)rEr"r<8s
r<c@seZdZeZdS)�AbstractToplevelTestN)r9r:r;r�_conv_pixelsr!r!r!r"r]ssr]c	@s"eZdZd
Zd
d�ZdS)�	FrameTest�borderwidthr�cursor�heightr$�reliefr3�	takefocusr=cKstj|j|�S)N)rZFramerB)r�kwargsr!r!r"rszFrameTest.createN)	r`zclassrazheightzpaddingrczstylerdzwidth)r9r:r;�OPTIONSrr!r!r!r"r_wsr_c
@s:eZdZdZdd�Zdd�Zdd�ZdS)�LabelFrameTestr`rrarb�labelanchor�labelwidgetr$rcr3rdr>�	underliner=cKstj|j|�S)N)rZ
LabelFramerB)rrer!r!r"r�szLabelFrameTest.createcCs]|j�}|j|ddddddddd	d
ddd
dd�|j|dd�dS)Nrh�eZenZes�n�neZnw�sZseZsw�wZwnZwsrz!Bad label anchor specification {}�center)r�checkEnumParamr)rrr!r!r"�test_labelanchor�s
'zLabelFrameTest.test_labelanchorcCsQ|j�}tj|jdddd�}|j|d|dd�|j�dS)Nr>ZMupp�nameZfoorir%z.foo)rr�LabelrBr1�destroy)rrrGr!r!r"�test_labelwidget�szLabelFrameTest.test_labelwidgetN)
zborderwidthzclasszcursorzheightzlabelanchorzlabelwidgetzpaddingzreliefzstylez	takefocusztextz	underlinezwidth)r9r:r;rfrrrrvr!r!r!r"rg�srgc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�AbstractLabelTestcCs�tjd|jdd�}tjd|jdd�}|j|||dd�|j||ddd�|j|||fdd
�|j|||d|fdd�|j||ddd�|j||dd	d
�dS)N�masterrs�image1�image2r%rTzimage1 active image2Zspamrzimage "spam" doesn't exist)ry)ry)ry)ry�active�image2)ryr{r|)rPZ
PhotoImagerBr1r)rrrs�imagerzr!r!r"�checkImageParam�sz!AbstractLabelTest.checkImageParamcCs8|j�}|j|ddddddddd	�
dS)
N�compound�noner>r}rp�topZbottom�left�right)rrq)rrr!r!r"�
test_compound�szAbstractLabelTest.test_compoundcCs)|j�}|j|dddd�dS)NrZrTrS�normal)r�checkParams)rrr!r!r"�
test_state�szAbstractLabelTest.test_statecCs)|j�}|j|dddd�dS)Nr=i�rin���)rr�)rrr!r!r"�
test_width�szAbstractLabelTest.test_widthN)r9r:r;r~r�r�r�r!r!r!r"rw�s
rwc@s4eZdZdZeZdd�Zdd�ZdS)�	LabelTest�anchor�
backgroundrrra�font�
foregroundr}�justifyr$rcrZr3rdr>�textvariablerjr=�
wraplengthcKstj|j|�S)N)rrtrB)rrer!r!r"r�szLabelTest.createcCs#|j�}|j|dd�dS)Nr�z3-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*)rr1)rrr!r!r"�	test_font�szLabelTest.test_fontN)zanchorz
backgroundzclasszcompoundzcursorzfontz
foregroundzimager�zpaddingzreliefzstatezstylez	takefocusztextr�z	underlinezwidthr�)r9r:r;rfrr^rr�r!r!r!r"r��sr�c
@s:eZdZdZdd�Zdd�Zdd�ZdS)�
ButtonTestr�commandrra�defaultr}rZr3rdr>r�rjr=cKstj|j|�S)N)rrArB)rrer!r!r"r�szButtonTest.createcCs)|j�}|j|dddd�dS)Nr�r�rTrS)rrq)rrr!r!r"�test_default�szButtonTest.test_defaultcsEg�tj|jd�fdd��}|j�|j��dS)Nr�cs
�jd�S)NrH)�appendr!)�successr!r"�<lambda>�sz(ButtonTest.test_invoke.<locals>.<lambda>)rrArB�invoke�
assertTrue)rZbtnr!)r�r"�test_invoke�s$
zButtonTest.test_invokeN)
zclasszcommandzcompoundzcursorzdefaultzimagezstatezstylez	takefocusztextztextvariablez	underlinezwidth)r9r:r;rfrr�r�r!r!r!r"r��sr�c@sFeZdZdZdd�Zdd�Zdd�Zdd�ZdS)�CheckbuttonTestrr�rrar}�offvalue�onvaluerZr3rdr>r�rj�variabler=cKstj|j|�S)N)r�CheckbuttonrB)rrer!r!r"r�szCheckbuttonTest.createcCs,|j�}|j|ddddd�dS)Nr�rHgffffff@rz
any string)rr�)rrr!r!r"�
test_offvalue�szCheckbuttonTest.test_offvaluecCs,|j�}|j|ddddd�dS)Nr�rHgffffff@rz
any string)rr�)rrr!r!r"�test_onvalue�szCheckbuttonTest.test_onvaluecsg��fdd�}tj|jd|�}|j|j�d�|jtj|jj	|d�|j
�}|j|d�|j|d|jj	|d��|j��d|d<|j
�}|jt
|��|jt��d	�|j|d
|jj	|d��dS)Ncs�jd�dS)NrHzcb test called)r�r!)r�r!r"�cb_test�s
z,CheckbuttonTest.test_invoke.<locals>.cb_testr��	alternater�zcb test calledr�rrHr�)r�)rr�rBrrZrOrPr�tk�globalgetvarr�r��assertFalse�str�assertLessEqual�len)rr��cbtn�resr!)r�r"r��s"



zCheckbuttonTest.test_invokeN)zclasszcommandzcompoundzcursorzimagezoffvaluezonvaluezstatezstylez	takefocusztextztextvariablez	underlinezvariablezwidth)r9r:r;rfrr�r�r�r!r!r!r"r��sr�cs|eZdZdZ�fd
d�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd�Z�S)�ComboboxTestrra�exportselectionrbr��postcommandrZr3rdr��valuesr=cs t�j�|j�|_dS)N)r?r@r�combo)r)rEr!r"r@s
zComboboxTest.setUpcKstj|j|�S)N)r�ComboboxrB)rrer!r!r"r"szComboboxTest.createc	Cs2|j�}|j|ddddddd�dS)Nrb�dg�����LY@gfffff�Y@rZ1ii����)rr�)rrr!r!r"�test_height%szComboboxTest.test_heightcCs)|j�}|j|dddd�dS)NrZrTrSr�)rr�)rrr!r!r"r�)szComboboxTest.test_statecCs`|jj�}|jjdd|ddd�|jjdd|ddd�|jj�dS)Nz<ButtonPress-1>�xr'�yz<ButtonRelease-1>)r�rM�event_generaterJ)rr=r!r!r"�_show_drop_down_listbox-s  z$ComboboxTest._show_drop_down_listboxcs�g�dg|jd<|jjd�fdd��|jj�|jj�|jj�}|j�|jj�|jjd�|jj�|j��dS)NrHr�z<<ComboboxSelected>>cs
�jd�S)NT)r�)�evt)r�r!r"r�9sz1ComboboxTest.test_virtual_event.<locals>.<lambda>z<Return>)	r��bindrCrDrNr��updater�r�)rrbr!)r�r"�test_virtual_event4s




zComboboxTest.test_virtual_eventcs�g��fdd�|jd<|jj�|jj�|j�|j��d|jd<|j�|jt��d�dS)Ncs
�jd�S)NT)r�r!)r�r!r"r�Isz/ComboboxTest.test_postcommand.<locals>.<lambda>r�rrH)r�rCrDr�r�rr�)rr!)r�r"�test_postcommandFs





zComboboxTest.test_postcommandc	s��fdd�}�j�jdtd$kr4fnd�|dd%��j�jddd	d&��j�jdd'��j�jdd(��j�jddd	t�d)kr�dnf�dddg�jd<�jjd�|dd��jjd�|dd��jjd�|dd*��jjd�d+�jd<|dd��jjddddg��j�jd�jr�d,nd�dddg�jd<�j�jd�jr�d-nd�dd d!g�jd<�j�jd�jrd.nd"��j	t
j�jjt�jd���j	t
j�jjd�t
j�jddddg�}�j|d�jr�d/nd#�|j�dS)0Ncs6�j�jj�|��j�jj�|�dS)N)rr��get�current)ZgetvalZcurrval)rr!r"�check_get_currentWsz3ComboboxTest.test_values.<locals>.check_get_currentr�rr'rrHzmon tue wed thurr%�mon�tue�wed�thur�*���Q�	@�
any string�
�a�crFr�dr�1�2z1 {} 2�a b�a	b�a
bz{a b} {a	b} {a
b}�a\tb�"a"�} {za\\tb {"a"} \}\ \{z1 2 {})rr'rI)r�r�r�r�)r�r�r�r�)r�r�rr�)rr'r�rI)rHrFrr)r�rr�)r�r�r�)r�r�r�)r�r�r)rr�rr1r�setr��	configure�wantobjectsrOrPrr�rr�rBru)rr�Zcombo2r!)rr"�test_valuesVsN





!
zComboboxTest.test_values)zclasszcursorr�zheightzjustifyzpostcommandzstatezstylez	takefocusztextvariablezvalueszwidth)r9r:r;rfr@rr�r�r�r�r�r�r!r!)rEr"r�sr�cs�eZdZd)Z�fdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd �Zd!d"�Zd#d$�Z
d%d&�Zd'd(�Z�S)*�	EntryTestr�rrar�r��invalidcommandr��showrZr3rdr��validate�validatecommandr=�xscrollcommandcs t�j�|j�|_dS)N)r?r@r�entry)r)rEr!r"r@�s
zEntryTest.setUpcKstj|j|�S)N)rZEntryrB)rrer!r!r"r�szEntryTest.createcCs |j�}|j|d�dS)Nr�)r�checkCommandParam)rrr!r!r"�test_invalidcommand�szEntryTest.test_invalidcommandcCsI|j�}|j|dd�|j|dd�|j|dd�dS)Nr��*r� )rr1)rrr!r!r"�	test_show�szEntryTest.test_showcCs)|j�}|j|dddd�dS)NrZrSr��readonly)rr�)rrr!r!r"r��szEntryTest.test_statec	Cs2|j�}|j|ddddddd�dS)Nr��all�key�focusZfocusinZfocusoutr�)rrq)rrr!r!r"�
test_validate�szEntryTest.test_validatecCs |j�}|j|d�dS)Nr�)rr�)rrr!r!r"�test_validatecommand�szEntryTest.test_validatecommandcCsU|j|jjd��|jtj|jjd�|jtj|jjd�dS)NrZnoindex)�assertIsBoundingBoxr��bboxrOrPr)rr!r!r"�	test_bbox�szEntryTest.test_bboxcCs�|jj�|jj�|jj�|j|jjdd�d�|j|jjdd�d�|jtj|jjdd�|jtj|jjdd�|jtj|jjdd�dS)Nr'ZtextarearHrrIrI)	r�rCrDrJrrKrOrPr)rr!r!r"rQ�s


zEntryTest.test_identifycs,g��fdd�}d|jd<dd�|jd<||jd<|jj�|j��d|jd<|jj�|jt��d	�||jd<d
d�|jd<|jj�|jt��d	�d|jd<|jj�|jt��d	�d|jd<|jtj|jj�dS)Ncs
�jd�S)NT)r�r!)r�r!r"r��sz3EntryTest.test_validation_options.<locals>.<lambda>r�r�cSsdS)NFr!r!r!r!r"r��sr�r�rrHcSsdS)NTr!r!r!r!r"r��sT)r�r�r�rr�rOrPr)rZtest_invalidr!)r�r"�test_validation_options�s&










z!EntryTest.test_validation_optionscs�g��fdd�}d|jd<|jj|�df|jd<|jjdd�|jjdd	�|j�d
dg�|j|jj�d	�dS)NcsDd|j�kodkns3�jd�dS�jd�dS)Nr��zFT)�lowerr�)Z	to_insert)�
validationr!r"r��s
"

z+EntryTest.test_validation.<locals>.validater�r�z%Sr��endrHr�FT)r��register�insertrr�)rr�r!)r�r"�test_validation�s
zEntryTest.test_validationcCs'dd�}|jj|�df|jd<|jjdd�|j|jj�d�|j|jj�f�|jjdd�|j|jj�d	�|jjdd
�|j|jj�d�|j|jj�d�|jjd
�|j|jj�d�|j|jj�f�dS)NcSs;x4|D],}d|j�ko*dknsdSqWdS)Nr�r�FT)r�)ZcontentZletterr!r!r"r�s
"z-EntryTest.test_revalidation.<locals>.validatez%Pr�r�ZavocadoTrrZa1bF�invalidrH)r�)r�r�r�rr�rZ�deleter�)rr�r!r!r"�test_revalidationszEntryTest.test_revalidation)z
backgroundzclasszcursorzexportselectionzfontzinvalidcommandzjustifyzshowzstatezstylez	takefocusztextvariablezvalidatezvalidatecommandzwidthr�)r9r:r;rfr@rr�r�r�r�r�r�rQr�r�r�r!r!)rEr"r��s"
r�cs|eZdZdZ�fdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Z	dd�Z
dd�Z�S)�PanedWindowTestrrarb�orientr3rdr=cs t�j�|j�|_dS)N)r?r@r�paned)r)rEr!r"r@ s
zPanedWindowTest.setUpcKstj|j|�S)N)rZPanedWindowrB)rrer!r!r"r$szPanedWindowTest.createcCs�|j�}|jt|d�d�d}t�dkrDd	}n|j|dd
d|�|jdd
�}|jt|d�d
�dS)
Nr��verticalz"attempt to change read-only optionrrrrrz"Attempt to change read-only option�
horizontalr)rrrzbetar)rrr�rr)rrrr r!r!r"�test_orient's	zPanedWindowTest.test_orientcCsztj|j�}tj|�}|jtj|jj|�|j�|j�tj|j�}tj|�}|jtj|jj|�|j�|j�tj|j�}|jj|�|jtj|jj|�tj|j�}|jj|�|j	|jj
d�|jj
d��|jtj|jj
d�|j�|j�|jtj|jj
d�dS)NrrHrF)rrtr�rOrPr�addrurBr�pane)rrG�childZ
good_childZother_childr!r!r"�test_add2s(



(

zPanedWindowTest.test_addcCs�|jtj|jjd�|jtj|jjd�|jjtj|j��|jjd�|jtj|jjd�dS)Nr)	rOrPrr��forgetr�rrtrB)rr!r!r"�test_forgetNs
zPanedWindowTest.test_forgetcCs|jtj|jjdd�|jtj|jjdd�|jtj|jjdd�tj|j�}tj|j�}tj|j�}|jtj|jjd|�|jjd|�|jjd|�|j|jj	�t
|�t
|�f�|jjd|�|j|jj	�t
|�t
|�f�|jjd|�|j|jj	�t
|�t
|�t
|�f�|jj	�}|jjd|�|j||jj	��|jj||�|j|jj	�t
|�t
|�t
|�f�dS)Nrr�)rOrPrr�r�rrtrBr�panesr�)rr�child2�child3rr!r!r"�test_insertWs*++"zPanedWindowTest.test_insertcCs
|jtj|jjd�tj|j�}|jj|�|j	|jjd�t
�|j|jjddd�|jr�dnd�|j|jjdd�|jr�dnd�|j|jjd�|jjt
|���|jtj|jjddd�dS)Nr�weightr&Z	badoptionZ	somevalue)rOrPrr�r�rrtrBr��assertIsInstance�dictrr�r�)rrr!r!r"�	test_panezs.zPanedWindowTest.test_panecCsi|jtj|jjd�|jtj|jjd�|jtj|jjd�tj|jdd�}|jj|dd�|jtj|jjd�tj|jdd�}|jj|�|jtj|jjd�|jjdd	d
d�|jj	�|jjd�}|jjdd�|j
||jjd��|j|jjd�t�dS)
Nrrr>r�rrH�b�expandTZfillZbothi�)
rOrPrr�Zsashposrrtr�rCrD�assertNotEqualr	rL)rrrZcurr_posr!r!r"�test_sashpos�s
zPanedWindowTest.test_sashpos)zclasszcursorzheightzorientzstylez	takefocuszwidth)r9r:r;rfr@rr�rrrrrr!r!)rEr"r�s	#r�c@s:eZdZdZdd�Zdd�Zdd�ZdS)�RadiobuttonTestrr�rrar}rZr3rdr>r�rj�valuer�r=cKstj|j|�S)N)r�RadiobuttonrB)rrer!r!r"r�szRadiobuttonTest.createcCs,|j�}|j|ddddd�dS)NrrHgffffff@rz
any string)rr�)rrr!r!r"�
test_value�szRadiobuttonTest.test_valuecs�g��fdd�}tj|j�}tj|jd|d|dd�}tj|jd|d|dd�}|jr�dd	�}nt}|j�}|j|d
�|j||d�|j	��|j|j	�||j
j|d���|j��d|d<|j�}|jt
|�d�|jt��d�|j||d�|j	��|j|j	�||j
j|d���|jt
|d�t
|d��dS)Ncs�jd�dS)NrHzcb test called)r�r!)r�r!r"r��s
z,RadiobuttonTest.test_invoke.<locals>.cb_testr�r�rrrHcSs|S)Nr!)r�r!r!r"r��sz-RadiobuttonTest.test_invoke.<locals>.<lambda>zcb test calledr)rPZIntVarrBrrr�rLr�rr�r�r�r�r�r�r�)rr�Zmyvarr�Zcbtn2�convr�r!)r�r"r��s0	 

 zRadiobuttonTest.test_invokeN)zclasszcommandzcompoundzcursorzimagezstatezstylez	takefocusztextztextvariablez	underlinezvaluezvariablezwidth)r9r:r;rfrrr�r!r!r!r"r�src
@s:eZdZdZdd�Zdd�Zdd�ZdS)�MenubuttonTestrrra�	directionr}�menurZr3rdr>r�rjr=cKstj|j|�S)N)rZ
MenubuttonrB)rrer!r!r"r�szMenubuttonTest.createcCs/|j�}|j|dddddd�dS)NrZaboveZbelowr�r��flush)rrq)rrr!r!r"�test_direction�szMenubuttonTest.test_directioncCsH|j�}tj|dd�}|j|d|dt�|j�dS)Nrsrr)rrPZMenur1r�ru)rrrr!r!r"�	test_menu�szMenubuttonTest.test_menuN)
zclasszcompoundzcursorz	directionzimagezmenuzstatezstylez	takefocusztextztextvariablez	underlinezwidth)r9r:r;rfrrrr!r!r!r"r�srcs�eZdZdZeZdZ�fd
d�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Z�S) �	ScaleTestrr�ra�from�lengthr�r3rd�torr�r�cs:t�j�|j�|_|jj�|jj�dS)N)r?r@r�scalerCr�)r)rEr!r"r@�s

zScaleTest.setUpcKstj|j|�S)N)rZScalerB)rrer!r!r"r�szScaleTest.createcCs/|j�}|j|dddddd�dS)Nrr�g������-@g333333.@rF)r�checkFloatParam)rrr!r!r"�	test_from�szScaleTest.test_fromcCs,|j�}|j|ddddd�dS)Nr�gffffff`@g33333�`@Z5i)r�checkPixelsParam)rrr!r!r"�test_lengthszScaleTest.test_lengthc	Cs2|j�}|j|ddddddd�dS)	Nri,g������-@g333333.@r�rFi����)rr )rrr!r!r"�test_toszScaleTest.test_toc	Cs2|j�}|j|ddddddd�dS)	Nri,g������-@g333333.@r�rFi����)rr )rrr!r!r"r	szScaleTest.test_valuecs�dddg�|jjd�fdd��}d|jd<d|jd<d|jd	<|j��dddg�|jjdd
d	d�|jjddd	d
�|jjd	d�|j��dS)NrHz<<RangeChanged>>cs
�j�S)N)�pop)r�)�failurer!r"r�sz-ScaleTest.test_custom_event.<locals>.<lambda>r�rZfrom_rrrFr'r���)rr�r�r�)rZfuncidr!)r'r"�test_custom_event
s!



zScaleTest.test_custom_eventcCs|jrdd�}nt}|jj�}|j|jj|d�|jd�|j||jjdd��||jd��|j|jj�|jd�d|jd<|j|jj�|jd�|jtj|jjdd�|jtj|jjdd�dS)	NcSs|S)Nr!)r�r!r!r"r�"sz$ScaleTest.test_get.<locals>.<lambda>rrrr�r)	r��floatrrMrr�rOrPr)rrZscale_widthr!r!r"�test_get s	&2 
 zScaleTest.test_getcCs�|jrdd�}nt}||jd�}|d}|jj|�|j||jj��|�||jd�}|jj|d�|j||jj��|�tj|j�}||jd<|j|d�|j||jj��|j��|j||jj��|d�~|d|jd	<|j||jj��|d�|j||jj��||jd	��|j||jjd
d
��|�|j||jj|jj	�d
��|�|j
tj|jjd�dS)NcSs|S)Nr!)r�r!r!r"r�4sz$ScaleTest.test_set.<locals>.<lambda>rr�rrHr�r'rr)r�r+rr�rr�rPZ	DoubleVarrBrMrOr)rr�maxZnew_max�min�varr!r!r"�test_set2s,	

%##,%.zScaleTest.test_set)zclasszcommandzcursorzfromzlengthzorientzstylez	takefocusztozvaluezvariable)r9r:r;rfrr^r4r@rr!r$r%rr)r,r0r!r!)rEr"r�src@sjeZdZdZeZdZd
d�Zdd�Zdd�Z	dd�Z
dd�Zdd�ZdS)�ProgressbarTestrrar�r�mode�maximum�phaser3rdrr�r�cKstj|j|�S)N)rZProgressbarrB)rrer!r!r"r`szProgressbarTest.createcCs)|j�}|j|dddd�dS)NrgfffffY@g�����YL@Z2i)rr#)rrr!r!r"r$cszProgressbarTest.test_lengthc	Cs2|j�}|j|ddddddd�dS)	Nr3gfffff�b@g�����lS@rr�rFi����)rr )rrr!r!r"�test_maximumgszProgressbarTest.test_maximumcCs&|j�}|j|ddd�dS)Nr2ZdeterminateZ
indeterminate)rrq)rrr!r!r"�	test_modekszProgressbarTest.test_modecCsdS)Nr!)rr!r!r"�
test_phaseoszProgressbarTest.test_phasec	Cs2|j�}|j|ddddddd�dS)	Nrgfffff�b@g�����lS@rr�rFi����)rr )rrr!r!r"rsszProgressbarTest.test_valueN)zclasszcursorzorientzlengthzmodezmaximumr4zstylez	takefocuszvaluezvariable)
r9r:r;rfrr^r4rr$r5r6r7rr!r!r!r"r1Vsr1�darwinz"ttk.Scrollbar is special on MacOSXc@s(eZdZdZdZdd	�Zd
S)�
ScrollbarTestrr�rar�r3rdr�cKstj|j|�S)N)rZ	ScrollbarrB)rrer!r!r"r�szScrollbarTest.createN)zclasszcommandzcursorzorientzstylez	takefocus)r9r:r;rfr4rr!r!r!r"r9ysr9cs�eZdZdZ�fdd�Zd	d
�Zdd�Zd
d�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Z�S)�NotebookTestrrarbr$r3rdcs�t�j�|jdd�|_tj|j�|_tj|j�|_|jj	|jdd�|jj	|jdd�dS)Nr$rr>r�r)
r?r@r�nbrrtrB�child1rr�)r)rEr!r"r@�s
zNotebookTest.setUpcKstj|j|�S)N)rZNotebookrB)rrer!r!r"r�szNotebookTest.createcCs�|jjd�|jj|j�|jtj|jj|j�|j	|jj
d�d�|jj|j�|j	|jj
d�d�|jj|j�|j
|jjd��|jj|jdd�|jj�|jj�tjdkrd}nd	}|j	|jj|�|jjd��xitd
dd
�D]H}y*|jjd|dd�dkrtPnWqEtjk
r�YqEXqEW|jd
�dS)Nrr�rHr�r>r�r8z@20,5z@5,5r'r�z@%d, 5zTab with text 'a' not found)r;r�hiderrOrPr�tabr<r�indexr��selectr�rCrD�sys�platform�range�fail)rZtb_idx�ir!r!r"�test_tab_identifiers�s,

	("	z!NotebookTest.test_tab_identifierscCs�|jtj|jjd�|jtj|jjd�|jtj|jjd�|jtj|jjd�|jtj|jjtj|j�dd�|jj	�}|jj|j
�|jj|j
�|j|jj	�|�tj|j�}|jj|dd�|jj	�}|jjd�}|jj|j
�}|jj|j
�|jj|j
�|j|jj	�|�|j|jj|j
�|�|jt|j
�|jj	�|�|j|jjd�|d�dS)	NrHrX�unknownZoptionr>r�r�rI)rOrPrr;r=r�rrtrB�tabsr<rr?rr�)rrHr�currZchild2_indexr!r!r"�test_add_and_hidden�s*'&z NotebookTest.test_add_and_hiddencCs+|jtj|jjd�|jtj|jjd�|jtj|jjd�|jj�}|jj|j�}|jj|j�|jt	|j�|jj��|j
t|�dt|jj���|jj|j�|j
|jj|j�d�|j
||jj|j��dS)NrHrXrI)rOrPrr;rrHr?r<ZassertNotInr�rr�r�r)rrHZchild1_indexr!r!r"r�s")zNotebookTest.test_forgetcCs�|jtj|jjd�|jtj|jjd�|j|jjd�t�|j|jj|j�d�|j|jj|j	�d�|j|jjd�d�dS)NrHr�rrFrI)
rOrPrr;r?r	rLrr<r)rr!r!r"�
test_index�szNotebookTest.test_indexcCs�|jj�}|jjd|d�|j|jj�|d|df�|jj|j|j�|j|jj�|�|jjd|j�|j|jj�|d|df�|jjdd�|j|jj�|�|jtj|jjd|d�|jtj|jjd|d�t	j
|j�}|jjd|�|j|jj�|dt|�|df�|jj
|�|j|jj�|�|jj|j|�|j|jj�t|�f|�|jj
|�|jtj|jjd|�|jtj|jjd|�|jtj|jjdd�|jtj|jjdd�|jtj|jjdd�dS)NrHrr�rFrIrI)r;rHr�rr<rrOrPrrrtrBr�r)rrHrr!r!r"r�s0''##0&zNotebookTest.test_insertcs�|jj�|jj�g�g�|jjd�fdd��|jjd�fdd��|j|jj�t|j��|jj|j�|j	��|j|jj�t|j��|jj
�|j	��dS)Nz<Unmap>cs
�jd�S)NT)r�)r�)r�r!r"r�sz*NotebookTest.test_select.<locals>.<lambda>z<<NotebookTabChanged>>cs
�jd�S)NT)r�)r�)�tab_changedr!r"r�s)r;rCrDr<r�rr@r�rr�r�)rr!)r�rLr"�test_selects

"
"
zNotebookTest.test_selectcCs|jtj|jjd�|jtj|jjd�|jtj|jjd�|j|jj|j�t�|j|jj|jdd�d�|j|jj|jd�d�|jj|jdd�|j|jj|jdd�d�|j|jj|jd�d�dS)NrHZnotabr>r��abcrI)	rOrPrr;r>r	r<r
r)rr!r!r"�test_tab"s%"%zNotebookTest.test_tabcCsb|jt|jj��d�|jj|j�|jj|j�|j|jj�f�dS)NrF)rr�r;rHrr<r)rr!r!r"�	test_tabs0szNotebookTest.test_tabscCs�|jj�|jj�|jjd�t|jdd�|jj�|jjd�|j|jj�t|j	��|jj�|jjd�|j|jj�t|j
��|jj�|jjd�|j|jj�t|j	��|jj|j
dddd�|jj�|jj�t|jdd�t
jdkrh|jjd	�n|jjd
�|j|jj�t|j
��dS)Nrr'z
<Control-Tab>z<Shift-Control-Tab>r>r�rjr8z
<Option-a>z<Alt-a>)r;rCrDr@r	Zfocus_forcer�rr�rr<r>Zenable_traversalrArB)rr!r!r"�test_traversal9s*


"
"
"

zNotebookTest.test_traversal)zclasszcursorzheightzpaddingzstylez	takefocus)r9r:r;rfr@rrFrJrrKrrMrOrPrQr!r!)rEr"r:�s
!	r:cs$eZdZd9Z�fd
d�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd �Z
d!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Z�S):�TreeviewTestr�columnsra�displaycolumnsrbr$�
selectmoder�r3rdr��yscrollcommandcs&t�j�|jdd�|_dS)Nr$r)r?r@r�tv)r)rEr!r"r@]s
zTreeviewTest.setUpcKstj|j|�S)N)rZTreeviewrB)rrer!r!r"raszTreeviewTest.createc	Csj|j�}|j|dddd�|j|dd�|j|dfdt�d
kr_d
nf�dS)NrSza b cr%r�rr�rr'r�r)r�rr�)r�rr�)rr'r�)rr1r)rrr!r!r"�test_columnsdszTreeviewTest.test_columnscCs�|j�}d|d<|j|dddd�|j|dd�|j|dddd�|j|dd�|j|ddd
d�|j|ddd
d�|j|ddd
d�dS)Nr�rr�rSrTzb a cr%�#allrFrHrr�rzInvalid column index drzColumn index 3 out of boundszColumn index -2 out of bounds)r�rr�)rr�r�)rr�r�)rY)rFrHr)r�rr�)rHrFrr()rHr()rr1r)rrr!r!r"�test_displaycolumnsls
z TreeviewTest.test_displaycolumnsc	CsN|j�}|j|ddd	dddd�|j|ddddt�dS)
Nrbr�rZ3crFg�����LY@gfffff�Y@i����)rr#r)rrr!r!r"r�|s"zTreeviewTest.test_heightcCs)|j�}|j|dddd�dS)NrUr�ZbrowseZextended)rrq)rrr!r!r"�test_selectmode�szTreeviewTest.test_selectmodecCs�|j�}|j|dddd�|j|dd�|j|dd�|j|dddd	�|j|dddd
�dS)Nr�z
tree headingsr%�tree�headings)r\r])r\r])r]r\)r\)r])rr1)rrr!r!r"r��szTreeviewTest.test_showcCsW|jj�|j|jjd�d�|jj�|jj�|jjdd�}|jj�}|j|�|jj|d�}|j	|�dg|jd<|jj
ddd�|jj|dd�}|jj
ddd�}|jst|�}n|j|d|d|�|jj|d�}|j|jj|�d�dS)	Nrr�r�testrSr=�2z#0)
rWrCrr�rDr�r��get_childrenr�r��columnr�rL)r�item_idZchildrenr�Zbbox_column0Z
root_widthr<r!r!r"r��s$




	zTreeviewTest.test_bboxcCs>|j|jj�f�|jjdd�}|j|jj�t�|j|jj�d|�|jjdd�}|jjdd�}|jj|||�|j|jj|�||f�|jtj	|jj||�|jj|�|j|jj|�f�|jjd�|j|jj�f�dS)Nrr�r)
rrWr`r�r	�tupleZset_childrenrOrPr)rrbrrr!r!r"�
test_children�s"zTreeviewTest.test_childrencCsi|j|jjd�t�|jrJ|j|jjddd�t�n|jjddd�|j|jjdd�|jr�dnd�|j|jjddd�|jr�dnd�|jtj	|jjddd�|jtj	|jjd�idd	6id
d6id
d6id
d6id
d
6g}x-|D]%}|jtj	|jjd|�q<WdS)Nz#0r=r�Z10�id�Xr�z
some valueZunknown_optionZwrongZstretchr�Zminwidth)
r	rWrar
r�rLrrOrPr)rZinvalid_kwsrVr!r!r"�test_column�s	%"$
zTreeviewTest.test_columncCs?|jtj|jjd�|jjdd�}|jj|d�}|j|jj�|f�|j|jj|�|f�|jj|�|j|jj��|jtj|jj	|dd�|jjdd�}|jjdd�}|j|jj�||f�|jj||�|j|jj��dS)Nz#0rr�)
rOrPrrWr�r�rr`r��reattach)rrb�item2�item1r!r!r"�test_delete�szTreeviewTest.test_deletecCs0|jjdd�}|jj|d�}|jj�}|jj�|j||jj��|j|jj�|f�|j|jj|�|f�|jj|�|j|jj��|jj|dd�|j|jj�|f�|j|jj|�|f�|jj|dd�|j|jj�||f�|j|jj|�f�|jt	j
|jjddd�|jt	j
|jjd�|jt	j
|jj|dd�|jt	j
|jj|dd�|jj||�|j|jj�f�|j|jj|�f�dS)Nrr�ZnonexistentZotherparentr�)rWr�r`�detachrr�rh�moverOrPr)rrbri�prevr!r!r"�test_detach_reattach�s4
z!TreeviewTest.test_detach_reattachcCst|j|jjd�d�|j|jjd�d�|j|jji�d�|jtj|jjd�dS)NZ	somethingFrT)rrW�existsrOrPr)rr!r!r"�test_exists"szTreeviewTest.test_existscCs�|j|jj�d�|jjdd�}|jj|�|j|jj�|�|jj|�|j|jj�d�|jtj|jjd�dS)Nrr�rX)rrWr�r�r�rOrPr)rrjr!r!r"�
test_focus-szTreeviewTest.test_focuscCs�|j|jjd�t�|jjddd�|j|jjdd�d�|j|jjddd�d�|jtj|jjddd�|jtj|jjddd�dS)Nz#0r>rXr�r�rH)r	rW�headingr
rrOrPr)rr!r!r"�test_heading<s"zTreeviewTest.test_headingcs�fdd�}g��jj��jj��jjdd�fdd���jjddd��jj�|d	d	��s��jd
�ng��jjj}�jjddt	�jjddd����j
|�jjj�|d	d	��s�jd
�ndS)Ncs$t�j||��jj�dS)N)r	rWr�)r�r�)rr!r"�simulate_heading_clickMszBTreeviewTest.test_heading_callback.<locals>.simulate_heading_clickz#0r�cs
�jd�S)NT)r�r!)r�r!r"r�Usz4TreeviewTest.test_heading_callback.<locals>.<lambda>r=r�r'z>The command associated to the treeview heading wasn't invoked.)rWrCrDrsrar�rDrxZ_tclCommandsr�r)rruZcommandsr!)rr�r"�test_heading_callbackLs"

"

.
z"TreeviewTest.test_heading_callbackcCs�|jtj|jjd�|j|jjd�d�|jjdd�}|jjdd�}|jj|d�}|jj|d�}|j|jj|�d�|j|jj|�d�|j|jj|�d�|j|jj|�d�|jj|dd�|j|jj|�d�|j|jj|�d�|jj|�|j|jj|�d�|jj|�|j|jj|�d�|jj	|�|jtj|jj|�dS)NZwhatrrr�rH)
rOrPrrWr?rr�rmrlr�)rrjriZc1Zc2r!r!r"rKns&zTreeviewTest.test_indexcCs^|jtj|jjdd�|jtj|jjdddd�|jtj|jjdddd�|j|jj|jjdddd���|j|jj|jjdddd���|jtj|jjdd�|jjddd	�}|j|d	�|jtj|jjddd	�|jtj|jjddtd	��d
}|jjddd|f�}|j|jj	|d�|j
r�|fn|�|j|jj	|dd�|j
r�|fn|�|jj	|d|jj|jj	|dd���|j|jj	|dd�|j
r@|fn|�|j
|jj	|�t�|jj	|dd�|j|jj	|dd��|jjdddd
d|g�}|j|jj	|dd�|j
r�dd|fnd|�|jj	|dg�|j|jj	|dd��|jj	|dd�|j|jj	|dd�|j
rodnd�|jjddddd||ff�}|j|jj	|dd�|j
r�dd||ffn
d||f�|j|jj	|jjdddd�dd�d�|j|jj	|jjddd|�dd�|�dS)Nr�r�r�openZpleaseTFZmiddlez
first-itemuábar��tagsrHrFr�r�z1 2 %sz1 2za b cz%s %sz{a b c} {%s %s}r>z
Label here)rHrF)r�r�)rOrPrrWr�r�r�rr�itemr�rBZ	splitlistr	r
)rZitemidrryr!r!r"�test_insert_item�s\..
4$!!zTreeviewTest.test_insert_itemcCsPddg|jd<|jjdddddg�}|j|jj|�idd6dd6�|jj|dd�|j|jj|dd�|jr�dnd	�dg|jd<|j|jj|�idd6�|jj|dd�|j|jj|d
d�d�|j|jj|dd�|jr:dnd�|jj|dd�|j|jj|d�|jr~dnd
�|j|jj|dd�|jr�dnd�|j|jj|�|jr�idd6n
id
d6�|jtj|jj|d�|jtj|jj|dd�|jtj|jjd�dS)N�A�BrSrr�r�r�rza arazb a�{Z123z123 aZnotme)r�r�)rr�)r}r�)	rWr�rr�ryr�rOrPr)rryr!r!r"r0�s,!*#"$"zTreeviewTest.test_setc	s�g�|jjddddg�}|jjddddg�}|jjdd�fdd��|jjdd�fd	d��|jj�|jj�|jj�t�}t�}xqtd
dd�D]]}t|�d
kr�Pn|jj	|�}|r�||kr�|j
|�|j
|�q�q�W|jt|�d
�x!|D]}t|jd
|�qPW|jt��d�xAt
�ddd
��ddd
��D]}|j|d�q�WdS)Nrr�rx�callz<ButtonPress-1>cs
�jd�S)NrH)r�)r�)�eventsr!r"r��sz,TreeviewTest.test_tag_bind.<locals>.<lambda>z<ButtonRelease-1>cs
�jd�S)NrF)r�)r�)rr!r"r��srr�r�rF�rH)rHrF)rWr�Ztag_bindrCrDr�r�rCr�Zidentify_rowr�rr	�zip)	rrjriZpos_y�foundrErbr�r�r!)rr"�
test_tag_bind�s2


		

0zTreeviewTest.test_tag_bindcCs�|jt|jj�|jtj|jjddd�|jjddd�|jt|jjdd��d�|jt|jjddd��d�|j|jjd�t	�dS)Nr^ZskyZbluer�)
rO�	TypeErrorrWZ
tag_configurerPrrr�r	r
)rr!r!r"�test_tag_configures
!zTreeviewTest.test_tag_configurecCs�|jjddddddg�}|jjddddddg�}|jt|jj�|jt|jjdd	�|j|jjd|��|j|jjd|��|j|jjd|��|j|jjd|��|j|jjd
|��|j|jjd
|��|j|jjd�|f�|j|jjd�|f�|j|jjd
�f�dS)Nrr�r>zItem 1rxZtag1zItem 2Ztag2znon-existingZtag3)	rWr�rOr�Ztag_hasrr�r�r)rrjrir!r!r"�test_tag_has s$$zTreeviewTest.test_tag_has)zclasszcolumnszcursorzdisplaycolumnszheightzpaddingz
selectmodezshowzstylez	takefocuszxscrollcommandrV)r9r:r;rfr@rrXrZr�r[r�r�rdrgrkrorqrrrtrvrKrzr0r�r�r�r!r!)rEr"rRUs2	*"D!"rRc@s(eZdZd
ZdZdd�Zd	S)�
SeparatorTestrrar�r3rdr�cKstj|j|�S)N)rZ	SeparatorrB)rrer!r!r"r8szSeparatorTest.createN)zclasszcursorzorientzstylez	takefocus)r9r:r;rfr4rr!r!r!r"r�0sr�c@s"eZdZdZdd�ZdS)	�SizegripTestrrar3rdcKstj|j|�S)N)rZSizegriprB)rrer!r!r"rCszSizegripTest.createN)zclasszcursorzstylez	takefocus)r9r:r;rfrr!r!r!r"r�<sr��__main__)1ZunittestrPrrZtest.supportrrAZ$tkinter.test.test_ttk.test_functionsrZtkinter.test.supportrrrr	Ztkinter.test.widget_testsr
rrr
rrrrZTestCaser<r]r_rgrwr�r�r�r�r�r�rrrr1ZskipIfrBr9r:rRr�r�Z	tests_guir9�mainr!r!r!r"�<module>sn"4
';0~��3j"
���