Your IP : 216.73.216.213


Current Path : /opt/alt/python38/lib64/python3.8/idlelib/idle_test/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/idlelib/idle_test/__pycache__/test_configdialog.cpython-38.pyc

U

i�fH��@s�dZddlmZddlmZed�ddlZddlmZddlmZddl	m
Z
mZmZm
Z
mZmZdd	lmZdd
lmZmZmZejZe�d�e�d�e�d�e�d�d�Zdadaed
ZedZedZedZdd�Zdd�Z Gdd�dej!�Z"Gdd�dej!�Z#Gdd�dej!�Z$Gdd�dej!�Z%Gdd�dej!�Z&Gdd �d ej!�Z'Gd!d"�d"ej!�Z(Gd#d$�d$ej!�Z)e*d%k�r�ej+d&d'�dS)(zfTest configdialog, coverage 94%.

Half the class creates dialog, half works with user customizations.
�)�configdialog)�requiresZguiN)�mock)�Func)�Tk�	StringVar�IntVar�
BooleanVar�DISABLED�NORMAL)�config)�idleConf�changes�tracers�)�main�	highlight�keys�
extensionsrrrrcCs tt_t�atjtddd�adS)NZTestT)Z_utest)�testcfgr
�userCfgr�rootrZConfigDialog�dialog�rr�H/opt/alt/python38/lib64/python3.8/idlelib/idle_test/test_configdialog.py�setUpModule"srcCs:tt_t��t��t��t��t�	�daa
dS�N)�usercfgr
rr�detach�clearrr�update_idletasks�destroyrrrrr�tearDownModule*sr"c@seZdZdd�Zdd�ZdS)�ConfigDialogTestcCsdSrr��selfrrr�test_deactivate_current_config7sz/ConfigDialogTest.test_deactivate_current_configcCsdSrrr$rrr�activate_config_changes:sz(ConfigDialogTest.activate_config_changesN)�__name__�
__module__�__qualname__r&r'rrrrr#5sr#c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
ButtonTestcCsJt}t��}|_t��}|_|jd��|��|��|`|`dS)NZOk)rr�Mock�applyr!�buttons�invoke�assert_called_once)r%�dr-r!rrr�
test_click_ok@szButtonTest.test_click_okcCsdt}t��}|_t��}|_t��}|_|jd��|��|��|��|`|`|`dS)NZApply)	rrr,�deactivate_current_configZsave_all_changed_extensionsr'r.r/r0)r%r1Z
deactivateZsave_ext�activaterrr�test_click_applyIszButtonTest.test_click_applycCsNt}t�|_dtdd<|jd��|�tdi�|�|jjd�|`dS)N�rZ	somethingZCancel)rrr!rr.r/�assertEqual�called�r%r1rrr�test_click_cancelUszButtonTest.test_click_cancelc	Csztj�tj�tjjtdtd��*}tj	d�
�|jd|jd}}W5QRX|�|d�|�
|�d�or|�d��dS)	NZ	view_text)Znew_callableZHelp�title�contentszHelp for IDLE preferenceszWhen you clickza different name.
)r�note�select�keyspagerZpatch�objectrrr.r/�kwdsr7�
assertTrue�
startswith�endswith)r%Zviewr;r<rrr�test_click_help^s
� �zButtonTest.test_click_helpN)r(r)r*r2r5r:rErrrrr+>s		r+c@sheZdZdZedd��Zedd��Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�ZdS)�FontPageTestz�Test that font widgets enable users to make font changes.

    Test that widget actions set vars, that var changes add three
    options to changes and call set_samples, and that set_samples
    changes the font of both sample boxes.
    cCs,tj}|_tj�|�t�|_|��dSr)r�fontpage�pager=r>r�set_samples�update��clsrHrrr�
setUpClasspszFontPageTest.setUpClasscCs
|j`dSr)rHrI�rLrrr�
tearDownClasswszFontPageTest.tearDownClasscCst��dSr�rrr$rrr�setUp{szFontPageTest.setUpcCs�t��|j}|j�d�|j�d�|j�d�d|j_|�	�|�
|j��d�|�
|j��d�|�|j���|�
|jjd�t��dS)NZFake�1Trr6)rrrH�	font_name�set�	font_size�	font_boldrIr8Z
load_font_cfg�assertNotEqual�get�assertFalser7�attachr9rrr�test_load_font_cfg~szFontPageTest.test_load_font_cfgcCs�|j}|j��dkr|�d�|j}|�d�|j�d�}|��|��|�d�|�d�|�d�}|�	||�|�
|j��|���|��|��|�d�|�d�|�d�}|�
||�|�
|j��|���dS)	N��need at least 2 fontsrZactivez
<Key-Down>z<KeyRelease-Down>z<Key-Up>z<KeyRelease-Up>)rH�fontlist�size�skipTestr4rX�focus_forcerJ�event_generaterW�assertInrS�lowerr7)r%r1r^�fontZ	down_fontZup_fontrrr�test_fontlist_key�s(







zFontPageTest.test_fontlist_keyc	Cs�|j}|j��dkr|�d�|j}|�d�|��|�d�|��|�d�\}}}}||d7}||d7}|j	d||d�|j	d||d�|�
d�}|�
d�}|�||�|�|j
�
�|���dS)	Nr\r]rr6�
<Button-1>��x�y�<ButtonRelease-1>�anchor)rHr^r_r`r4ra�seerJ�bboxrbrXr7rcrSrd)	r%r1r^rirj�dx�dyZfont1Zselect_fontrrr�test_fontlist_mouse�s"




z FontPageTest.test_fontlist_mousecCs*|j}|jj�d�|�|j��d�dS)N�(�40)rHZsizelistZvariablerTr7rUrXr9rrr�
test_sizelist�szFontPageTest.test_sizelistcCsJ|j}|j�d�|j��|�|j���|j��|�|j���dS)NF)rHrVrTZbold_toggler/rBrXrYr9rrr�test_bold_toggle�s

zFontPageTest.test_bold_togglecCst�tdd�}t|d�}|ddk}|j}|j�|�|j�|�d|j_	|j
�d�dd|t|�d�i}|�t|�|�|jj	d�t
��|j�d	�ddd	t|�d�i}|�t|�|�|jj	d�t
��|j�|�ddd	t|�d�i}|�t|�|�|jj	d
�dS)Nr�EditorWindowr6r\�boldrz	Test Font)rez	font-sizez	font-boldZ20�)r
ZGetFontr�strrHrUrTrVrIr8rSr7�mainpagerr)r%Zdefault_fontZdefault_sizeZdefault_boldr1�expectedrrr�
test_font_set�s<���zFontPageTest.test_font_setcCs�|j}|`|j|jf}ii|_|_|j�d�|j�d�|j�d�ddi}|��|�|j|jkor|kn�|\|_|_t	�|_dS)N�test�5r6re)r}r~rw)
rHrIZfont_sample�highlight_samplerSrTrUrVrBr)r%r1Zorig_samplesr{rrr�test_set_samples�s"zFontPageTest.test_set_samplesN)r(r)r*�__doc__�classmethodrMrOrQr[rfrqrtrur|r�rrrrrFis

	$rFc@s(eZdZedd��Zdd�Zdd�ZdS)�
IndentTestcCstj|_|j��dSr)rrGrHrJrNrrrrM	szIndentTest.setUpClasscCs0|j}|j�d�|��|�|j��d�dS)N��)rH�	space_numrTZload_tab_cfgr7rXr9rrr�test_load_tab_cfgszIndentTest.test_load_tab_cfgcCsD|j}t��|j�d�|�|j��d�|�tdddii�dS)N�r�ZIndentz
num-spacesZ16)	rHrrZindent_scalerTr7r�rXrzr9rrr�test_indent_scales
zIndentTest.test_indent_scaleN)r(r)r*r�rMr�r�rrrrr�s
r�c@s�eZdZdZedd��Zedd��Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0S)1�HighPageTestz�Test that highlight tab widgets enable users to make changes.

    Test that widget actions set vars, that var changes add
    options to changes and that themes work correctly.
    cCsDtj}|_tj�|�t�|_t�|_t�|_t�|_	|�
�dSr)r�highpagerHr=r>r�set_theme_type�paint_theme_sample�set_highlight_target�set_color_samplerJrKrrrrM#szHighPageTest.setUpClasscCs|j}|`|`|`|`dSr)rHr�r�r�r�)rLr1rrrrO-szHighPageTest.tearDownClasscCsT|j}t�dd�D]}tjd�|�qt��d|j_d|j	_d|j
_d|j_dS)N�userrr)rHr
�GetSectionListr�remove_sectionrrr�r8r�r�r��r%r1�sectionrrrrQ3szHighPageTest.setUpcCs�t��|j}|j}tjdd�t_|��|�	|j
���||j��d�||j
��d�||j��d�||jjd�||jjd�||jjd�t�dddd	�t�dd
dd�|��||j��d�||j
��d�||jjd
�||jjd
�||jjd
�tjd
d�t_t�dddd�|��|�|j
���||j��d�||j
��d
�||jjd�||jjd�||jjd�t`t��dS)N�IDLE Classic�Zreturn_value�- no custom themes -��disabledr6r�test1�option�value�test2�option2�value2r\r�Theme�default�0rx)rrrHr7rr,r
ZCurrentThemeZload_theme_cfgrB�theme_sourcerX�builtin_name�custom_name�custom_theme_on�stater�r8r�r��	SetOptionrYrZ�r%r1�eqrrr�test_load_theme_cfg?s>z HighPageTest.test_load_theme_cfgcCs�|j}|j}t�|_t�|_|j��|tdddii�||jjd�||jjd�t	�
�|j�d�|j��|�tdddii�||jjd�||jjd�|`|`dS)Nr�r��Truer6r�z	!disabled�False)
r7rHr�var_changed_builtin_name�var_changed_custom_nameZbuiltin_theme_onr/rzr8rrr�r��r%r�r1rrr�test_theme_sourcehs

zHighPageTest.test_theme_sourcecCs|j}|j}dddg}t�dddd�|j�|d�|tdddd�i�||jd	d
�||jj	d�t
��t�dddd�|j�|d�|tdddii�||jd	d
�||jj	d
�t
��|j�|d�|tdddd�i�||jd	d�||jj	d�dS)Nr��	IDLE DarkzIDLE Newrr��name�spam�r��name2�textzNew theme, see Helpr6r�r\rrx)r7rHr
r��builtinlist�SetMenurzZ
theme_messager�r8rr�r%r�r1Z	item_listrrr�test_builtin_name}s*
�
zHighPageTest.test_builtin_namecCst|j}|j�gd�|�dt�|�|jjd�t�	�|j�dddgd�|�tdddii�|�|jjd�dS)	Nr�r�r�a�b�cr�r6)
rH�
customlistr��assertNotInrzr7r�r8rrr9rrr�test_custom_name�szHighPageTest.test_custom_namecCs2|j}t�|_|j�d�|�|jjd�|`dS)NZgreenr6)rHrZon_new_color_set�colorrTr7r8r9rrr�
test_color�s
zHighPageTest.test_colorcCsB|j}|j}|j�dddgd�||j��d�||jjd�dS)Nr�r�r�r6)r7rHZ
targetlistr��highlight_targetrXr�r8r�rrr� test_highlight_target_list_mouse�s
z-HighPageTest.test_highlight_target_list_mousecs�|j}|j�i}d}�j������d�����fdd�}�fdd�}||����D]P}��|�ddd�D]6}|d7}||�|�j�	�||�|�j
j|�qtq\dS)	Nr��?cs$�j��D]\}}|||d<q
dS�Nr)Ztheme_elements�items)�elemZelement�tag)r1rr�tag_to_element�szEHighPageTest.test_highlight_target_text_mouse.<locals>.tag_to_elementcsn��|�\}}}}||d7}||d7}�jdddd��jd||d��jd||d��jd||d�dS)Nr\�<Enter>rrh�<Motion>�<ButtonPress-1>rk)rnrb)�startrirjrorp)�hsrr�click_it�sz?HighPageTest.test_highlight_target_text_mouse.<locals>.click_itr\r6)r7rHrrarmr Z	tag_names�
tag_rangesr�rXr�r8)r%r�r��countr�r�r�Zstart_indexr)r1r�r� test_highlight_target_text_mouse�s"

z-HighPageTest.test_highlight_target_text_mousecCs�|j}|j}|j}|��|�d�|��|jdddd�|jdddd�td�D]$}|jdddd�|jdddd�qT||�d	�d
�dS)Nr�r�rrhr�r\r�rk�selr)	r7rHrrarmr rb�ranger�)r%r�r1r��_rrr�"test_highlight_sample_double_click�s
z/HighPageTest.test_highlight_sample_double_clickc	Cs�|j}|j}|j}|��|�d�|��|�d�\}}}}}|�d�|�d�|jd||d�|jd||d�|jd||d�|jd	||d�||�d
�d�dS)Nr�z1.0z<Leave>r�r�rhr�z<B1-Motion>rkr�r)	r7rHrrarmr Z	dlineinforbr�)	r%r�r1r�rirjrorp�offsetrrr�test_highlight_sample_b1_motion�s


z,HighPageTest.test_highlight_sample_b1_motioncCs�|j}|j}|`|j�d�|��||jdt�||jdt�||j	�
�d�|j�d�|��||jdt�||j�
�d�||jdt�||j	�
�d�t�|_dS�NTr�r�F��selectedr)
r7rHr�r�rTr�rr�r
�button_delete_customr�r�rr�rrr�test_set_theme_typesz HighPageTest.test_set_theme_typecCsX|j}|j}tjj}t�}tj_t�}|_|j�d�|j	�d�d|_
|j��||j	�
�d�d|j�|jdd�f|_
|j��||j	�
�d�d|_
|j	�d�|j�d�d|_
|j��||jd	�||j	�
�d�d
|_
|j��||j�
�|j
�||j	�
�d�|j	�d�|j�d�|j��||j	�
�d�|`|tj_dS)
NzEditor Breakpointz#ffffff)NNr�style�
background))g��k@�r��#de0000Tr6zMy New Themer�F)r7rHrZcolorchooserZaskcolorr�get_new_theme_namer�rTr��resultZbutton_set_colorr/rXr��lookup�frame_color_setr�r8r�)r%r�r1Zorig_chooserZchooser�gntnrrr�test_get_colors<




zHighPageTest.test_get_colorcCs�|j}d}|j�d�|j�d�|j�d�|j�|�|�|j�|j	dd�|�|�|j
�dd�|�|�tdd	|ii�dS)
Nz#3f7cae�Python�
Selected TextTr�r��hilite�
foregroundzhilite-foreground)
rHr�rTr��fg_bg_toggler�r7r�r�r�r�tag_cgetr�)r%r1r�rrr�test_on_new_color_setKs
�z"HighPageTest.test_on_new_color_setcCs>tj}tdd�}t_|j}d|_|�|�d�d�|t_dS)NT�Zreturn_selfz	New Themer)r�SectionNamerrHr�r7r��r%Zorig_sectionnameZsnr1rrr�test_get_new_theme_nameXsz$HighPageTest.test_get_new_theme_namecCs�|j}t�}|_|j�d�d|_|j��|�|jt	j
d�d|_d|_|�|jt	j
d�|j��|�|jt	j
d�|`dS)NTrrzmy new themer)
rHrr�r�rTr�Zbutton_save_customr/r�r
rr8rc)r%r1r�rrr�test_save_as_new_themebs

z#HighPageTest.test_save_as_new_themecCs(|j}|j}|j�d�|j�d�d}d}|�|tj�|�|�|t�	dd�|g�|t�
dd�t�
d|��||j��|�|�
|j���||jjd�t�d|d	d
�|�|tj�|�|�|t�	dd�||g�|�t�
d|�t�
d|��t�d|d	d
�|t�
d|�t�
d|��dS)NTr�zmy new custom themezmy second custom themer�rr�r6zhit-background�yellow)r7rHr�rTr�r�r
r�
create_newr�ZGetThemeDictr�rXrYr�r8r�
add_optionrWr��r%r�r1Z	first_newZ
second_newrrr�test_create_new_and_save_newus4

�

�
�z)HighPageTest.test_create_new_and_save_newcCs�|j}|j}|`|j�d�||j��d�||j��d�|�|j	�||j
jd�|j�d�||j��d�||j��d�|�|j	�||j
jd�t�|_dS)	NZCursor)r�r�r�r6�Commentr�rr\)
r7rHr�r�rT�fg_onr��bg_onrBr�r�r8rr�rrr�test_set_highlight_target�sz&HighPageTest.test_set_highlight_targetcCs@|j}|j}|j��|�|jd�|j��|�|jd�dS)Nr6r\)rHr�r�r/r7r8r�)r%r1Zscsrrr�test_set_color_sample_binding�s

z*HighPageTest.test_set_color_sample_bindingcCs\|j}|`|j�d�|j�d�|��|�|j�|jdd�|j	�
dd��t�|_dS)Nr�Tr�r�r�r�)rHr�r�rTr�r7r�r�r�rr�rr9rrr�test_set_color_sample�s�z"HighPageTest.test_set_color_samplec	Cs�|j}|j}|`|jj}tj}|j�d�|j	�d�d}|�
|�d|j_|��ddd�}|�
�D]\}}|�|d|�|�qf||jjd	�|�
�D]\}}t�d
|d||�q�|��|�
�D]\}}||d|�|�q�||jjd�t�|_dS)
NTr�z	IDLE TestrZbluer�)r�r�Zconsoler6rzconsole-r\)r7rHr�rr�r
ZGetHighlightr�rTr�r�r�r8r�rWrr�r)	r%r�rHZhs_tagZghZthemeZnew_console�keyr�rrr�test_paint_theme_sample�s0
�z$HighPageTest.test_paint_theme_samplecCs2|j}|j}|j�d�t�}|_t�t_t�t_d}t	j
d�|dd�ddit|<d}t	j
d�|dd�dd	it|<|j
�d�|j
��|j�|�d
|_|j��||jd�|t|ddi�|t	�dd�||g�|tjjd
�|tjjd
�||jjd
�d|_|j��||jd�|�|t�|t	�dd�|g�||j
��d�||j��|�|tjjd�|tjjd�||jjd�|j�|�d|_|j��||jd�|�|t�|t	�dd�g�||j
��d�||j��d�|tjjd�|tjjd�||jjd�t`t`|`dS)Nr�z
spam themerr�r�r�r�zother themer�Fr6r�rTr\rrxr�r�)r7rHr�r�r�askyesnorr3r'r
rr�r�r�r/r�rTr�r8r�r�r�rX)r%r�r1�yesnoZ
theme_nameZtheme_name2rrr�test_delete_custom�s\



zHighPageTest.test_delete_customN)r(r)r*r�r�rMrOrQr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrrr�s4
	
)	%/

 
 r�c@s�eZdZdZedd��Zedd��Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"S)#�KeysPageTestz�Test that keys tab widgets enable users to make changes.

    Test that widget actions set vars, that var changes add
    options to changes and that key sets works correctly.
    cCs,tj}|_tj�|�t�|_t�|_dSr)rr?rHr=r>r�
set_keys_type�load_keys_listrKrrrrM"szKeysPageTest.setUpClasscCs|j}|`|`dSr)rHrr	rKrrrrO)szKeysPageTest.tearDownClasscCsD|j}t�dd�D]}tjd�|�qt��d|j_d|j	_dS)Nr�rr)
rHr
r�rr�rrrr8r	r�rrrrQ.szKeysPageTest.setUpcCs�t��|j}|j}tjdd�t_|��|�	|j
���||j��d�||j
��d�||j��d�||jjd�||jjd�||jjd�t�ddd	d
�t�dddd
�|��||j��d�||j
��d�||jjd�||jjd�||jjd�tjdd�t_tjdd�t_t�dddd�|��|�|j
���||j��d�||j
��d�||jjd�||jjd�||jjd�t`t`t��dS)N�IDLE Classic OSXr��- no custom keys -r�r6�r
rr�r�r�r�r�r�r\zIDLE Modern Unixr�Keysr�r�rx)r�)rrrHr7rr,r
ZCurrentKeysZload_key_cfgrB�
keyset_sourcerXr�r��custom_keyset_onr�rr8r	�argsr�Zdefault_keysrYrZr�rrr�test_load_key_cfg8s@zKeysPageTest.test_load_key_cfgcCs�|j}|j}t�|_t�|_|j��|tdddii�||jjd�||jjd�t	�
�|j�d�|j��|�tdddii�||jjd�||jjd�|`|`dS)Nr
r�r�r6rr�r�)
r7rHrr�r�Zbuiltin_keyset_onr/rzr8rrrr�r�rrr�test_keyset_sourcebs

zKeysPageTest.test_keyset_sourcecCs2|j}|j}tjd�d�dddg}|j�|d�|tdddd�i�||jdd�||j	j
d	�||j	jd
�t�
�t�dddd�|j�|d�|tdd
dii�||jdd�||j	j
d�||j	jd
�t�
�|j�|d�|tdddd�i�||jdd�||j	j
d�||j	jd�dS)Nrr
�IDLE Classic Windowsr
�IDLE Modern UNIXr�r�zNew key set, see Helpr6)rr�zIDLE Classic Unixr�r\rrxr)r7rHr
rr�r�r�rzZkeys_messager	r8rrrr�r�rrrr�ws4��
zKeysPageTest.test_builtin_namecCst|j}|j�gd�|�dt�|�|jjd�t�	�|j�dddgd�|�tdddii�|�|jjd�dS)	Nrr
rr�r�r�r�r6)
rHr�r�r�rzr7r	r8rrr9rrrr��szKeysPageTest.test_custom_namecCs�t�dddd�|j}|j�d�|j�dd�|j�dd�|j�d	d
�|j�d�|j�	d�|j
�d�|�tdddii�|j�d	�|j�	d	�|j
�d�|�t
dd
dii�dS)
NrZZzDummyZenabler�zmy custom keysr�end�copyr6zz-in�	<Key-F11>ZZzDummy_cfgBindings)r
r�rHr�rT�bindingslist�delete�insert�
selection_set�selection_anchor�
keybindingr7r?�extpager9rrr�test_keybinding�s$
�
�zKeysPageTest.test_keybindingcCs�|j}|j}|`|j�d�|��||jdt�||jdt�||j	�
�d�|j�d�|��||jdt�||j�
�d�||jdt�||j	�
�d�t�|_dSr�)
r7rHrrrTr�rr�r
�button_delete_custom_keysr�rrr�rrr�test_set_keys_type�szKeysPageTest.test_set_keys_typecCs�|j}|j}tj}tdd�}t_t�}|_|j�d�|j�	dd�|j�
dd�|j�d�|j�d�|j
�d�|j�d�d|_|j��||j�d	�d�||j
��d�d
|_d|_|j��||jd�||j�d	�d�d|_|j��||j��|j�||j�d	�d
�||j
��d
�|j�d�d|_d|_|j��||jd�||j�d	�d�||j
��d�|`|t_dS)NTr�r�rrzcopy - <Control-Shift-Key-C>zKey-arrlrr6zMy New Key Setzcopy - <Key-F11>Fz<Key-p>zcopy - <Key-p>)r7rHrZ
GetKeysDialogr�get_new_keys_name�button_new_keysr�rrrrrrrTrr�r/rXr8r�)r%r�r1Zorig_getkeysdialogZgkd�gnknrrr�test_get_new_keys�sF



zKeysPageTest.test_get_new_keyscCs>tj}tdd�}t_|j}d|_|�|�d�d�|t_dS)NTr�zNew Keysr)rr�rrHr�r7r"r�rrr�test_get_new_keys_name�sz#KeysPageTest.test_get_new_keys_namecCst|j}t�}|_|j�d�d|_|j��d|_d|_|�	|jt
jd�|j��|�|jt
jd�|`dS)NTrzmy new key setrr)
rHrr"rrTr�Zbutton_save_custom_keysr/r8r�r
rrc)r%r1r$rrr�test_save_as_new_key_set	s

z%KeysPageTest.test_save_as_new_key_setcCs�|j}|j}|�dd�|�dd�|�dd�|�d�|��|�d�|��|�d�\}}}}||d7}||d7}|j	dddd�|j	d	||d�|j	d
||d�|j	d||d�|�
|�d�d�|�
|j�
�d
�dS)Nrrrr6�findr\r�rhr�rgrkrlr)rHrrrr4rarmrJrnrbr7rXr#r�)r%r1r�rirjrorprrr�test_on_bindingslist_selects$

z(KeysPageTest.test_on_bindingslist_selectcCs|j}|j}|j�d�|j�d�d}d}|�|tj�|�|�|t�	dd�|g�|t�
d�t�
|��||j��|�|�
|j���||jjd�t�d|dd	�|�|tj�|�|�|t�	dd�||g�|�t�
|�t�
|��t�d|dd	�|t�
|�t�
|��dS)
NTrzmy new custom key setzmy second custom keysetr�rr6rr)r7rHrrTr�r�r
rZcreate_new_key_setr��	GetKeySetr�rXrYrr8rr�rWr�r�rrr�,test_create_new_key_set_and_save_new_key_set0s0

�
�z9KeysPageTest.test_create_new_key_set_and_save_new_key_setcCsV|j}|j}t�}t_|`|j}|�dd�|�dd�|�dd�ddgdgd	gd
�|_	t
�ddd
d�d}|�d�||�dd�|�||�d�d�||�
�d�|�d�|�d�|�d�||�dd�|�||�d�d�||�
�d�|�d�|�d�|�d�||�dd�|�||�d�d�||�
�d�t�|_t`dS)Nrrz<<find>>r6z<<help>>z<Control-Key-c>z<Control-Key-C>z<Control-Key-space>r)z<<copy>>z<<force-open-completions>>z<<spam>>rzmy keysr�z
<Shift-Key-a>)z&copy - <Control-Key-c> <Control-Key-C>�,force-open-completions - <Control-Key-space>�spam - <Shift-Key-a>rlrrr,)r6r\r-)r\)r7rHrr
r*r	rrrr�rr�rXZcurselectionrr)r%r�r1Zgksr�r{rrr�test_load_keys_listOs@�






z KeysPageTest.test_load_keys_listcCs2|j}|j}|j�d�t�}|_t�t_t�t_d}t	j
d�|dd�ddit|<d}t	j
d�|dd�dd	it|<|j
�d�|j
��|j�|�d
|_|j��||jd�|t|ddi�|t	�dd�||g�|tjjd
�|tjjd
�||jjd
�d|_|j��||jd�|�|t�|t	�dd�|g�||j
��d�||j��|�|tjjd�|tjjd�||jjd�|j�|�d|_|j��||jd�|�|t�|t	�dd�g�||j
��d�||j��d�|tjjd�|tjjd�||jjd�t`t`|`dS)Nr�zspam key setrr�r�r�r�z
other key setr�Fr6r�rTr\rrxr�r)r7rHr r�rrrr3r'r
rr�r?rr/r�rTr�r8r�rr�rX)r%r�r1rZkeyset_nameZkeyset_name2rrr�test_delete_custom_keyszs\



z$KeysPageTest.test_delete_custom_keysN)r(r)r*r�r�rMrOrQrrr�r�rr!r%r&r'r)r+r.r/rrrrrs&


* 0
+rc@s�eZdZdZedd��Zedd��Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&S)'�GenPageTestz�Test that general tab widgets enable users to make changes.

    Test that widget actions set vars, that var changes add
    options to changes and that helplist works correctly.
    cCs@tj}|_tj�|�t�|_|_t�|_|_	|�
�dSr)rZgenpagerHr=r>rrT�set_add_delete_state�upc�update_help_changesrJrKrrrrM�s
zGenPageTest.setUpClasscCs2|j}|`|`|`|`|j�dd�|j��dS)Nrr)	rHrTr1r2r3�helplistr�
user_helplistrrKrrrrO�s
zGenPageTest.tearDownClasscCst��dSrrPr$rrrrQ�szGenPageTest.setUpcCs�|j}|j}|j�d�|j�d�|j�d�|j�d�|j�dd�ddg|_	t
�dddd�|��||j�
�d	�||j�
�d	�||j�
�d
�||j�
�d�||j�
d	d�d�||j	d
g�dS)Nr6rZbadZworser�	HelpFilesrRz	name;filerZ80rs)r�)r��filerR)r7rHZstartup_editrT�autosaveZ	win_widthZ
win_heightr4rr5r
r�Zload_general_cfgrXr�rrr�test_load_general_cfg�s 
z!GenPageTest.test_load_general_cfgcCsN|j}|j��|�tdddii�t��|j��|�tdddii�dS)N�Generalzeditor-on-startuprRr�)rHZstartup_editor_onr/r7rzrrZstartup_shell_onr9rrr�test_startup�s

�

�zGenPageTest.test_startupcCsr|j}|j�dd�|j�dd�|�tdddii�t��|j�dd�|j�dd�|�tdddii�dS)Nrr�11rvZheight�width)	rHZwin_height_intrrr7rzrrZ
win_width_intr9rrr�test_editor_size�szGenPageTest.test_editor_sizecCs$|jj��|�tdddii�dS)Nrvzcursor-blinkr�)rHZcursor_blink_boolr/r7rzr$rrr�test_cursor_blink�szGenPageTest.test_cursor_blinkcCs8|jj�dd�|jj�dd�|�tdddii�dS)Nrrr<ZAutoCompleteZ	popupwait)rHZ
auto_wait_intrrr7rr$rrr�test_autocomplete_wait�sz"GenPageTest.test_autocomplete_waitcCs�|j}|j}|jd�d�|tdddii�t��|j�dd�|j�	dd�|tdddii�t��|j
��|tdd	d
ii�dS)NZmenurZ
ParenMatchr�Zopenerrr<zflash-delayZbellr�)rHr7Zparen_style_typer/rrrZparen_flash_timerrZbell_onr�rrr�test_parenmatch�s
zGenPageTest.test_parenmatchcCsF|j}|j��|�tdddii�|j��|�tdddii�dS)Nr:r8rRr�)rHZsave_auto_onr/r7rzZsave_ask_onr9rrr�
test_autosaves


zGenPageTest.test_autosavecCs8|jj�dd�|jj�dd�|�tdddii�dS)Nrrr<ZFormatParagraphz	max-width)rHZformat_width_intrrr7rr$rrr�test_paragraphszGenPageTest.test_paragraphcCs8|jj�dd�|jj�dd�|�tdddii�dS)NrrrRZCodeContextZmaxlines)rHZcontext_intrrr7rr$rrr�test_contextszGenPageTest.test_contextcCs�|j}|j|_|j|_|j}d}|�|d�|�|�|��|�	|�|�
�|�|�\}}}}||d7}||d7}d|j_|j_|j
dddd�|j
d||d�|j
d||d�|j
d	||d�|�|�d
�d�|�|jj�|�|jj�dS)Nr�sourcer\rr�rhr�rgrkrl)rHr1rTr3r2r4rr4rarmrJrnr8rbr7rXrBrY)r%r1r4Zdexrirjrorprrr�test_source_selecteds*

z GenPageTest.test_source_selectedcCs�|j}|j}|`|j}|j}|�dd�|�||j��d�||j��d�|�dd�|�||j��d�||j��d�|�	d�|�||j��d�||j��d�t
�|_dS)Nrrr�rEr)r7rHr1r4rZbutton_helplist_editr�Zbutton_helplist_removerrr)r%r�r1Zsad�hrrr�test_set_add_delete_state5s$
z%GenPageTest.test_set_add_delete_statecCs�|j}tj}tdd�}t_|j}|j�dd�|j��d|j	_
|j_
d|_|�
�|�t|j�dd��|jko~gkn�|�|jj
�d|_|�
�d|_|�
�||j�dd�d�||jddg�||jj
d	�|�|j	j
�|t_dS)
NTr�rrr��name1Zfile1�r�Zfile2)rJr�r\)r7r�
HelpSourcerrHr4rr5rrTr8r2r�Zhelplist_item_addrB�listrXrY�r%r�Zorig_helpsourcer�r1rrr�test_helplist_item_addMs0
��z"GenPageTest.test_helplist_item_addcCs*|j}tj}tdd�}t_|j}|j�dd�|j�dd�|j�d�|j�	d�|j
��|j
�d�d|j
_|j_d|_|��d|_|��||j�dd�d�||j
dg�|�|jj�d	|_|��||j�dd�d
�||j
d	g�|�|jj|j
jk�odkn�|t_dS)NTr�rrrJrIr)rJrK)r�r6)r7rrLrrHr4rrrrr5r�appendrTr8r2r�Zhelplist_item_editrXrYrBrNrrr�test_helplist_item_editis0
(z#GenPageTest.test_helplist_item_editcCs�|j}|j}|j�dd�|j�dd�|j�d�|j�d�|j��|j�	d�d|j
_|j_|�
�||j�dd�d�||jg�|�|jj|j
jko�dkn�dS)NrrrJrIrr6)r7rHr4rrrrr5rrPrTr8r2Zhelplist_item_removerXrBr�rrr�test_helplist_item_remove�s
z%GenPageTest.test_helplist_item_removecCsV|j}|`|j��|j�d�|j�d�|��|�tdddd��t�|_dS)NrIrKr6zname1;file1zname2;file2)rR�2)rHr3r5rrPr7rzrr9rrr�test_update_help_changes�s

�z$GenPageTest.test_update_help_changesN)r(r)r*r�r�rMrOrQr9r;r>r?r@rArBrCrDrFrHrOrQrRrTrrrrr0�s*




r0c@sdeZdZedd��Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dS)�VarTraceTestcCs"t��|_tt�|_tt�|_dSr)rZVarTracerrr�ivr	�bvrNrrrrM�s

zVarTraceTest.setUpClasscCs|`|`|`dSr)rrVrWrNrrrrO�szVarTraceTest.tearDownClasscCs|j��d|_dSr�)rrr8r$rrrrQ�s
zVarTraceTest.setUpcGs|jd7_dS)N�
)r8�r%Zparamsrrr�var_changed_increment�sz"VarTraceTest.var_changed_incrementcGsdSrrrYrrr�var_changed_boolean�sz VarTraceTest.var_changed_booleancCs.|j}|��|�|jg�|�|jg�dSr)r�__init__r7�untraced�traced�r%�trrrr�	test_init�szVarTraceTest.test_initcCsF|j}|j�d�|j�d�|��|�|jg�|�|jg�dS)Nrr6)rr]rPr^rr7r_rrr�
test_clear�szVarTraceTest.test_clearc	Cs�|j}t�}tj|d�}|_|�|j|j�}|�||j�|�|j	|j
�}|�||j	�tt�}|�|d�}|�||�|�
�|�|d�||jf||j
f||fg}|�|jg�|�|j|�|`dS)Nr��rr�r�)rrrr,�
make_callback�addrVrZZassertIsrWr[rrr0Zassert_called_withr7r^r])	r%r`�func�cbrVrWZsvZsv2r{rrr�test_add�s&�zVarTraceTest.test_addcCst|j�|jd�}|�t|��|j�d�|�dtd�|�|�dtd�|�	tdddd�t�
�dS)Nrc�*r�rr�Z42)rrdrVrB�callablerTr�rrcr7r)r%rgrrr�test_make_callback�szVarTraceTest.test_make_callbackcCs�|j}|�|j|j�}|�|j|j�}||jf||jfg}|��|�|jg�|�	|j
|�|�d�|�|��d�|�|j
d�d|_
|��|�d�|�|j
d�d|_
|��|�|j
g�|�	|j|�|�d�|�|j
d�dS)Nr6rXr)rrerVrZrWr[rZr7r]ZassertCountEqualr^rTrXr8r)r%r`rVrWr{rrr�test_attach_detach�s,�


zVarTraceTest.test_attach_detachN)r(r)r*r�rMrOrQrZr[rarbrhrkrlrrrrrU�s

rU�__main__r\)�	verbosity),r�ZidlelibrZtest.supportrZunittestrZidlelib.idle_test.mock_idlerZtkinterrrrr	r
rrZidlelib.configdialogr
rrrrZIdleUserConfParserrrrrzr�r?rrr"ZTestCaser#r+rFr�r�rr0rUr(rrrrr�<module>sT �	+oh