3
ÌœŸWA  ã               @   sZ   d dl Z d dlZd dlZd dlZd dlZd dlmZ G dd„ dejƒZe	dkrVej
ƒ  dS )é    N)Ú
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 jƒ | _d S )N)ÚtempfileÚmkdtempÚroot)Úself© r   ú^/home/yuhw/wc/wire-cell-python/venv/lib/python3.6/site-packages/tvtk/tests/test_movie_maker.pyÚsetUp   s    zTestMovieMaker.setUpc             C   s   t j| jƒ d S )N)ÚshutilÚrmtreer   )r   r   r   r	   ÚtearDown   s    zTestMovieMaker.tearDownc             C   sB   t dd�}tjƒ |_|jƒ  |jƒ  |jƒ  |jƒ  |jjƒ  d S )NF)Úrecord)r   ÚmockÚ	MagicMockÚ_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   sH   t dd�}tjƒ |_|jƒ  |jƒ  |jƒ  |jƒ  | j|jjdƒ d S )NT)r   é   )	r   r   r   r   r   r   r   ÚassertEqualÚ
call_count)r   r   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jƒ |_tjƒ |_tjƒ |_|jƒ � |jƒ  |jƒ  W d Q R X |jjƒ  | j	|jj
dƒ |jjƒ  | j	|jdƒ d S )NF)r   é   )r   r   r   r   r   r   Úrecord_movier   Zassert_called_once_withr   r   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jƒ |_|jƒ � |jƒ  W d Q R X | j|jdƒ t	j
t	jj| j|jdƒƒ |jƒ � |jƒ  W d Q R X | j|jdƒ d S )NT)r   Ú	directoryZmovie001Zmovie002)r   r   r   r   r   r   r   r   Z_subdirÚosÚmakedirsÚpathÚjoin)r   r   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   r   ÚunittestZtvtk.pyface.movie_makerr   ÚTestCaser   r$   Úmainr   r   r   r	   Ú<module>   s   J