コード例 #1
0
 def test_text_run_set_text(self):
     text_run = TextRun(text="lorem ipsum")
     text_run.set_text("At sed sumo temporibus omittantur")
     self.assertDictEqual(text_run.as_data(), {
         "type": "TextRun",
         "text": "At sed sumo temporibus omittantur"
     })
コード例 #2
0
 def test_text_run_set_weight(self):
     text_run = TextRun(text="lorem ipsum")
     text_run.set_weight(FontWeight.LIGHTER)
     self.assertDictEqual(text_run.as_data(), {
         "type": "TextRun",
         "text": "lorem ipsum",
         "weight": "lighter"
     })
コード例 #3
0
 def test_text_run_set_size(self):
     text_run = TextRun(text="lorem ipsum")
     text_run.set_size(FontSize.LARGE)
     self.assertDictEqual(text_run.as_data(), {
         "type": "TextRun",
         "text": "lorem ipsum",
         "size": "large"
     })
コード例 #4
0
 def test_text_run_set_font_type(self):
     text_run = TextRun(text="lorem ipsum")
     text_run.set_font_type(FontType.DEFAULT)
     self.assertDictEqual(text_run.as_data(), {
         "type": "TextRun",
         "text": "lorem ipsum",
         "fontType": "default"
     })
コード例 #5
0
 def test_text_run_set_color(self):
     text_run = TextRun(text="lorem ipsum")
     text_run.set_color(Color.ACCENT)
     self.assertDictEqual(text_run.as_data(), {
         "type": "TextRun",
         "text": "lorem ipsum",
         "color": "accent"
     })
コード例 #6
0
 def test_text_run_set_select_action(self):
     text_run = TextRun(text="lorem ipsum")
     text_run.set_select_action(OpenUrl(URL))
     self.assertDictEqual(text_run.as_data(), {
         "type": "TextRun",
         "text": "lorem ipsum",
         "selectAction": {
             "type": "Action.OpenUrl",
             "url": URL
         }
     })
コード例 #7
0
 def test_text_run(self):
     text_run = TextRun(text="Choro homero aliquando te vis", color=Color.ATTENTION, font_type=FontType.MONOSPACE,
                        highlight=True, is_subtle=True, italic=True, select_action=OpenUrl(URL), size=FontSize.SMALL,
                        strike_through=True, weight=FontWeight.BOLDER)
     self.assertDictEqual(text_run.as_data(), {
         "type": "TextRun",
         "text": "Choro homero aliquando te vis",
         "color": "attention",
         "fontType": "monospace",
         "highlight": True,
         "isSubtle": True,
         "italic": True,
         "selectAction": {
             "type": "Action.OpenUrl",
             "url": URL
         },
         "size": "small",
         "strikethrough": True,
         "weight": "bolder"
     })
コード例 #8
0
 def test_rich_text_block_set_inlines(self):
     rich_text_block = RichTextBlock(inlines=["lorem ipsum", ])
     rich_text_block.set_inlines([TextRun("Sed ea quod nominati, at vel", color=Color.GOOD), "Eos saepe phaedrum"])
     self.assertDictEqual(rich_text_block.as_data(), {
         "type": "RichTextBlock",
         "inlines": [
             {
                 "type": "TextRun",
                 "text": "Sed ea quod nominati, at vel",
                 "color": "good"
             },
             "Eos saepe phaedrum"
         ]
     })
コード例 #9
0
 def test_rich_text_block(self):
     inlines = ["Odio adipisci honestatis sea ad", TextRun(text="Ad duo graecis hendrerit", color=Color.ATTENTION)]
     rich_text_block = RichTextBlock(inlines=inlines, horizontal_alignment=HorizontalAlignment.CENTER,
                                     fallback=FallbackOption.DROP, separator=True, spacing=SpacingStyle.MEDIUM,
                                     item_id="id_image", is_visible=True, requires=self.requires)
     self.assertDictEqual(rich_text_block.as_data(), {
         "type": "RichTextBlock",
         "inlines": [
             "Odio adipisci honestatis sea ad",
             {
                 "type": "TextRun",
                 "text": "Ad duo graecis hendrerit",
                 "color": "attention"
             }
         ],
         "horizontalAlignment": "center",
         "fallback": "drop",
         "separator": True,
         "spacing": "medium",
         "id": "id_image",
         "isVisible": True,
         "requires": self.requires
     })
コード例 #10
0
 def test_text_run_set_strike_through(self):
     text_run = TextRun(text="lorem ipsum")
     text_run.set_strike_through(False)
     self.assertDictEqual(text_run.as_data(), {
         "type": "TextRun",
         "text": "lorem ipsum",
         "strikethrough": False
     })
     text_run.set_strike_through(True)
     self.assertDictEqual(text_run.as_data(), {
         "type": "TextRun",
         "text": "lorem ipsum",
         "strikethrough": True
     })
     text_run.set_strike_through()
     self.assertDictEqual(text_run.as_data(), {
         "type": "TextRun",
         "text": "lorem ipsum",
         "strikethrough": True
     })
コード例 #11
0
 def test_text_run_set_italic(self):
     text_run = TextRun(text="lorem ipsum")
     text_run.set_italic(False)
     self.assertDictEqual(text_run.as_data(), {
         "type": "TextRun",
         "text": "lorem ipsum",
         "italic": False
     })
     text_run.set_italic(True)
     self.assertDictEqual(text_run.as_data(), {
         "type": "TextRun",
         "text": "lorem ipsum",
         "italic": True
     })
     text_run.set_italic()
     self.assertDictEqual(text_run.as_data(), {
         "type": "TextRun",
         "text": "lorem ipsum",
         "italic": True
     })
コード例 #12
0
 def test_text_run_set_highlight(self):
     text_run = TextRun(text="lorem ipsum")
     text_run.set_highlight(False)
     self.assertDictEqual(text_run.as_data(), {
         "type": "TextRun",
         "text": "lorem ipsum",
         "highlight": False
     })
     text_run.set_highlight(True)
     self.assertDictEqual(text_run.as_data(), {
         "type": "TextRun",
         "text": "lorem ipsum",
         "highlight": True
     })
     text_run.set_highlight()
     self.assertDictEqual(text_run.as_data(), {
         "type": "TextRun",
         "text": "lorem ipsum",
         "highlight": True
     })