def test_layout_slide_paragraphs(self): folder_name = "TempSlidesSDK" file_name = "test.pptx" password = "******" slide_index = 1 shape_index = 2 paragraph_count = 1 BaseTest.slides_api.copy_file("TempTests/" + file_name, folder_name + "/" + file_name) paragraphs = BaseTest.slides_api.get_special_slide_paragraphs( file_name, slide_index, 'layoutSlide', shape_index, password, folder_name) self.assertEqual(paragraph_count, len(paragraphs.paragraph_links)) portion = Portion() portion.text = "New Paragraph" dto = Paragraph() dto.alignment = "Right" dto.portion_list = [portion] paragraph = BaseTest.slides_api.create_special_slide_paragraph( file_name, slide_index, 'layoutSlide', shape_index, dto, None, password, folder_name) self.assertEqual(dto.alignment, paragraph.alignment) paragraphs = BaseTest.slides_api.get_special_slide_paragraphs( file_name, slide_index, 'layoutSlide', shape_index, password, folder_name) self.assertEqual(paragraph_count + 1, len(paragraphs.paragraph_links)) dto = Paragraph() dto.alignment = "Center" paragraph = BaseTest.slides_api.update_special_slide_paragraph( file_name, slide_index, 'layoutSlide', shape_index, paragraph_count + 1, dto, password, folder_name) self.assertEqual(dto.alignment, paragraph.alignment) paragraphs = BaseTest.slides_api.get_special_slide_paragraphs( file_name, slide_index, 'layoutSlide', shape_index, password, folder_name) self.assertEqual(paragraph_count + 1, len(paragraphs.paragraph_links)) BaseTest.slides_api.delete_special_slide_paragraph( file_name, slide_index, 'layoutSlide', shape_index, paragraph_count + 1, password, folder_name) paragraphs = BaseTest.slides_api.get_special_slide_paragraphs( file_name, slide_index, 'layoutSlide', shape_index, password, folder_name) self.assertEqual(paragraph_count, len(paragraphs.paragraph_links))
def test_create_paragraph(self): BaseTest.slides_api.copy_file( "TempTests/" + constant.FILE_NAME, constant.FOLDER_NAME + "/" + constant.FILE_NAME) dto = Paragraph() dto.margin_left = 2 dto.margin_right = 2 dto.alignment = "Center" slide_index = 6 shape_index = 2 response = BaseTest.slides_api.create_paragraph( constant.FILE_NAME, slide_index, shape_index, dto, None, constant.PASSWORD, constant.FOLDER_NAME) self.assertEqual(dto.margin_left, response.margin_left) self.assertEqual(dto.margin_right, response.margin_right) self.assertEqual(dto.alignment, response.alignment)