a
    «ˆc;  ã                   @   s^   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 G dd„ dejƒZ	e
dkrZe ¡  dS )é    N)Ú	MagicMock)Ú
MovieMakerc                   @   s<   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ ZdS )ÚTestMovieMakerc                 C   s   t  ¡ | _d S ©N)ÚtempfileÚmkdtempÚroot©Úself© r   ú^/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/tvtk/tests/test_movie_maker.pyÚsetUp   s    zTestMovieMaker.setUpc                 C   s   t  | j¡ d S r   )ÚshutilÚrmtreer   r	   r   r   r   ÚtearDown   s    zTestMovieMaker.tearDownc                 C   s@   t dd�}tƒ |_| ¡  | ¡  | ¡  | ¡  |j ¡  d S )NF©Úrecord)r   r   Ú_save_sceneÚanimation_startÚanimation_stepÚanimation_stopZassert_not_called©r
   Úmmr   r   r   Ú$test_does_nothing_when_record_is_off   s    
z3TestMovieMaker.test_does_nothing_when_record_is_offc                 C   sF   t dd�}tƒ |_| ¡  | ¡  | ¡  | ¡  |  |jjd¡ d S )NTr   é   )r   r   r   r   r   r   ÚassertEqualÚ
call_countr   r   r   r   Ú'test_calls_save_scene_when_record_is_on   s    
z6TestMovieMaker.test_calls_save_scene_when_record_is_onc                 C   s�   t dd�}tƒ |_tƒ |_tƒ |_| ¡ �  | ¡  | ¡  W d   ƒ n1 sP0    Y  |j ¡  |  |jj	d¡ |j ¡  |  |j
d¡ d S )NFr   é   )r   r   r   r   r   Úrecord_movier   Zassert_called_once_withr   r   r   r   r   r   r   Ú'test_calls_save_scene_with_record_movie-   s    

&

z6TestMovieMaker.test_calls_save_scene_with_record_moviec                 C   s°   t d| jd�}tƒ |_| ¡ � | ¡  W d   ƒ n1 s<0    Y  |  |jd¡ t 	tj
 | j|jd¡¡ | ¡ � | ¡  W d   ƒ n1 s”0    Y  |  |jd¡ d S )NT)r   Ú	directoryZmovie001Zmovie002)r   r   r   r   r   r   r   Z_subdirÚosÚmakedirsÚpathÚjoinr   r   r   r   Ú test_directory_updates_correctly?   s    
&
&z/TestMovieMaker.test_directory_updates_correctlyN)	Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r    r&   r   r   r   r   r   
   s   r   Ú__main__)r"   r   r   ZunittestZunittest.mockr   Ztvtk.pyface.movie_makerr   ZTestCaser   r'   Úmainr   r   r   r   Ú<module>   s   J