a
    §ˆc,  ã                   @   sr   d dl Z d dlZd dlmZ d dlmZmZ d dlmZ d dl	m
Z
 dZdd„ ZeejgƒG d	d
„ d
ejƒƒZdS )é    N)ÚQtGui)Úrequires_toolkitÚToolkitName)Úwrap_text_with_elision)Úcreate_traitsfontaÂ  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
    
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.c                 C   s:   g }|   ¡ D ](}| ¡ s$| d¡ q|t ||¡7 }q|S )NÚ )Ú
splitlinesÚstripÚappendÚtextwrapÚwrap)ÚtextÚwidthÚexpected_linesZ	paragraph© r   úa/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/traitsui/qt4/tests/test_helper.pyÚget_expected_lines!   s    
r   c                   @   s4   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ ZdS )ÚTestWrapTextc                 C   s^   t dƒ}t |¡}| ¡ }| ¡ }d| }d| }tt|||ƒ}|  |dd„ t ¡ D ƒ¡ d S )NÚCourieréô  éd   c                 S   s   g | ]}|  ¡ ‘qS r   )Úrstrip©Ú.0Úliner   r   r   Ú
<listcomp>:   ó    z5TestWrapText.test_wrap_text_basic.<locals>.<listcomp>)	r   r   ÚQFontMetricsÚaverageCharWidthÚlineSpacingr   Úlorem_ipsumÚassertEqualr   ©ÚselfÚfontÚfont_metricsÚaverage_char_widthÚline_spacingr   ÚheightÚlinesr   r   r   Útest_wrap_text_basic-   s    
ÿz!TestWrapText.test_wrap_text_basicc                 C   sP   t dƒ}t |¡}| ¡ }| ¡ }d| }d| }td|||ƒ}|  |g ¡ d S )Nr   r   r   r   )r   r   r   r   r   r   r!   r"   r   r   r   Útest_wrap_text_empty=   s    
z!TestWrapText.test_wrap_text_emptyc                 C   s\   t dƒ}t |¡}| ¡ }| ¡ }d| }d| }tt|||ƒ}|  tdd„ |D ƒƒ¡ d S )Nr   é   r   c                 s   s   | ]}t |ƒd kV  qdS ©é   N©Úlenr   r   r   r   Ú	<genexpr>X   r   z5TestWrapText.test_wrap_text_narrow.<locals>.<genexpr>)	r   r   r   r   r   r   r    Ú
assertTrueÚallr"   r   r   r   Útest_wrap_text_narrowK   s    
z"TestWrapText.test_wrap_text_narrowc                 C   sš   t dƒ}t |¡}| ¡ }| ¡ }d| }d| }tt|||ƒ}|  tdd„ |D ƒƒ¡ |d d dkr‚|  	|d dd … d	¡ n|  	|d d d
¡ d S )Nr   r,   c                 s   s   | ]}t |ƒd kV  qdS r-   r/   r   r   r   r   r1   g   r   z;TestWrapText.test_wrap_text_narrow_short.<locals>.<genexpr>é   éÿÿÿÿÚ.éýÿÿÿz...u   â€¦)
r   r   r   r   r   r   r    r2   r3   r!   r"   r   r   r   Útest_wrap_text_narrow_shortZ   s    
z(TestWrapText.test_wrap_text_narrow_shortc           	      C   sb   t dƒ}t |¡}| ¡ }| ¡ }d| }d| }tt|||ƒ}ttdƒd d… }|  ||¡ d S )Nr   r   é   )	r   r   r   r   r   r   r    r   r!   )	r#   r$   r%   r&   r'   r   r(   r)   r   r   r   r   Útest_wrap_text_shortq   s    
z!TestWrapText.test_wrap_text_shortN)Ú__name__Ú
__module__Ú__qualname__r*   r+   r4   r9   r;   r   r   r   r   r   +   s
   r   )r   ZunittestZ	pyface.qtr   Ztraitsui.tests._toolsr   r   Ztraitsui.qt4.helperr   Ztraitsui.qt4.font_traitr   r    r   ZqtZTestCaser   r   r   r   r   Ú<module>   s   ÿ

