def test_create_sub_shape_portion(self): dto = Portion() dto.text = constant.PORTION_TEXT dto.font_bold = "True" dto.font_height = 20 dto.latin_font = constant.FONT_NAME fill_format = SolidFill() fill_format.color = constant.COLOR dto.fill_format = fill_format BaseTest.slides_api.copy_file( "TempTests/" + constant.FILE_NAME, constant.FOLDER_NAME + "/" + constant.FILE_NAME) slide_index = 6 shape_index = 1 paragraph_index = 1 shape_path = "3/shapes" response = BaseTest.slides_api.create_subshape_portion( constant.FILE_NAME, slide_index, shape_path, shape_index, paragraph_index, dto, None, constant.PASSWORD, constant.FOLDER_NAME) self.assertEqual(dto.text, response.text) self.assertEqual(dto.font_bold, response.font_bold) self.assertEqual(dto.font_height, response.font_height) self.assertEqual(dto.latin_font, response.latin_font) self.assertEqual("Solid", response.fill_format.type)
def test_set_background(self): BaseTest.slides_api.copy_file("TempTests/" + constant.FILE_NAME, constant.FOLDER_NAME + "/" + constant.FILE_NAME) dto = SlideBackground() fill_format = SolidFill() fill_format.color = constant.COLOR dto.fill_format = fill_format slide_index = 1 response = BaseTest.slides_api.set_background(constant.FILE_NAME, slide_index, dto, constant.PASSWORD, constant.FOLDER_NAME) self.assertTrue(isinstance(response.fill_format, SolidFill)) self.assertEqual(constant.COLOR, response.fill_format.color)
def test_shape_format_fill(self): folder_name = "TempSlidesSDK" file_name = "test.pptx" password = "******" slideIndex = 1 shapeIndex = 1 BaseTest.slides_api.copy_file("TempTests/" + file_name, folder_name + "/" + file_name) dto = Shape() fill_format = SolidFill() fill_format.color = "#FFFFFF00" dto.fill_format = fill_format shape = BaseTest.slides_api.update_shape(file_name, 1, 1, dto, password, folder_name) self.assertTrue(isinstance(shape, Shape)) shape = BaseTest.slides_api.get_shape(file_name, 1, 1, password, folder_name) self.assertTrue(isinstance(shape, Shape)) self.assertTrue(isinstance(shape.fill_format, SolidFill)) self.assertEqual(dto.fill_format.color, shape.fill_format.color)
def test_smart_art_text_formatting(self): BaseTest.slides_api.copy_file( "TempTests/" + constant.FILE_NAME, constant.FOLDER_NAME + "/" + constant.FILE_NAME) portion = Portion() portion.text = "New text" portion.font_height = 24 portion.font_bold = "True" portion.spacing = 3 fill_format = SolidFill() fill_format.color = "#FFFFFF00" portion.fill_format = fill_format target_node_path = "1/nodes/1/nodes" slide_index = 7 response = BaseTest.slides_api.update_subshape_portion( constant.FILE_NAME, slide_index, target_node_path, 2, 1, 1, portion, constant.PASSWORD, constant.FOLDER_NAME) self.assertIsNotNone(response) self.assertEqual(response.text, portion.text) self.assertEqual(response.font_height, portion.font_height) self.assertEqual(response.font_bold, portion.font_bold) self.assertEqual(response.spacing, portion.spacing) self.assertEqual(response.fill_format.color, portion.fill_format.color)
def test_chart_grid_lines_format(self): folder_name = "TempSlidesSDK" file_name = "test.pptx" slide_index = 3 shape_index = 1 BaseTest.slides_api.copy_file("TempTests/" + file_name, folder_name + "/" + file_name) chart = BaseTest.slides_api.get_shape(file_name, slide_index, shape_index, "password", folder_name) horizontal_axis = Axis() horizontal_axis.major_grid_lines_format = ChartLinesFormat() horizontal_axis.major_grid_lines_format.line_format = LineFormat() horizontal_axis.major_grid_lines_format.line_format.fill_format = NoFill( ) horizontal_axis.minor_grid_lines_format = ChartLinesFormat() horizontal_axis.minor_grid_lines_format.line_format = LineFormat() horizontal_axis.minor_grid_lines_format.line_format.fill_format = SolidFill( ) horizontal_axis.minor_grid_lines_format.line_format.fill_format.color = "Black" vertical_axis = Axis() vertical_axis.major_grid_lines_format = ChartLinesFormat() vertical_axis.major_grid_lines_format.line_format = LineFormat() gradient_fill = GradientFill() gradient_fill.direction = "FromCorner1" stop1 = GradientFillStop() stop1.color = "White" stop1.position = 0 stop2 = GradientFillStop() stop2.color = "Black" stop2.position = 1 gradient_fill.stops = [stop1, stop2] vertical_axis.major_grid_lines_format.line_format.fill_format = gradient_fill vertical_axis.minor_grid_lines_format = ChartLinesFormat() vertical_axis.minor_grid_lines_format.line_format = LineFormat() vertical_axis.minor_grid_lines_format.line_format.fill_format = NoFill( ) chart.axes = Axes() chart.axes.horizontal_axis = horizontal_axis chart.axes.vertical_axis = vertical_axis chart = BaseTest.slides_api.update_shape(file_name, slide_index, shape_index, chart, "password", folder_name) self.assertEqual( "NoFill", chart.axes.horizontal_axis.major_grid_lines_format. line_format.fill_format.type) self.assertEqual( "Solid", chart.axes.horizontal_axis.minor_grid_lines_format. line_format.fill_format.type) self.assertEqual( "Gradient", chart.axes.vertical_axis.major_grid_lines_format. line_format.fill_format.type) self.assertEqual( "NoFill", chart.axes.vertical_axis.minor_grid_lines_format. line_format.fill_format.type)