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_layout_slide_portions(self):
        folder_name = "TempSlidesSDK"
        file_name = "test.pptx"
        password = "******"
        slide_index = 1
        shape_index = 2
        paragraph_index = 1
        portion_count = 1
        BaseTest.slides_api.copy_file("TempTests/" + file_name,
                                      folder_name + "/" + file_name)

        portions = BaseTest.slides_api.get_special_slide_portions(
            file_name, slide_index, 'layoutSlide', shape_index,
            paragraph_index, password, folder_name)
        self.assertEqual(portion_count, len(portions.items))

        dto = Portion()
        dto.text = "New portion"
        dto.font_bold = "True"
        portion = BaseTest.slides_api.create_special_slide_portion(
            file_name, slide_index, 'layoutSlide', shape_index,
            paragraph_index, dto, None, password, folder_name)
        self.assertEqual(dto.font_bold, portion.font_bold)
        self.assertEqual(dto.text, portion.text)
        portions = BaseTest.slides_api.get_special_slide_portions(
            file_name, slide_index, 'layoutSlide', shape_index,
            paragraph_index, password, folder_name)
        self.assertEqual(portion_count + 1, len(portions.items))

        dto2 = Portion()
        dto2.text = "Updated portion"
        dto2.font_height = 22
        portion = BaseTest.slides_api.update_special_slide_portion(
            file_name, slide_index, 'layoutSlide', shape_index,
            paragraph_index, portion_count + 1, dto2, password, folder_name)
        self.assertEqual(dto.font_bold, portion.font_bold)
        self.assertEqual(dto2.font_height, portion.font_height)
        self.assertEqual(dto2.text, portion.text)
        portions = BaseTest.slides_api.get_special_slide_portions(
            file_name, slide_index, 'layoutSlide', shape_index,
            paragraph_index, password, folder_name)
        self.assertEqual(portion_count + 1, len(portions.items))

        BaseTest.slides_api.delete_special_slide_portion(
            file_name, slide_index, 'layoutSlide', shape_index,
            paragraph_index, portion_count + 1, password, folder_name)
        portions = BaseTest.slides_api.get_special_slide_portions(
            file_name, slide_index, 'layoutSlide', shape_index,
            paragraph_index, password, folder_name)
        self.assertEqual(portion_count, len(portions.items))
    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)