Your IP : 3.144.91.130


Current Path : /opt/alt/python36/lib64/python3.6/idlelib/idle_test/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/idlelib/idle_test/__pycache__/test_configdialog.cpython-36.pyc

3

� fg��@sndZddlmZddlmZed�ddlZddlmZddlmZddl	m
Z
mZmZm
Z
mZmZdd	lmZdd
lmZmZmZejZejd�ejd�ejd�ejd�d�Zdadaed
ZedZedZedZdd�Zdd�Z Gdd�dej!�Z"Gdd�dej!�Z#Gdd�dej!�Z$Gdd�dej!�Z%Gdd�dej!�Z&Gdd �d ej!�Z'e(d!k�rjej)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/python36/lib64/python3.6/idlelib/idle_test/test_configdialog.py�setUpModule!srcCs:tt_tj�tj�tj�tj�tj	�daa
dS)N)�usercfgr
rr�detach�clearrr�update_idletasksZdestroyrrrrr�tearDownModule(sr 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}|_tjj|�t�|_|j�dS)N)r�fontpage�page�note�selectr�set_samples�update)�clsr#rrr�
setUpClass:szFontPageTest.setUpClasscCs
|j`dS)N)r#r&)r(rrr�
tearDownClassAszFontPageTest.tearDownClasscCstj�dS)N)rr)�selfrrr�setUpEszFontPageTest.setUpcCs�tj�|j}|jjd�|jjd�|jjd�d|j_|j	�|j
|jj�d�|j
|jj�d�|j|jj��|j
|jjd�tj�dS)NZFake�1Tr�)rrr#�	font_name�set�	font_size�	font_boldr&�calledZ
load_font_cfg�assertNotEqual�get�assertFalse�assertEqual�attach)r+�drrr�test_load_font_cfgHszFontPageTest.test_load_font_cfgcCs�|j}|jj�dkr|jd�|j}|jd�|jjd�}|j�|j�|jd�|jd�|jd�}|j	||�|j
|jj�|j��|j�|j�|jd�|jd�|jd�}|j
||�|j
|jj�|j��dS)	N�zneed at least 2 fontsrZactivez
<Key-Down>z<KeyRelease-Down>z<Key-Up>z<KeyRelease-Up>)r#�fontlist�size�skipTest�activater5�focus_forcer'�event_generater4�assertInr/�lowerr7)r+r9r<�fontZ	down_fontZup_fontrrr�test_fontlist_keyXs(







zFontPageTest.test_fontlist_keyc	Cs�|j}|jj�dkr|jd�|j}|jd�|j�|jd�|j�|jd�\}}}}||d7}||d7}|j	d||d�|j	d||d�|j
d�}|j
d�}|j||�|j|j
j
�|j��dS)	Nr;zneed at least 2 fontsrr.z
<Button-1>)�x�yz<ButtonRelease-1>�anchor)r#r<r=r>r?r@�seer'�bboxrAr5r7rBr/rC)	r+r9r<rFrG�dx�dyZfont1Zselect_fontrrr�test_fontlist_mouseus"




z FontPageTest.test_fontlist_mousecCs*|j}|jjjd�|j|jj�d�dS)N�(�40)r#ZsizelistZvariabler0r7r1r5)r+r9rrr�
test_sizelist�szFontPageTest.test_sizelistcCsJ|j}|jjd�|jj�|j|jj��|jj�|j|jj��dS)NF)r#r2r0Zbold_toggle�invoke�
assertTruer5r6)r+r9rrr�test_bold_toggle�s

zFontPageTest.test_bold_togglecCstjtdd�}t|d�}|ddk}|j}|jj|�|jj|�d|j_	|j
jd�dd|t|�d�i}|jt|�|j|jj	d�t
j�|jjd	�ddd	t|�d�i}|jt|�|j|jj	d�t
j�|jj|�ddd	t|�d�i}|jt|�|j|jj	d
�dS)Nr�EditorWindowr.r;�boldrz	Test Font)rDz	font-sizez	font-boldZ20�)r
ZGetFontr�strr#r1r0r2r&r3r/r7�mainpagerr)r+Zdefault_fontZdefault_sizeZdefault_boldr9�expectedrrr�
test_font_set�s6zFontPageTest.test_font_setcCs�|j}|`|j|jf}ii|_|_|jjd�|jjd�|jjd�ddi}|j�|j|j|jkor|kn�|\|_|_t	�|_dS)N�test�5r.rDrU)r[r\rU)
r#r&Zfont_sample�highlight_sampler/r0r1r2rRr)r+r9Zorig_samplesrYrrr�test_set_samples�s"zFontPageTest.test_set_samplesN)�__name__�
__module__�__qualname__�__doc__�classmethodr)r*r,r:rErMrPrSrZr^rrrrr!3s	$r!c@s(eZdZedd��Zdd�Zdd�ZdS)�
IndentTestcCstj|_|jj�dS)N)rr"r#r')r(rrrr)�szIndentTest.setUpClasscCs0|j}|jjd�|j�|j|jj�d�dS)N��)r#�	space_numr0Zload_tab_cfgr7r5)r+r9rrr�test_load_tab_cfg�szIndentTest.test_load_tab_cfgcCsD|j}tj�|jjd�|j|jj�d�|jtdddii�dS)N�reZIndentz
num-spacesZ16)	r#rrZindent_scaler0r7rgr5rX)r+r9rrr�test_indent_scale�s
zIndentTest.test_indent_scaleN)r_r`rarcr)rhrjrrrrrd�srdc@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,S)-�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}|_tjj|�t�|_t�|_t�|_t�|_	|j
�dS)N)r�highpager#r$r%r�set_theme_type�paint_theme_sample�set_highlight_target�set_color_sampler')r(r#rrrr)�szHighPageTest.setUpClasscCs|j}|`|`|`|`dS)N)r#rmrnrorp)r(r9rrrr*�szHighPageTest.tearDownClasscCsX|j}x$tjdd�D]}tjdj|�qWtj�d|j_d|j	_d|j
_d|j_dS)N�userrr)r#r
�GetSectionListr�remove_sectionrrrmr3rnrorp)r+r9�sectionrrrr,�szHighPageTest.setUpcCs�tj�|j}|j}tjdd�t_|j�|j	|j
j��||jj�d�||j
j�d�||jj�d�||jjd�||jjd�||jjd�tjdddd	�tjdd
dd�|j�||jj�d�||j
j�d�||jjd
�||jjd
�||jjd
�tjd
d�t_tjdddd�|j�|j|j
j��||jj�d�||j
j�d
�||jjd�||jjd�||jjd�t`tj�dS)NzIDLE Classic)�return_valuez- no custom themes -�disabledr.r�test1�option�value�test2�option2�value2r;r�Theme�default�0rV)rv)rrr#r7r�Mockr
ZCurrentThemeZload_theme_cfgrR�theme_sourcer5�builtin_name�custom_name�custom_theme_on�statermr3rnro�	SetOptionr6r8)r+r9�eqrrr�test_load_theme_cfg	s>z HighPageTest.test_load_theme_cfgcCs�|j}|j}t�|_t�|_|jj�|tdddii�||jjd�||jjd�t	j
�|jjd�|jj�|jtdddii�||jjd�||jjd�|`|`dS)	Nr}r~�Truer.r�	!disabled�False)r�)
r7r#r�var_changed_builtin_name�var_changed_custom_nameZbuiltin_theme_onrQrXr3rrr�r�)r+r�r9rrr�test_theme_source2s

zHighPageTest.test_theme_sourcecCs|j}|j}dddg}tjdddd�|jj|d�|tdddd�i�||jd	d
�||jj	d�t
j�tjdddd�|jj|d�|tdddii�||jd	d
�||jj	d
�t
j�|jj|d�|tdddd�i�||jd	d�||jj	d�dS)NzIDLE Classicz	IDLE DarkzIDLE Newrr}�name�spam)r��name2�textzNew theme, see Helpr.r�r;rrV)r7r#r
r��builtinlist�SetMenurXZ
theme_messagernr3rr)r+r�r9�	item_listrrr�test_builtin_nameGs(
zHighPageTest.test_builtin_namecCst|j}|jjgd�|jdt�|j|jjd�tj	�|jjdddgd�|jtdddii�|j|jjd�dS)	Nz- no custom themes -r}r�a�b�cr�r.)
r#�
customlistr��assertNotInrXr7rnr3rr)r+r9rrr�test_custom_namecszHighPageTest.test_custom_namecCs2|j}t�|_|jjd�|j|jjd�|`dS)NZgreenr.)r#rZon_new_color_set�colorr0r7r3)r+r9rrr�
test_colorqs
zHighPageTest.test_colorcCsB|j}|j}|jjdddgd�||jj�d�||jjd�dS)Nr�r�r�r.)r7r#Z
targetlistr��highlight_targetr5ror3)r+r�r9rrr� test_highlight_target_list_mouseys
z-HighPageTest.test_highlight_target_list_mousecs�|j}|j�i}d}�j��j��jd��j��fdd�}�fdd�}||�x`�j�D]T}xN�j|�ddd�D]6}|d7}||�|�jj	�||�|�j
j|�qxWq^WdS)	Nrg�?cs(x"�jj�D]\}}|||d<qWdS)Nr)Ztheme_elements�items)�elem�element�tag)r9rr�tag_to_element�szEHighPageTest.test_highlight_target_text_mouse.<locals>.tag_to_elementcsn�j|�\}}}}||d7}||d7}�jdddd��jd||d��jd||d��jd||d�dS)Nr;z<Enter>r)rFrGz<Motion>z<ButtonPress-1>z<ButtonRelease-1>)rJrA)�startrFrGrKrL)�hsrr�click_it�sz?HighPageTest.test_highlight_target_text_mouse.<locals>.click_itr;r.)r7r#r]r@rIrZ	tag_namesZ
tag_rangesr�r5ror3)r+r�r��countr�r�r�Zstart_indexr)r9r�r� test_highlight_target_text_mouse�s"

z-HighPageTest.test_highlight_target_text_mousecCs�|j}|j}|`|jjd�|j�||jdt�||jdt�||j	j
�d�|jjd�|j�||jdt�||jj
�d�||jdt�||j	j
�f�t�|_dS)NTr�rvF�selected)rv)r�)
r7r#rmr�r0r�rr�r
�button_delete_customr�r�r)r+r�r9rrr�test_set_theme_type�sz HighPageTest.test_set_theme_typecCsX|j}|j}tjj}t�}tj_t�}|_|jjd�|j	jd�d
|_
|jj�||j	j
�d�d|jj|jdd�f|_
|jj�||j	j
�d�d|_
|j	jd�|jjd	�d|_
|jj�||jd
�||j	j
�d�d|_
|jj�||jj
�|j
�||j	j
�d�|j	jd�|jjd�|jj�||j	j
�d�|`|tj_dS)NzEditor Breakpointz#ffffffr�style�
background���k@��#de0000Tr.zMy New ThemeF)NN�r�r�r�)r�r�)r7r#rZtkColorChooserZaskcolorr�get_new_theme_namer�r0r��resultZbutton_set_colorrQr5r��lookup�frame_color_setr�r3r�)r+r�r9Zorig_chooserZchooser�gntnrrr�test_get_color�s<




zHighPageTest.test_get_colorcCs�|j}d}|jjd�|jjd�|jjd�|jj|�|j|jj|j	dd�|�|j|j
jdd�|�|jtdd	|ii�dS)
Nz#3f7cae�Pythonz
Selected TextTr�r��hilite�
foregroundzhilite-foreground)
r#r�r0r��fg_bg_toggler�r7r�r�r�r]�tag_cgetrl)r+r9r�rrr�test_on_new_color_set�sz"HighPageTest.test_on_new_color_setcCs>tj}tdd�}t_|j}d|_|j|jd�d�|t_dS)NT)�return_selfz	New Themer)r�SectionNamerr#r�r7r�)r+�orig_sectionname�snr9rrr�test_get_new_theme_name�sz$HighPageTest.test_get_new_theme_namecCs�|j}t�}|_|jjd�d|_|jj�|j|jt	j
d�d|_d|_|j|jt	j
d�|jj�|j|jt	j
d�|`dS)NTrrzmy new themer)
r#rr�r�r0r�Zbutton_save_customrQr�r
rr3rB)r+r9r�rrr�test_save_as_new_themes

z#HighPageTest.test_save_as_new_themecCs(|j}|j}|jjd�|jjd�d}d}|j|tj�|j|�|tj	dd�|g�|tj
dd�tj
d|��||jj�|�|j
|jj��||jjd�tjd|d	d
�|j|tj�|j|�|tj	dd�||g�|jtj
d|�tj
d|��tjd|d	d
�|tj
d|�tj
d|��dS)NTzIDLE Classiczmy new custom themezmy second custom themerqrr~r.zhit-background�yellow)r7r#r�r0r�r�r
r�
create_newrrZGetThemeDictr�r5r6rmr3r�
add_optionr4r�)r+r�r9�	first_new�
second_newrrr�test_create_new_and_save_news.

z)HighPageTest.test_create_new_and_save_newcCs�|j}|j}|`|jjd�||jj�d�||jj�d�|j|j	�||j
jd�|jjd�||jj�d	�||jj�f�|j|j	�||j
jd�t�|_dS)
NZCursorrvr�r.�Commentr;)rvr�)rv)r�)
r7r#ror�r0�fg_onr��bg_onrRr�rpr3r)r+r�r9rrr�test_set_highlight_target5sz&HighPageTest.test_set_highlight_targetcCs@|j}|j}|jj�|j|jd�|jj�|j|jd�dS)Nr.r;)r#rpr�rQr7r3r�)r+r9Zscsrrr�test_set_color_sample_bindingJs

z*HighPageTest.test_set_color_sample_bindingcCs\|j}|`|jjd�|jjd�|j�|j|jj|jdd�|j	j
dd��t�|_dS)Nz
Selected TextTr�r�r�r�)r#rpr�r0r�r7r�r�r�r]r�r)r+r9rrr�test_set_color_sampleTsz"HighPageTest.test_set_color_samplecCsX|j}|j}|`|jj}tj}d}d}|jjd�|j	jd�d}|j
|�d|j_|j�||d|�||ddd	��||d
|�||ddd	��|j
|d
|�d�|j
|d
|�d�||jjd�tjd|dd�tjd|dd�|j�||d|�||ddd	��||d
|�||ddd	��||d
|�d�||d
|�d�||jjd�t�|_dS)Nr�r�Tz	IDLE Darkz	IDLE Testr�break�fg)ZfgBgZcursorZnormal�bgZconsoleZbluer�r.rzconsole-foregroundzconsole-backgroundr;)r7r#rnr]r�r
ZGetHighlightr�r0r�r�rpr3r4rr�r)r+r�r9Zhs_tagZghr�r�Zthemerrr�test_paint_theme_sample_s6
z$HighPageTest.test_paint_theme_samplecCsp|j}|j}|jjd�t�}|_t�t_t�t_d}t	j
dj|dd�ddit|<|j
jd�|jj|�d|_|jj�||jd	�|t|ddi�|t	jd
d�dg�|tjjd�|tjjd�||jjd�d|_|jj�||jd
�|j|t�|t	jd
d�g�||jj�d�||jj�d�|tjjd	�|tjjd	�||jjd	�t`t`|`dS)N�	!disabledz
spam themerr�ryrxr�Fr.rqrTr;rvz- no custom themes -)r�)rv)r7r#r�r�r�askyesnor�deactivate_current_config�activate_config_changesr
rr�rlr�r0r�r�rQr3rrrmr�r�r5)r+r�r9�yesnoZ
theme_namerrr�test_delete_custom�s>

zHighPageTest.test_delete_customN)r_r`rarbrcr)r*r,r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrk�s,
)	%/

 
%rkc@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}|_tjj|�t�|_t�|_dS)N)r�keyspager#r$r%r�
set_keys_type�load_keys_list)r(r#rrrr)�szKeysPageTest.setUpClasscCs|j}|`|`dS)N)r#r�r�)r(r#rrrr*�szKeysPageTest.tearDownClasscCsH|j}x$tjdd�D]}tjdj|�qWtj�d|j_d|j	_dS)Nrqrr)
r#r
rrrrsrrr�r3r�)r+r9rtrrrr,�szKeysPageTest.setUpcCs�tj�|j}|j}tjdd�t_|j�|j	|j
j��||jj�d�||j
j�d�||jj�d�||jjd�||jjd�||jjd�tjdddd	�tjdd
dd�|j�||jj�d�||j
j�d�||jjd
�||jjd
�||jjd�tjd
d�t_tjdd�t_tjdddd�|j�|j|j
j��||jj�d�||j
j�d
�||jjd�||jjd�||jjd�t`t`tj�dS)N�IDLE Classic OSX)ruz- no custom keys -rvr.rrwrxryrzr{r|r;zIDLE Modern Unixr�Keysr~rrV)rv)r�)r�)rz)rrr#r7rr�r
ZCurrentKeysZload_key_cfgrR�
keyset_sourcer5r�r��custom_keyset_onr�r�r3r��argsr�Zdefault_keysr6r8)r+r9r�rrr�test_load_key_cfg�s@zKeysPageTest.test_load_key_cfgcCs�|j}|j}t�|_t�|_|jj�|tdddii�||jjd�||jjd�t	j
�|jjd�|jj�|jtdddii�||jjd�||jjd�|`|`dS)	Nr�r~r�r.r�	!disabledr�)r�)
r7r#rr�r�Zbuiltin_keyset_onrQrXr3rrr�r�)r+r�r9rrr�test_keyset_source�s

zKeysPageTest.test_keyset_sourcecCs2|j}|j}tjdjd�dddg}|jj|d�|tdddd�i�||jdd�||j	j
d	�||j	jd�tj
�tjddd
d�|jj|d�|tdddii�||jdd�||j	j
d
�||j	jd�tj
�|jj|d�|tdddd�i�||jdd�||j	j
d�||j	jd�dS)Nrr�zIDLE Classic Windows�IDLE Classic OSX�IDLE Modern UNIX)r�r�r�zNew key set, see Helpr.r�zIDLE Classic Unixr�r;rrV)r�)r�)r�)r7r#r
rrsr�r�rXZkeys_messager�r3r�rrr�)r+r�r9r�rrrr�
s0zKeysPageTest.test_builtin_namecCst|j}|jjgd�|jdt�|j|jjd�tj	�|jjdddgd�|jtdddii�|j|jjd�dS)	Nz- no custom keys -r�rr�r�r�r�r.)
r#r�r�r�rXr7r�r3rr)r+r9rrrr�*szKeysPageTest.test_custom_namecCs�tjdddd�|j}|jjd�|jjdd�|jjdd�|jjd	d
�|jjd�|jj	d�|j
jd�|jtdddii�|jjd	�|jj	d	�|j
jd�|jt
dd
dii�dS)
NrZZzDummy�enabler�zmy custom keysr�end�copyr.zz-inz	<Key-F11>ZZzDummy_cfgBindings)r
r�r#r�r0�bindingslist�delete�insert�
selection_set�selection_anchor�
keybindingr7r��extpage)r+r9rrr�test_keybinding8s zKeysPageTest.test_keybindingcCs�|j}|j}|`|jjd�|j�||jdt�||jdt�||j	j
�d�|jjd�|j�||jdt�||jj
�d�||jdt�||j	j
�f�t�|_dS)NTr�rvFr�)rv)r�)
r7r#r�r�r0r�rr�r
�button_delete_custom_keysr�r�r)r+r�r9rrr�test_set_keys_typeMszKeysPageTest.test_set_keys_typecCs�|j}|j}tj}tdd�}t_t�}|_|jjd�|jj	dd�|jj
dd�|jjd�|jjd�|j
jd�|jjd�d|_|jj�||jjd	�d�||j
j�d�d
|_d|_|jj�||jd�||jjd	�d�d|_|jj�||jj�|j�||jjd	�d
�||j
j�d
�|jjd�d|_d|_|jj�||jd�||jjd	�d�||j
j�d�|`|t_dS)NT)r��	!disabledrr�zcopy - <Control-Shift-Key-C>zKey-arrHz	<Key-F11>r.zMy New Key Setzcopy - <Key-F11>Fz<Key-p>zcopy - <Key-p>)r�)r7r#rZ
GetKeysDialogr�get_new_keys_name�button_new_keysr�r�r�r�r�r�r�r0r�r�rQr5r3r�)r+r�r9Zorig_getkeysdialogZgkd�gnknrrr�test_get_new_keysbsF



zKeysPageTest.test_get_new_keyscCs>tj}tdd�}t_|j}d|_|j|jd�d�|t_dS)NT)r�zNew Keysr)rr�rr#r�r7r�)r+r�r�r9rrr�test_get_new_keys_name�sz#KeysPageTest.test_get_new_keys_namecCst|j}t�}|_|jjd�d|_|jj�d|_d|_|j	|jt
jd�|jj�|j|jt
jd�|`dS)NTrzmy new key setrr)
r#rr�r�r0r�Zbutton_save_custom_keysrQr3r�r
rrB)r+r9r�rrr�test_save_as_new_key_set�s

z%KeysPageTest.test_save_as_new_key_setcCs�|j}|j}|jdd�|jdd�|jdd�|jd�|j�|jd�|j�|jd�\}}}}||d7}||d7}|j	dddd�|j	d	||d�|j	d
||d�|j	d||d�|j
|jd�d�|j
|jj
�f�dS)
Nrr�r�r.�findr;z<Enter>)rFrGz<Motion>z
<Button-1>z<ButtonRelease-1>rH)r#r�r�r�r?r@rIr'rJrAr7r5r�r�)r+r9r�rFrGrKrLrrr�test_on_bindingslist_select�s$

z(KeysPageTest.test_on_bindingslist_selectcCs|j}|j}|jjd�|jjd�d}d}|j|tj�|j|�|tj	dd�|g�|tj
d�tj
|��||jj�|�|j
|jj��||jjd�tjd|dd	�|j|tj�|j|�|tj	dd�||g�|jtj
|�tj
|��tjd|dd	�|tj
|�tj
|��dS)
NTzIDLE Classic Windowszmy new custom key setzmy second custom keysetrqrr.r�z	<Key-F11>)r7r#r�r0r�r�r
rZcreate_new_key_setrr�	GetKeySetr�r5r6r�r3rr�r4r�)r+r�r9r�r�rrr�,test_create_new_key_set_and_save_new_key_set�s,


z9KeysPageTest.test_create_new_key_set_and_save_new_key_setcCsV|j}|j}t�}t_|`|j}|jdd�|jdd�|jdd�ddgdgd	gd
�|_	t
jddd
d�d}|jd�||jdd�|�||jd�d�||j
�f�|jd�|jd�|jd�||jdd�|�||jd�d�||j
�d�|jd�|jd�|jd�||jdd�|�||jd�d�||j
�d�t�|_t`dS)Nrr�z<<find>>r.z<<help>>z<Control-Key-c>z<Control-Key-C>z<Control-Key-space>z	<Key-F11>)z<<copy>>z<<force-open-completions>>z<<spam>>rzmy keysr�z
<Shift-Key-a>�&copy - <Control-Key-c> <Control-Key-C>�,force-open-completions - <Control-Key-space>�spam - <Shift-Key-a>rHrr;)rrr)r.)r;)r7r#rr
rr�r�r�r�r�rr�r5Zcurselectionr�r�)r+r�r9Zgksr�rYrrr�test_load_keys_list�sB






z KeysPageTest.test_load_keys_listcCsp|j}|j}|jjd�t�}|_t�t_t�t_d}t	j
dj|dd�ddit|<|j
jd�|jj|�d|_|jj�||jd	�|t|ddi�|t	jd
d�dg�|tjjd�|tjjd�||jjd�d|_|jj�||jd
�|j|t�|t	jd
d�g�||jj�d�||jj�d�|tjjd	�|tjjd	�||jjd	�t`t`|`dS)N�	!disabledzspam key setrr�ryrxr�Fr.rqrTr;rvz- no custom keys -)r)rv)r7r#r�r�rr�rr�r�r
rr�r�r�r0r�r�rQr3rrr�r�r�r5)r+r�r9r�Zkeyset_namerrr�test_delete_custom_keys
s>

z$KeysPageTest.test_delete_custom_keysN)r_r`rarbrcr)r*r,r�r�r�r�r�r�r�r�r�r�rrrrrrrr��s"
* 0
+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$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}|_tjj|�t�|_|_t�|_|_	|j
�dS)N)rZgenpager#r$r%rr0�set_add_delete_state�upc�update_help_changesr')r(r#rrrr)=s
zGenPageTest.setUpClasscCs2|j}|`|`|`|`|jjdd�|jj�dS)Nrr�)	r#r0r	r
r�helplistr��
user_helplistr)r(r#rrrr*Es
zGenPageTest.tearDownClasscCstj�dS)N)rr)r+rrrr,MszGenPageTest.setUpcCs�|j}|j}|jjd�|jjd�|jjd�|jjd�|jjdd�ddg|_	t
jdddd�|j�||jj
�d	�||jj
�d	�||jj
�d
�||jj
�d�||jj
d	d�d�||j	dg�dS)Nr.r�ZbadZworser�	HelpFilesr-z	name;filerZ80rOr��file)r�)r�rr-)r7r#Zstartup_editr0�autosaveZ	win_widthZ
win_heightrr�r
r
r�Zload_general_cfgr5)r+r�r9rrr�test_load_general_cfgPs 
z!GenPageTest.test_load_general_cfgcCsN|j}|jj�|jtdddii�tj�|jj�|jtdddii�dS)N�Generalzeditor-on-startupr-r)r#Zstartup_editor_onrQr7rXrrZstartup_shell_on)r+r9rrr�test_startupcs

zGenPageTest.test_startupcCsr|j}|jjdd�|jjdd�|jtdddii�tj�|jjdd�|jjdd�|jtdddii�dS)Nrr��11rTZheight�width)	r#Zwin_height_intr�r�r7rXrrZ
win_width_int)r+r9rrr�test_editor_sizemszGenPageTest.test_editor_sizecCs8|jjjdd�|jjjdd�|jtdddii�dS)Nrr�rZAutoCompleteZ	popupwait)r#Z
auto_wait_intr�r�r7r�)r+rrr�test_autocomplete_waitwsz"GenPageTest.test_autocomplete_waitcCs�|j}|j}|jdjd�|tdddii�tj�|jjdd�|jj	dd�|tdddii�tj�|j
j�|tdd	d
ii�dS)NZmenurZ
ParenMatchr��openerr�rzflash-delayZbellr�)r#r7Zparen_style_typerQr�rrZparen_flash_timer�r�Zbell_on)r+r9r�rrr�test_parenmatch|s
zGenPageTest.test_parenmatchcCsF|j}|jj�|jtdddii�|jj�|jtdddii�dS)Nrrr-r)r#Zsave_auto_onrQr7rXZsave_ask_on)r+r9rrr�
test_autosave�s


zGenPageTest.test_autosavecCs8|jjjdd�|jjjdd�|jtdddii�dS)Nrr�rZFormatParagraphz	max-width)r#Zformat_width_intr�r�r7r�)r+rrr�test_paragraph�szGenPageTest.test_paragraphcCs8|jjjdd�|jjjdd�|jtdddii�dS)Nrr�r-ZCodeContextZmaxlines)r#Zcontext_intr�r�r7r�)r+rrr�test_context�szGenPageTest.test_contextcCs�|j}|j|_|j|_|j}d}|j|d�|j|�|j�|j	|�|j
�|j|�\}}}}||d7}||d7}d|j_|j_|j
dddd�|j
d||d�|j
d||d�|j
d	||d�|j|jd
�d�|j|jj�|j|jj�dS)Nr��sourcer;rz<Enter>)rFrGz<Motion>z
<Button-1>z<ButtonRelease-1>rH)r#r	r0rr
rr�r?r@rIr'rJr3rAr7r5rRr6)r+r9rZdexrFrGrKrLrrr�test_source_selected�s*

z GenPageTest.test_source_selectedcCs�|j}|j}|`|j}|j}|jdd�|�||jj�d�||jj�d�|jdd�|�||jj�d�||jj�d�|j	d�|�||jj�f�||jj�f�t
�|_dS)	Nrr�rvr)rv)rv)rv)rv)r7r#r	rr�Zbutton_helplist_editr�Zbutton_helplist_remover�r�r)r+r�r9Zsad�hrrr�test_set_add_delete_state�s$
z%GenPageTest.test_set_add_delete_statecCs�|j}tj}tdd�}t_|j}|jjdd�|jj�d|j	_
|j_
d|_|j
�|jt|jjdd��|jko~gkn�|j|jj
�d|_|j
�d|_|j
�||jjdd�d
�||jddg�||jj
d
�|j|j	j
�|t_dS)NT)r�rr�r�name1�file1r��file2r;)r!r")r�r#)r!r�)r!r")r�r#)r7r�
HelpSourcerr#rr�r
rr0r3r
r�Zhelplist_item_addrR�listr5r6)r+r��orig_helpsourcer�r9rrr�test_helplist_item_add�s*
z"GenPageTest.test_helplist_item_addcCs*|j}tj}tdd�}t_|j}|jjdd�|jjdd�|jjd�|jj	d�|j
j�|j
jd�d|j
_|j_d|_|j�d|_|j�||jjdd�d
�||j
dg�|j|jj�d|_|j�||jjdd�d�||j
dg�|j|jj|j
jk�od
kn�|t_dS)NT)r�rr�r!r"rr�r#r.)r!r")r!r")r!)r!r")r�r#)r�)r�r#)r7rr$rr#rr�r�r�r�r
r�appendr0r3r
r�Zhelplist_item_editr5r6rR)r+r�r&r�r9rrr�test_helplist_item_edit�s0
(z#GenPageTest.test_helplist_item_editcCs�|j}|j}|jjdd�|jjdd�|jjd�|jjd�|jj�|jj	d�d|j
_|j_|j
�||jjdd�f�||jg�|j|jj|j
jko�dkn�dS)Nrr�r!r"r.)r!r")r7r#rr�r�r�r�r
rr(r0r3r
Zhelplist_item_remover5rR)r+r�r9rrr�test_helplist_item_removes
z%GenPageTest.test_helplist_item_removecCsV|j}|`|jj�|jjd	�|jjd
�|j�|jtdddd��t�|_dS)Nr!r"r�r#rzname1;file1zname2;file2)r-�2)r!r")r�r#)r#rr
rr(r7rXr)r+r9rrr�test_update_help_changess

z$GenPageTest.test_update_help_changesN)r_r`rarbrcr)r*r,rrrrrrrrrr r'r)r*r,rrrrr7s$


rc@sdeZdZedd��Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dS)�VarTraceTestcCs"tj�|_tt�|_tt�|_dS)N)rZVarTracerrr�ivr	�bv)r(rrrr)#s

zVarTraceTest.setUpClasscCs|`|`|`dS)N)rr.r/)r(rrrr*)szVarTraceTest.tearDownClasscCs|jj�d|_dS)Nr)rrr3)r+rrrr,-s
zVarTraceTest.setUpcGs|jd7_dS)N�
)r3)r+�paramsrrr�var_changed_increment1sz"VarTraceTest.var_changed_incrementcGsdS)Nr)r+r1rrr�var_changed_boolean4sz VarTraceTest.var_changed_booleancCs.|j}|j�|j|jg�|j|jg�dS)N)r�__init__r7�untraced�traced)r+�trrrr�	test_init7szVarTraceTest.test_initcCsF|j}|jjd�|jjd�|j�|j|jg�|j|jg�dS)Nrr.)rr5r(r6rr7)r+r7rrr�
test_clear=szVarTraceTest.test_clearc	Cs�|j}t�}tj|d�}|_|j|j|j�}|j||j�|j|j	|j
�}|j||j	�tt�}|j|d�}|j||�|j
�|j|d�||jf||j
f||fg}|j|jg�|j|j|�|`dS)N)rurrtrx)rrtrx)rrtrx)rrrr��
make_callback�addr.r2ZassertIsr/r3rrZassert_called_onceZassert_called_withr7r6r5)	r+r7�func�cbr.r/ZsvZsv2rYrrr�test_addEs$
zVarTraceTest.test_addcCst|jj|jd�}|jt|��|jjd�|jdtd�|�|jdtd�|j	tdddd�tj
�dS)Nrrtrx�*Z42)rrtrx)rr:r.rR�callabler0r�rrBr7r)r+r=rrr�test_make_callback]szVarTraceTest.test_make_callbackcCs�|j}|j|j|j�}|j|j|j�}||jf||jfg}|j�|j|jg�|j	|j
|�|jd�|j|j�d�|j|j
d�d|_
|j�|jd�|j|j
d�d|_
|j�|j|j
g�|j	|j|�|jd�|j|j
d�dS)Nr.r0r)rr;r.r2r/r3r8r7r5ZassertCountEqualr6r0r5r3r)r+r7r.r/rYrrr�test_attach_detachis*


zVarTraceTest.test_attach_detachN)r_r`rarcr)r*r,r2r3r8r9r>rArBrrrrr-!sr-�__main__r;)�	verbosity)*rbZidlelibrZtest.supportrZunittestrZidlelib.idle_test.mock_idlerZtkinterrrrr	r
rrZidlelib.configdialogr
rrrrZIdleUserConfParserrrrrXrlr�r�rr ZTestCaser!rdrkr�rr-r_rrrrr�<module>sL Kkh


?>