a
    «ˆcQ	  ã                   @   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  ¡  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 ƒ }| ¡  | ¡  || _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/wcpy/lib/python3.9/site-packages/mayavi/tests/test_cut_plane.pyÚsetUp   s    zTestCutter.setUpc                 C   s   | 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}d|_|jjd j}|j	}d|_
|j	}|  ||¡ d|_
|j	}|  ||¡ dS )zu Configures the scalar cut plane and checks the cutter output
            changes when the plane is changed.
        )ç      ø¿r   r   r   )r   r   r   N)r   r   Z
add_moduleÚcpZimplicit_planeÚoriginZcutterÚoutputsÚoutputZnumber_of_cellsÚnormalZassertNotEqual)r   r   r   ÚipZ	poly_dataZinitial_cellsZupdated_cellsr   r   r   Úcheck'   s    
zTestCutter.checkc                 C   s.   | j }t ¡ }t|d�}| |¡ |  ¡  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ƒ }| tdƒ¡ | |¡ |  ¡  d S )Nzcellsnd.ascii.inp)r   r   Z
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__)ZunittestÚ r   Úcommonr   Zmayavi.core.null_enginer   Zmayavi.sources.vtk_data_sourcer   Zmayavi.modules.scalar_cut_planer   Z'mayavi.sources.unstructured_grid_readerr   ZTestCaser	   r    Úmainr   r   r   r   Ú<module>   s   A