File: test_interactive.py

package info (click to toggle)
python-vispy 0.6.6-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 21,240 kB
  • sloc: python: 57,407; javascript: 6,810; makefile: 63; sh: 5
file content (27 lines) | stat: -rw-r--r-- 677 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from vispy.testing import run_tests_if_main
from vispy.app import set_interactive
from vispy.ext.ipy_inputhook import inputhook_manager


# Expect the inputhook_manager to set boolean `_in_event_loop`
# on instances of this class when enabled.
class MockApp(object):
    pass


def test_interactive():
    f = MockApp()
    set_interactive(enabled=True, app=f)

    assert inputhook_manager._current_gui == 'vispy'
    assert f._in_event_loop
    assert 'vispy' in inputhook_manager.apps
    assert f == inputhook_manager.apps['vispy']

    set_interactive(enabled=False)

    assert inputhook_manager._current_gui is None
    assert not f._in_event_loop


run_tests_if_main()