示例#1
0
def paste(gui, state_machine_model, state_m, main_window_controller, menu_bar_ctrl, page):
    print("Pasting")
    gui(state_machine_model.selection.set, [state_m])
    main_window_controller.view['main_window'].grab_focus()
    focus_graphical_editor_in_page(page)
    gui(menu_bar_ctrl.on_paste_clipboard_activate, None, None)
    testing_utils.wait_for_gui()
示例#2
0
def select_and_paste_state(gui, state_machine_model, source_state_model, target_state_model, menu_bar_ctrl, operation,
                           main_window_controller, page):
    """Select a particular state and perform an operation on it (Copy or Cut) and paste it somewhere else. At the end,
    verify that the operation was completed successfully.

    :param state_machine_model: The state machine model where the operation will be conducted
    :param source_state_model: The state model, on which the operation will be performed
    :param target_state_model: The state model, where the source state will be pasted
    :param menu_bar_ctrl: The menu_bar controller, through which copy, cut & paste actions are triggered
    :param operation: String indicating the operation to be performed (Copy or Cut)
    :param main_window_controller: The MainWindow Controller
    :param page: The notebook page of the corresponding state machine in the state machines editor
    :return: The target state model, and the child state count before pasting
    """
    print("\n\n %s \n\n" % source_state_model.state.name)
    gui(state_machine_model.selection.set, [source_state_model])
    gui(getattr(menu_bar_ctrl, 'on_{}_selection_activate'.format(operation)), None, None)
    print("\n\n %s \n\n" % target_state_model.state.name)
    gui(state_machine_model.selection.set, [target_state_model])
    old_child_state_count = len(target_state_model.state.states)
    main_window_controller.view['main_window'].grab_focus()
    focus_graphical_editor_in_page(page)
    gui(menu_bar_ctrl.on_paste_clipboard_activate, None, None)
    testing_utils.wait_for_gui()
    print(list(target_state_model.state.states.keys()))
    assert len(target_state_model.state.states) == old_child_state_count + 1
    return target_state_model, old_child_state_count
示例#3
0
def copy_and_paste_state_into_itself(gui, sm_m, state_m_to_copy, page, menu_bar_ctrl):
    gui(sm_m.selection.set, [state_m_to_copy])
    focus_graphical_editor_in_page(page)
    gui(menu_bar_ctrl.on_copy_selection_activate, None, None)
    old_child_state_count = len(state_m_to_copy.state.states)
    gui(sm_m.selection.set, [state_m_to_copy])
    focus_graphical_editor_in_page(page)
    gui(menu_bar_ctrl.on_paste_clipboard_activate, None, None)
    assert len(state_m_to_copy.state.states) == old_child_state_count + 1