def get_header(self, source, depth, row_idx): """Display the description or type as the header.""" styles = [RowStyle(font=(constants.FONT, constants.FONT_SIZE_SMALL), left_padding=constants.INDENT * depth)] header = split_text( source['description'] or source['type'], constants.FONT, constants.FONT_SIZE_SMALL, constants.PAGE_WIDTH - (depth * constants.INDENT) ) return RowData(content=[header, '', '', '' ], style=styles, start=row_idx)
def get_header(self, source, depth, row_idx): passed = source['passed'] header = split_text(source['description'] or source['type'], const.FONT if passed else const.FONT_BOLD, const.FONT_SIZE_SMALL, const.PAGE_WIDTH - (depth * const.INDENT)) return RowData(content=[ header, '', '', (Status.PASSED if passed else Status.FAILED).title() ], style=default_assertion_style(passed=passed, depth=depth), start=row_idx)
def get_description(self, description, depth, row_idx): """ Description for a test object, this will generally be docstring text. """ return RowData( start=row_idx, content=split_text(format_description(description), const.FONT_ITALIC, const.FONT_SIZE_SMALL, const.PAGE_WIDTH - (depth * const.INDENT), keep_leading_whitespace=True), style=RowStyle(font=(const.FONT_ITALIC, const.FONT_SIZE_SMALL), left_padding=const.INDENT * depth, text_color=colors.grey))
def get_header(self, source, depth, row_idx): """ Assuming we have 4 columns per row, render the header in the format: [<TEST_NAME> - <NATIVE TAGS>][][][<TEST_STATUS>] """ passed = source.passed font_size = const.FONT_SIZE if depth == 0 else const.FONT_SIZE_SMALL font = const.FONT_BOLD if (depth == 0) or not passed else const.FONT styles = [ RowStyle(font=(font, font_size), line_above=self.get_header_linestyle()), RowStyle(left_padding=const.INDENT * depth, end_column=0), RowStyle( text_color=colors.green if passed else colors.red, start_column=const.LAST_COLUMN_IDX, ), ] if not source.passed: styles.append(RowStyle(background=colors.whitesmoke)) header_text = source.name if source.tags: header_text += " (Tags: {})".format(tagging.tag_label(source.tags)) header_text = split_text( header_text, font, font_size, const.PAGE_WIDTH - (depth * const.INDENT), ) return RowData( start=row_idx, content=[header_text, "", "", format_status(source.status)], style=styles, )