def _execute(self): self.find_control("TabItem", "Bottom-Up").click_input() logging.info('Switched to Bottom-Up tab') tree_view_table = Table( find_control(self.find_control('Group', 'bottomUpTab'), 'Tree')) logging.info('Counting rows of the bottom-up view...') if tree_view_table.get_row_count() < 10: raise RuntimeError('Less than 10 rows in the bottom-up view') first_row_tree_item = tree_view_table.get_item_at(0, 0) if first_row_tree_item.window_text() != 'ioctl': raise RuntimeError( 'First item of the bottom-up view is not "ioctl"') logging.info('Verified that first item is "ioctl"') first_row_tree_item.double_click_input() logging.info('Expanded the first item') second_row_tree_item = tree_view_table.get_item_at(1, 0) if not second_row_tree_item.window_text().startswith('drm'): raise RuntimeError( 'First child of the first item ("ioctl") ' 'of the bottom-up view doesn\'t start with "drm"') logging.info( 'Verified that first child of the first item starts with "drm"')
def _execute(self, track_type: str): control_pane = self._show_and_find_control_pane() table = self.find_control("Table", "TrackTypeVisibility", parent=control_pane) table_obj = Table(table) row = table_obj.find_first_item_row(track_type, 1) table_obj.get_item_at(row, 0).click_input(coords=(10, 10))
def _verify_first_rows(self, tree_view_table: Table, expectations: Sequence[Sequence[str]]): for i in range(len(expectations)): for j in range(len(expectations[i])): expectation = expectations[i][j] self.expect_eq( tree_view_table.get_item_at(i, j).window_text(), expectation, "Top-down view's cell ({}, {}) is '{}'".format(i, j, expectation))
def _execute(self, selection_tab: bool = False): tab = self._switch_to_tab(selection_tab) tree_view_table = Table(find_control(tab, 'Tree')) self._verify_columns(tree_view_table) self._verify_rows_when_tree_collapsed(tree_view_table) self._verify_rows_when_thread_expanded(tree_view_table) self._verify_rows_when_thread_recursively_expanded(tree_view_table) self._verify_rows_when_tree_expanded(tree_view_table) self._verify_rows_on_search(tab, tree_view_table)
def _verify_first_rows(self, tree_view_table: Table, expectations: Sequence[Sequence[str]], hidden_columns: Set[int]): for i in range(len(expectations)): for j in range(len(expectations[i])): if j in hidden_columns: continue expectation = expectations[i][j] self.expect_eq( tree_view_table.get_item_at(i, j).window_text(), expectation, "Bottom-up view's cell ({}, {}) is '{}'".format( i, j, expectation))
def _execute(self): self.find_control("TabItem", "Top-Down").click_input() logging.info('Switched to Top-Down tab') tree_view_table = Table(find_control(self.find_control('Group', 'topDownTab'), 'Tree')) logging.info('Counting rows of the top-down view...') row_count_before_expansion = tree_view_table.get_row_count() if row_count_before_expansion < 3: raise RuntimeError('Less than 3 rows in the top-down view') first_row_tree_item = tree_view_table.get_item_at(0, 0) if (not first_row_tree_item.window_text().startswith('hello_') or not first_row_tree_item.window_text().endswith(' (all threads)')): raise RuntimeError('First item of the top-down view is not "hello_* (all threads)"') logging.info('Verified that first item is "hello_* (all threads)"') second_row_tree_item = tree_view_table.get_item_at(1, 0) if ((not second_row_tree_item.window_text().startswith('hello_') and not second_row_tree_item.window_text().startswith('Ggp')) or not second_row_tree_item.window_text().endswith(']')): raise RuntimeError('Second item of the top-down view is not "hello_*]" nor "Ggp*]"') logging.info('Verified that second item is "hello_*]" or "Ggp*]"') first_row_tree_item.double_click_input() logging.info('Expanded the first item') logging.info('Re-counting rows of the top-down view...') row_count_after_expansion = tree_view_table.get_row_count() if row_count_after_expansion < row_count_before_expansion + 2: raise RuntimeError( 'First item of the top-down view doesn\'t have at least two children') second_row_tree_item = tree_view_table.get_item_at(1, 0) third_row_tree_item = tree_view_table.get_item_at(2, 0) if (not ((second_row_tree_item.window_text().endswith('clone') and third_row_tree_item.window_text() == '_start') or (second_row_tree_item.window_text() == '_start') and third_row_tree_item.window_text().endswith('clone'))): raise RuntimeError('Children of the first item of the top-down view ' 'are not "*clone" and "_start"') logging.info('Verified that children of the first item are "*clone" and "_start"')
def _verify_row_count(self, tree_view_table: Table, expected_rows: int): self.expect_eq(tree_view_table.get_row_count(), expected_rows, "Top-down view has {} rows".format(expected_rows))