a
    «ˆcƒ
  ã                   @   s´   d Z ddl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
mZ ddlmZ ddlmZ d	Zejd
v r ddlZddlmZ edv r eejƒedƒk r dZG dd„ deƒZdS )z> Tests for the garbage collection of objects in tvtk package.
é    N)Ú	ETSConfig)ÚVersion©Ú	TVTKScene)ÚDecoratedSceneÚScene©Ú
SceneModel)ÚTestGarbageCollectionF)Zqt4Zqt)Úapi_name)ZpyqtZpyqt5z
7.5.0.dev0Tc                   @   s–   e Zd ZdZe ej d¡p$e	j
dkde	j
› �¡dd„ ƒZe e	j
dv de	j
› �¡d	d
„ ƒZe e	j
dv de	j
› �¡e ed¡dd„ ƒƒZdd„ ZdS )ÚTestTVTKGarbageCollectionz2 See: tvtk.tests.common.TestGarbageCollection
    ÚwinÚnullzMCI with windows fails due to lack of OpenGL, or toolkit is null, got toolkit=c                 C   s    dd„ }dd„ }|   ||¡ dS )z. Tests if TVTK scene can be garbage collected.c                   S   s   t ƒ S ©Nr   © r   r   úe/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/tvtk/tests/test_garbage_collection.pyÚ	create_fn'   s    z<TestTVTKGarbageCollection.test_tvtk_scene.<locals>.create_fnc                 S   s
   d| _ d S ©NT©Úclosing©Úor   r   r   Úclose_fn*   s    z;TestTVTKGarbageCollection.test_tvtk_scene.<locals>.close_fnN©Zcheck_object_garbage_collected©Úselfr   r   r   r   r   Útest_tvtk_scene    s    z)TestTVTKGarbageCollection.test_tvtk_scene)Zwxr   zDTest segfaults using WX (issue #216) and fails on null, got toolkit=c                 C   s    dd„ }dd„ }|   ||¡ dS )z) Tests if Scene can be garbage collected.c                   S   s   t ƒ S r   )r   r   r   r   r   r   4   s    z7TestTVTKGarbageCollection.test_scene.<locals>.create_fnc                 S   s   |   ¡  d S r   ©Úcloser   r   r   r   r   7   s    z6TestTVTKGarbageCollection.test_scene.<locals>.close_fnNr   r   r   r   r   Ú
test_scene/   s    z$TestTVTKGarbageCollection.test_scenez,Test segfaults using PyQt5 with older PyFacec                 C   s    dd„ }dd„ }|   ||¡ dS )z3 Tests if Decorated Scene can be garbage collected.c                   S   s
   t d d�S )N)Úparent)r   r   r   r   r   r   B   s    zATestTVTKGarbageCollection.test_decorated_scene.<locals>.create_fnc                 S   s   |   ¡  d S r   r   r   r   r   r   r   E   s    z@TestTVTKGarbageCollection.test_decorated_scene.<locals>.close_fnNr   r   r   r   r   Útest_decorated_scene<   s    z.TestTVTKGarbageCollection.test_decorated_scenec                 C   s    dd„ }dd„ }|   ||¡ dS )z. Tests if SceneModel can be garbage collected.c                   S   s   t ƒ S r   r   r   r   r   r   r   L   s    z=TestTVTKGarbageCollection.test_scene_model.<locals>.create_fnc                 S   s
   d| _ d S r   r   r   r   r   r   r   O   s    z<TestTVTKGarbageCollection.test_scene_model.<locals>.close_fnNr   r   r   r   r   Útest_scene_modelJ   s    z*TestTVTKGarbageCollection.test_scene_modelN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚunittestZskipIfÚsysÚplatformÚ
startswithr   Útoolkitr   r   Ú	bad_pyqt5r!   r"   r   r   r   r   r      s,   ÿþ

ÿÿ

ÿÿ

r   )r&   r(   r'   Ztraits.etsconfig.apir   Zpackaging.versionr   Ztvtk.pyface.tvtk_scener   Ztvtk.pyface.apir   r   Ztvtk.pyface.scene_modelr	   Ztvtk.tests.commonr
   r,   r+   ZpyfaceZ	pyface.qtr   Ú__version__r   r   r   r   r   Ú<module>   s"   
ÿ