예제 #1
0
    def yield_select_in_messages(self, entity):
        """
        Select the given entity in the message's report

        :param entity: The entity's name
        """
        self.messages_report.get_selection().unselect_all()
        yield wait_idle()

        select_in_tree(self.messages_report,
                       AnalysisReport.MessagesReportColumn.ENTITY_NAME, entity)
        yield wait_idle()
예제 #2
0
파일: test.py 프로젝트: Blady-Com/gps
def driver():
    yield timeout(1000)
    als = GPS.LanguageServer.get_by_language_name("Ada")

    b = GPS.EditorBuffer.get(GPS.File("main.adb"))
    b.current_view().goto(b.at(4, 5))
    yield hook('language_server_response_processed')

    GPS.execute_action("Entity called by")
    yield hook('language_server_response_processed')
    yield wait_idle()

    call_tree = get_widget_by_name("Call Graph Tree")
    selection = call_tree.get_selection()
    selection.unselect_all()
    model = call_tree.get_model()
    selection.select_iter(model.iter_nth_child(model.get_iter_first(), 0))

    GPS.execute_action("calltree expand selected")
    yield hook('language_server_response_processed')
    yield wait_idle()

    expected = [
        'Foo is called by ',
        [
            'Foo', ['Foo', ['computing...'], 'Main', ['computing...']], 'Main',
            ['computing...']
        ]
    ]

    gps_assert(expected, dump_tree_model(model, 0),
               "The model didn't contain the expected text")

    # Now verify that double-clicking on the row that lists 'Main'
    # correctly open its editor.

    GPS.execute_action("close all editors")
    yield wait_tasks(other_than=known_tasks)

    click_in_tree(call_tree,
                  path=Gtk.TreePath("0:0:1"),
                  button=1,
                  events=double_click_events)
    yield wait_idle()

    buffer = GPS.EditorBuffer.get()
    gps_assert(
        buffer.file(), GPS.File("main.adb"),
        "double-clicking on a Call Trees row should open an " +
        "editor for the clicked entity")
예제 #3
0
    def yield_click_on_item(self,
                            label_text,
                            button=1,
                            events=pygps.single_click_events):
        """
        Clicks on the Learn view's item identified with the given
        ``label_text``.

        Raises an exception when node corresponding item is not found.
        """
        children = get_widgets_by_type(Gtk.FlowBoxChild, self.dialog)

        for child in children:
            label = get_widgets_by_type(Gtk.Label, child)[0]
            if label.get_label() == label_text:
                if isinstance(child.get_parent(), Gtk.FlowBox):
                    alloc = label.get_allocation()
                    click_in_widget(child.get_window(),
                                    alloc.x,
                                    alloc.y,
                                    events=events)
                    yield wait_idle()
                    return

        raise Exception("'%s' item not found in the Learn view" % (label_text))
예제 #4
0
파일: dialogs.py 프로젝트: vpodzime/gps
 def cancel(self):
     """
     Press the cancel button. Use as::
         yield self.cancel()
     """
     get_stock_button(self.dialogs, Gtk.STOCK_CANCEL).clicked()
     yield wait_idle()
예제 #5
0
 def ok(self):
     """
     Press the OK button. Use as::
         yield self.ok()
     """
     get_stock_button(self.dialogs, Gtk.STOCK_OK).clicked()
     yield wait_idle()
예제 #6
0
 def cancel(self):
     """
     Press the cancel button. Use as::
         yield self.cancel()
     """
     get_stock_button(self.dialogs, Gtk.STOCK_CANCEL).clicked()
     yield wait_idle()
예제 #7
0
 def ok(self):
     """
     Press the OK button. Use as::
         yield self.ok()
     """
     get_stock_button(self.dialogs, Gtk.STOCK_OK).clicked()
     yield wait_idle()
예제 #8
0
 def select(self, num):
     """
     Select the num-th breakpoint in the list
         b = Breakpoints_View()
         yield b.select(1)
     """
     self.list.get_selection().select_path("%d" % num)
     yield wait_idle()
예제 #9
0
 def open_and_yield(self):
     """
     Compatible with run_test_driver, to be used in a yield statement
         dialog = Debug_Run_Dialog()
         yield dialog.open_and_yield()
     """
     yield self._open_and_yield("/Debug/Run...")
     yield wait_idle()
예제 #10
0
 def select(self, num):
     """
     Select the num-th breakpoint in the list
         b = Breakpoints_View()
         yield b.select(1)
     """
     self.list.get_selection().select_path("%d" % num)
     yield wait_idle()
예제 #11
0
 def open_and_yield(self):
     """
     Compatible with run_test_driver, to be used in a yield statement
         dialog = Debug_Run_Dialog()
         yield dialog.open_and_yield()
     """
     yield self._open_and_yield("/Debug/Run...")
     yield wait_idle()
예제 #12
0
파일: menu.py 프로젝트: spanners/GNATstudio
 def select(self, label):
     """
     Execute one of the items in the menu, as in:
         yield self.select('A is called by')
     The menu must already have been opened
     """
     if gps_not_null(self.menu, 'Contextual menu not created yet'):
         t = pygps.MenuTree(self.menu, accel_prefix='')
         for (menu, menu_label, accel, level) in t:
             if menu_label == label:
                 yield wait_idle()
                 menu.activate()
                 self.menu.destroy()  # close the contextual menu
                 yield wait_idle()
                 return
         gps_assert(
             True, False, 'Contextual menu not found "%s" in %s' %
             (label, dump_menu('', self.menu)))
예제 #13
0
def editor_contextual(editor, name):
    """
    A generator that activates an editor contextual menu.
    Use it as::
        yield editor_contextual(editor, "Version Control/Commit")

    Unless you are indeed testing the contextual menu itself, you might
    want to directly call GPS.execute_action(...) instead, with the action
    that the contextual menu would execute. This makes the test more efficient
    and more reliable.
    """
    from gps_utils.internal.utils import activate_contextual, close_contextual
    windows = Gtk.Window.list_toplevels()
    click_in_text(editor.current_view().cursor(), button=3)
    yield wait_idle()  # wait for contextual menu to appear
    activate_contextual(windows, name)
    close_contextual(windows)
    yield wait_idle()  # wait for action to start executing
예제 #14
0
def editor_contextual(editor, name):
    """
    A generator that activates an editor contextual menu.
    Use it as::
        yield editor_contextual(editor, "Version Control/Commit")

    Unless you are indeed testing the contextual menu itself, you might
    want to directly call GPS.execute_action(...) instead, with the action
    that the contextual menu would execute. This makes the test more efficient
    and more reliable.
    """
    from gs_utils.internal.utils import activate_contextual, close_contextual
    windows = Gtk.Window.list_toplevels()
    click_in_text(editor.current_view().cursor(), button=3)
    yield wait_idle()  # wait for contextual menu to appear
    activate_contextual(windows, name)
    close_contextual(windows)
    yield wait_idle()  # wait for action to start executing
예제 #15
0
    def yield_click_on_item(self,
                            label_text,
                            button=1,
                            events=pygps.single_click_events):
        """
        Clicks on the Learn view's item identified with the given
        ``label_text``.
        """
        children = get_widgets_by_type(Gtk.FlowBoxChild, self.dialog)

        for child in children:
            label = get_widgets_by_type(Gtk.Label, child)[0]
            if label.get_label() == label_text:
                if isinstance(child.get_parent(), Gtk.FlowBox):
                    click_in_widget(child.get_window(), -1, -1, events=events)
                    yield wait_idle()
                    return
예제 #16
0
 def yield_remove(self):
     self.remove_button.clicked()
     yield wait_idle()
예제 #17
0
파일: dialogs.py 프로젝트: anujarora1/gps
 def ok(self):
     get_stock_button(self.dialogs, Gtk.STOCK_OK).clicked()
     yield wait_idle()
     yield hook('debuggee_started')
예제 #18
0
 def yield_close(self):
     self.close.clicked()
     yield wait_idle()
예제 #19
0
 def yield_apply(self):
     """
     Apply the changes made in the Build Targets editor.
     """
     self.apply_button.clicked()
     yield wait_idle()
예제 #20
0
 def yield_close(self):
     """
     Close the Build Targets editor.
     """
     self.close_button.clicked()
     yield wait_idle()
예제 #21
0
 def yield_close(self):
     self.close.clicked()
     yield wait_idle()
예제 #22
0
 def yield_remove(self):
     self.remove_button.clicked()
     yield wait_idle()
예제 #23
0
 def open_and_yield(self):
     yield self._open_and_yield("/File/Close")
     yield wait_idle()
     self.dialog = get_window_by_title("Confirmation")
예제 #24
0
 def yield_close(self):
     self.report_mdi.close()
     yield wait_idle()
예제 #25
0
 def ok(self):
     get_button_from_label("Execute", self.dialogs).clicked()
     yield wait_idle()