def test_webvtt_newlines_are_properly_rendered(self):
        caption_set = SCCReader().read(
            SCC_THAT_GENERATES_WEBVTT_WITH_PROPER_NEWLINES)
        webvtt = WebVTTWriter().write(caption_set)

        self.assertEqual(
            webvtt, SAMPLE_WEBVTT_FROM_SCC_PROPERLY_WRITES_NEWLINES_OUTPUT)
Exemplo n.º 2
0
 def test_dfxp_to_webvtt_preserves_proper_alignment(self):
     # This failed at one point when the CaptionSet had node breaks with
     # different positioning. It was fixed both at the DFXPReader AND the
     # WebVTTWriter.
     caption_set = DFXPReader().read(DFXP_STYLE_REGION_ALIGN_CONFLICT)
     results = WebVTTWriter().write(caption_set)
     self.assertEqual(WEBVTT_FROM_DFXP_WITH_CONFLICTING_ALIGN, results)
Exemplo n.º 3
0
 def test_dfxp_with_positioning_to_webvtt_conversion(self):
     caption_set = DFXPReader().read(SAMPLE_DFXP_WITH_POSITIONING)
     results = WebVTTWriter(video_width=VIDEO_WIDTH,
                            video_height=VIDEO_HEIGHT).write(caption_set)
     self.assertTrue(isinstance(results, text_type))
     self.assertWebVTTEquals(
         SAMPLE_WEBVTT_FROM_DFXP_WITH_POSITIONING_AND_STYLE, results)
Exemplo n.º 4
0
 def test_dfxp_to_webvtt_adds_explicit_size(self):
     caption_set = DFXPReader().read(SAMPLE_DFXP_LONG_CUE)
     results = WebVTTWriter().write(caption_set)
     self.assertTrue(isinstance(results, text_type))
     self.assertEqual(SAMPLE_WEBVTT_OUTPUT_LONG_CUE, results)
Exemplo n.º 5
0
 def test_dfxp_with_inherited_style_to_webvtt_conversion(self):
     caption_set = DFXPReader().read(SAMPLE_DFXP_WITH_INHERITED_STYLE)
     results = WebVTTWriter().write(caption_set)
     self.assertTrue(isinstance(results, text_type))
     self.assertWebVTTEquals(SAMPLE_WEBVTT_FROM_DFXP_WITH_STYLE, results)
Exemplo n.º 6
0
 def test_dfxp_to_webvtt_conversion(self):
     caption_set = DFXPReader().read(SAMPLE_DFXP)
     results = WebVTTWriter().write(caption_set)
     self.assertTrue(isinstance(results, text_type))
     self.assertWebVTTEquals(SAMPLE_WEBVTT_FROM_DFXP, results)
 def test_positioning_is_kept(self):
     caption_set = WebVTTReader().read(
         SAMPLE_WEBVTT_FROM_DFXP_WITH_POSITIONING)
     results = WebVTTWriter().write(caption_set)
     self.assertEqual(
         SAMPLE_WEBVTT_FROM_DFXP_WITH_POSITIONING, results)
    def test_cue_settings_are_kept(self):
        caption_set = WebVTTReader().read(SAMPLE_WEBVTT_WITH_CUE_SETTINGS)

        webvtt = WebVTTWriter().write(caption_set)

        self.assertEqual(SAMPLE_WEBVTT_WITH_CUE_SETTINGS, webvtt)
Exemplo n.º 9
0
 def test_break_node_positioning_is_ignored(self):
     caption_set = DFXPReader().read(DFXP_STYLE_REGION_ALIGN_CONFLICT)
     results = WebVTTWriter().write(caption_set)
     self.assertEqual(WEBVTT_FROM_DFXP_WITH_CONFLICTING_ALIGN, results)
Exemplo n.º 10
0
 def test_double_br(self):
     caption_set = SAMIReader().read(SAMPLE_SAMI_DOUBLE_BR)
     results = WebVTTWriter().write(caption_set)
     self.assertEqual(SAMPLE_WEBVTT_DOUBLE_BR, results)
Exemplo n.º 11
0
 def setUp(self):
     self.writer = WebVTTWriter()
 def test_srt_to_webvtt_conversion(self):
     caption_set = SRTReader().read(SAMPLE_SRT)
     results = WebVTTWriter().write(caption_set)
     self.assertTrue(isinstance(results, six.text_type))
     self.assertWebVTTEquals(SAMPLE_WEBVTT_FROM_SRT, results)
 def test_sami_with_css_id_style_to_webvtt_conversion(self):
     caption_set = SAMIReader().read(SAMPLE_SAMI_WITH_CSS_ID_STYLE)
     results = WebVTTWriter(video_width=640,
                            video_height=360).write(caption_set)
     self.assertTrue(isinstance(results, six.text_type))
     self.assertWebVTTEquals(SAMPLE_WEBVTT_FROM_SAMI_WITH_ID_STYLE, results)