Exemple #1
0
    def test_no_space_left(self):
        self.original_video.duration = 10
        self.original_video.save()
        subs = [SubtitleLine(
            2 * 1000,
            10 * 1000,
            'text',
            {},
        )]

        subs = add_credit(self.version, self._subs_to_sset(subs))
        self.assertEquals(len(subs), 1)
        last_sub = subs[-1]
        self.assertEquals(last_sub.text, 'text')
Exemple #2
0
    def test_straight_up_video(self):
        subs = [SubtitleLine(
            2 * 1000,
            3 * 1000,
            'text',
            {},
        )]

        subs = add_credit(self.version, self._subs_to_sset(subs))
        last_sub = subs[-1]
        self.assertEquals(last_sub.text,
                          "Subtitles by the Amara.org community")
        self.assertEquals(last_sub.start_time, 7000)
        self.assertEquals(last_sub.end_time, 10 * 1000)
Exemple #3
0
    def test_only_a_second_left(self):
        subs = [SubtitleLine(
            2 * 1000,
            9 * 1000,
            'text',
            {},
        )]

        subs = add_credit(self.version, self._subs_to_sset(subs))
        last_sub = subs[-1]
        self.assertEquals(last_sub.text,
                          "Subtitles by the Amara.org community")
        self.assertEquals(last_sub.start_time, 9000)
        self.assertEquals(last_sub.end_time, 10 * 1000)
Exemple #4
0
    def test_last_sub_not_synced(self):
        subs = [SubtitleLine(
            2 * 1000,
            None,
            'text',
            {},
        )]

        last_sub = subs[-1]

        self.assertEquals(last_sub.end_time, None)

        subs = add_credit(self.version, self._subs_to_sset(subs))

        self.assertEquals(last_sub.text, subs[-1].text)