Ejemplo n.º 1
0
def outlineexplorer(qtbot):
    """Set up an OutlineExplorerWidget."""
    outlineexplorer = OutlineExplorerWidget(
        show_fullpath=False, show_all_files=True, group_cells=False,
        show_comments=True, sort_files_alphabetically=False)
    # Fix the size of the outline explorer to prevent an
    # 'Unable to set geometry ' warning if the test fails.
    outlineexplorer.setFixedSize(400, 350)

    qtbot.addWidget(outlineexplorer)
    outlineexplorer.show()

    return outlineexplorer
Ejemplo n.º 2
0
def outlineexplorer(qtbot):
    """Set up an OutlineExplorerWidget."""
    outlineexplorer = OutlineExplorerWidget(
        show_fullpath=False, show_all_files=True, group_cells=False,
        show_comments=True, sort_files_alphabetically=False)
    # Fix the size of the outline explorer to prevent an
    # 'Unable to set geometry ' warning if the test fails.
    outlineexplorer.setFixedSize(400, 350)

    qtbot.addWidget(outlineexplorer)
    outlineexplorer.show()

    return outlineexplorer
Ejemplo n.º 3
0
    def _create_outlineexplorer(code, filename, follow_cursor=False):
        code_editor = CodeEditor(None)
        code_editor.set_language('py', filename)
        code_editor.set_text(code)

        editor = OutlineExplorerProxyEditor(code_editor, filename)

        outlineexplorer = OutlineExplorerWidget(follow_cursor=follow_cursor)
        outlineexplorer.set_current_editor(editor, False, False)
        outlineexplorer.show()
        outlineexplorer.setFixedSize(400, 350)

        qtbot.addWidget(outlineexplorer)
        return outlineexplorer
Ejemplo n.º 4
0
def outlineexplorer(qtbot):
    """Set up an OutlineExplorerWidget."""
    outlineexplorer = OutlineExplorerWidget(None, None, None)
    outlineexplorer.set_conf('show_fullpath', False)
    outlineexplorer.set_conf('show_all_files', True)
    outlineexplorer.set_conf('group_cells', True)
    outlineexplorer.set_conf('show_comments', True)
    outlineexplorer.set_conf('sort_files_alphabetically', False)
    outlineexplorer.set_conf('display_variables', True)

    # Fix the size of the outline explorer to prevent an
    # 'Unable to set geometry ' warning if the test fails.
    outlineexplorer.setFixedSize(400, 350)

    qtbot.addWidget(outlineexplorer)
    outlineexplorer.show()

    return outlineexplorer
Ejemplo n.º 5
0
def empty_editor_bot(qtbot):
    """Set up an empty EditorStack with an OutlineExplorerWidget."""
    outlineexplorer = OutlineExplorerWidget(
        show_fullpath=False, show_all_files=True, group_cells=False,
        show_comments=True)
    # Fix the size of the outline explorer to prevent an
    # 'Unable to set geometry ' warning if the test fails.
    outlineexplorer.setFixedSize(400, 350)

    qtbot.addWidget(outlineexplorer)
    outlineexplorer.show()

    editorstack = editor.EditorStack(None, [])
    editorstack.set_introspector(Mock())
    editorstack.set_find_widget(Mock())
    editorstack.set_io_actions(Mock(), Mock(), Mock(), Mock())
    editorstack.analysis_timer = Mock()
    editorstack.save_dialog_on_tests = True
    editorstack.set_outlineexplorer(outlineexplorer)

    qtbot.addWidget(editorstack)
    editorstack.show()

    return editorstack, outlineexplorer, qtbot
Ejemplo n.º 6
0
        expected_tree = json.load(open(case_info['tree'], 'r'))

        code_editor = CodeEditor(None)
        code_editor.set_language('py', filename)
        code_editor.set_text(text)

        editor = OutlineExplorerProxyEditor(code_editor, filename)

        outlineexplorer = OutlineExplorerWidget(follow_cursor=follow_cursor,
                                                display_variables=True,
                                                group_cells=True,
                                                show_comments=True)
        outlineexplorer.register_editor(editor)
        outlineexplorer.set_current_editor(editor, False, False)
        outlineexplorer.show()
        outlineexplorer.setFixedSize(400, 350)

        editor.update_outline_info(symbol_info)
        qtbot.addWidget(outlineexplorer)
        return outlineexplorer, expected_tree
    return _create_outlineexplorer


# ---- Test OutlineExplorerWidget
@pytest.mark.parametrize('case', AVAILABLE_CASES)
def test_outline_explorer(case, create_outlineexplorer):
    """
    Test to assert the outline explorer is initializing correctly and
    is showing the expected number of items, the expected type of items, and
    the expected text for each item.
    """