a
    «ˆc~  ã                   @   s~   d dl Z d dlmZ d dlmZ d dlZd dlmZ d dl	m
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)ÚBytesIO)Úabspath)Ú
NullEngine)Útvtk)ÚArraySource)ÚText3Dc                   @   sD   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dS )Ú
TestText3Dc                 C   s
   t  d¡S )zTrivial data )é
   r	   r	   )ÚnpÚzeros©Úself© r   ú[/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/mayavi/tests/test_text3d.pyÚ	make_data   s    zTestText3D.make_datac                 C   s`   t ƒ }| ¡  | ¡ }|| _|| _tƒ }|  ¡ }||_| |¡ t	ƒ | _
| | j
¡ |j| _dS )zlInitial setting up of test fixture, automatically called by TestCase before any other test method is invokedN)r   ÚstartZ	new_sceneÚeÚsr   r   Zscalar_dataZ
add_sourcer   ÚtZ
add_moduleÚcurrent_sceneÚscene)r   r   r   ÚdZscr   r   r   ÚsetUp   s    
zTestText3D.setUpc                 C   sN   t ƒ }tdƒ|_| j |¡ | d¡ | j | j¡ | j |¡ | jj	| _d S )Nztest.mv2r   )
r   r   Únamer   Zsave_visualizationÚseekZclose_scener   Zload_visualizationr   )r   Úfr   r   r   Úsave_and_reload4   s    

zTestText3D.save_and_reloadc                 C   s   | j  ¡  dS )zaFor necessary clean up, automatically called by TestCase after the test methods have been invokedN)r   Ústopr   r   r   r   ÚtearDownC   s    
zTestText3D.tearDownc                 C   s   |   t| jtƒ¡ dS )z1Test if the text3d has been properly instanciatedN)Ú
assertTrueÚ
isinstancer   r   r   r   r   r   Útest_text3dJ   s    zTestText3D.test_text3dc                 C   sD   d| j _|  t| j jjtjƒ¡ d| j _|  t| j jjtjƒ¡ dS )z[ Test if changing 'orient_to_camera' switches between plain
            actor and follower TFN)r   Úorient_to_camerar   r    Úactorr   ÚFollowerÚassertFalser   r   r   r   Útest_followerO   s    zTestText3D.test_followerc                 C   sˆ   |   ¡  d| j_|  t| jjjtjƒ¡ |  | jj¡ d| j_|  t| jjjtjƒ¡ |   ¡  |  | jj¡ |  t| jjjtjƒ¡ d S )NFT)	r   r   r"   r%   r    r#   r   r$   r   r   r   r   r   Útest_persistenceX   s    zTestText3D.test_persistenceN)
Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r!   r&   r'   r   r   r   r   r      s   	r   Ú__main__)ZunittestÚior   Úos.pathr   Únumpyr
   Zmayavi.core.null_enginer   Ztvtk.apir   Zmayavi.sources.array_sourcer   Zmayavi.modules.text3dr   ZTestCaser   r(   Úmainr   r   r   r   Ú<module>   s   P