3
ÌœŸWQ	  ã               @   sv   d dl Z ddlmZ ddlm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rre jƒ  dS )é    Né   )Údatasets)Úget_example_data)Ú
NullEngine)ÚVTKDataSource)ÚScalarCutPlane)ÚUnstructuredGridReaderc               @   s4   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ ZdS )Ú
TestCutterc             C   s    t ƒ }|jƒ  |jƒ  || _dS )zwInitial setting up of test fixture, automatically called by TestCase
           before any other test method is invokedN)r   ÚstartZ	new_sceneÚe)Úselfr   © r   ú^/home/yuhw/wc/wire-cell-python/venv/lib/python3.6/site-packages/mayavi/tests/test_cut_plane.pyÚsetUp   s    zTestCutter.setUpc             C   s   | j jƒ  dS )zlFor necessary clean up, automatically called by TestCase after the
           test methods have been invokedN)r   Ústop)r   r   r   r   ÚtearDown!   s    
zTestCutter.tearDownc             C   sp   | j }tƒ }|j|ƒ || _|j}d|_|jjd j}|j	}d	|_
|j	}| j||ƒ d
|_
|j	}| j||ƒ dS )zu Configures the scalar cut plane and checks the cutter output
            changes when the plane is changed.
        g      ø?r   r   Nç      ø¿ç      ø¿ç      ø¿)r   r   r   )r   r   r   )r   r   r   )r   r   Z
add_moduleÚcpZimplicit_planeÚoriginZcutterÚoutputsÚoutputZnumber_of_cellsÚnormalÚassertNotEqual)r   r   r   ÚipÚ	poly_dataZinitial_cellsZupdated_cellsr   r   r   Úcheck'   s    
zTestCutter.checkc             C   s.   | j }tjƒ }t|d�}|j|ƒ | jƒ  d S )N)Údata)r   r   ZgenerateStructuredGridr   Ú
add_sourcer   )r   r   ZsgridÚsrcr   r   r   Útest_with_structured_dataA   s
    

z$TestCutter.test_with_structured_datac             C   s0   | j }tƒ }|jtdƒƒ |j|ƒ | jƒ  d S )Nzcellsnd.ascii.inp)r   r   Ú
initializer   r   r   )r   r   Úrr   r   r   Útest_with_unstructured_dataJ   s
    
z&TestCutter.test_with_unstructured_dataN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r!   r$   r   r   r   r   r	      s
   	r	   Ú__main__)ÚunittestÚ r   Úcommonr   Úmayavi.core.null_enginer   Zmayavi.sources.vtk_data_sourcer   Zmayavi.modules.scalar_cut_planer   Z'mayavi.sources.unstructured_grid_readerr   ÚTestCaser	   r%   Úmainr   r   r   r   Ú<module>   s   A