Ejemplo n.º 1
0
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# Copyright (c) 2013-2017, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#------------------------------------------------------------------------------
import os
import pytest
from utils import is_qt_available

pytestmark = pytest.mark.skipif(not is_qt_available(),
                                reason='Requires a Qt binding')

from enaml.layout.api import HSplitLayout, DockLayoutWarning, InsertTab
from enaml.widgets.api import DockArea, DockItem

from utils import compile_source, wait_for_window_displayed

DOCK_AREA_TEMPLATE =\
"""from enaml.widgets.api import Window, Container, DockArea, DockItem
from enaml.layout.api import VSplitLayout

enamldef Main(Window):

    alias area: dock_area

    Container:
        DockArea: dock_area:
            layout = VSplitLayout('item1', 'item2')
Ejemplo n.º 2
0
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# Copyright (c) 2018, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------------------------------------
import os
import sys
import pytest
import importlib
from utils import is_qt_available, cd, enaml_run


@pytest.mark.skipif(not is_qt_available(), reason='Requires a Qt binding')
def test_workbench(enaml_run, qtbot):
    from enaml.qt.QtCore import Qt

    # Run normally to generate cache files
    dir_path = os.path.abspath(os.path.split(os.path.dirname(__file__))[0])
    example = os.path.join(dir_path, 'examples', 'workbench')

    def handler(app, window):
        widget = window.proxy.widget
        qtbot.wait(1000)
        for i in range(1, 4):
            qtbot.keyClick(widget, str(i), Qt.ControlModifier)
            qtbot.wait(100)
            # TODO: Verify each screen somehow
Ejemplo n.º 3
0
    SCINTILLA_AVAILABLE = True

try:
    import vtk
except ImportError:
    VTK_AVAILABLE = False
else:
    VTK_AVAILABLE = True

try:
    from enaml.qt import QtWebEngineWidgets
    WEBVIEW_AVAILABLE = True
except Exception:
    WEBVIEW_AVAILABLE = False

if is_qt_available():
    try:
        import enaml.qt.qt_ipython_console
    except ImportError:
        IPY_AVAILABLE = False
    else:
        IPY_AVAILABLE = True
else:
    IPY_AVAILABLE = False


def handle_popup_view_example(qtbot, window):
    """Test showing the popups.

    """
    from conftest import DIALOG_SLEEP
Ejemplo n.º 4
0
#------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#------------------------------------------------------------------------------
import pytest
from utils import is_qt_available

pytestmark = pytest.mark.skipif(not is_qt_available(),
                                reason='Requires a Qt binding')

from enaml.fontext import Font


def test_QFont_from_Font():
    # Regression test for PySide: QFont_from_Font was raising a TypeError
    # in its call to qfont.setStyle(font.style).  This test passes if it
    # does not raise an exception.
    from enaml.qt.q_resource_helpers import QFont_from_Font
    f = Font(family="bold")
    qf = QFont_from_Font(f)
Ejemplo n.º 5
0
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# Copyright (c) 2018, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#------------------------------------------------------------------------------
import os
import sys
import pytest
import importlib
from utils import is_qt_available, cd, enaml_run


@pytest.mark.skipif(not is_qt_available(), reason='Requires a Qt binding')
def test_workbench(enaml_run, qtbot):
    from enaml.qt.QtCore import Qt

    # Run normally to generate cache files
    dir_path = os.path.abspath(os.path.split(os.path.dirname(__file__))[0])
    example = os.path.join(dir_path, 'examples', 'workbench')

    def handler(app, window):
        widget = window.proxy.widget
        qtbot.wait(1000)
        for i in range(1, 4):
            qtbot.keyClick(widget, str(i), Qt.ControlModifier)
            qtbot.wait(100)
            # TODO: Verify each screen somehow