def test_adding(self, filter, concat): inf1 = editor.Information('name1', 0, 10, 1, 0, 0, 100, 100, 'path1', 10) inf2 = editor.Information('name2', 0, 10, 1, 0, 0, 100, 100, 'path2', 15) frame1 = editor.Frame([inf1, inf2], 'video', 'audio') frame1.video = 'video1' frame1.audio = 'audio1' frame2 = editor.Frame([inf1, inf2], 'video', 'audio') frame2.video = 'video2' frame2.audio = 'audio2' editor.concat([frame1, frame2]) concat.assert_any_call('video1', 'video2', n=2, v=1, a=0, unsafe=1) concat.assert_any_call('audio1', 'audio2', n=2, v=0, a=1, unsafe=1)
def test_frame(self): inf1 = init_inf() inf2 = init_inf() frame = editor.Frame([inf1, inf2], 'video', 'audio') copy = frame.get_copy() self.assertEqual(len(copy.information), len(frame.information)) self.assertEqual(copy.information[0].__dict__, frame.information[0].__dict__) copy.information[0].pictures[0] = 'another.jpg' self.assertNotEqual(copy.information[0].__dict__, frame.information[0].__dict__)
def test_subs_prep(self, print_f, filt): with mock.patch.dict(editor.frame_dict, self.d): inf1 = editor.Information('name1', 0, 10, 1, 0, 0, 100, 100, 'path1', 10) inf2 = editor.Information('name2', 0, 10, 1, 0, 0, 100, 100, 'path2', 15) frame1 = editor.Frame([inf1, inf2], 'video', 'audio') frame1.video = 'video' frame1.audio = 'audio' editor.subs_prep('new_name', 'x0', 'y0', 10, 10, 'path', frame1) print(editor.frame_dict['new_name'])
def test_print_frame(self, my_print): inf1 = init_inf() inf2 = init_inf() frame = editor.Frame([inf1, inf2], 'video', 'audio') print() frame.print_frame() my_print.assert_any_call(red_start + "Этот фрагмент" " - конкатенация нескольких.\n" + red_end + "Сейчас будет выведенена" " информация о них, в порядке конкатенации") my_print.assert_any_call(red_start + 'общая продолжительность фрагмента ' + red_end + str(180))
def test_insert(self): inf1 = editor.Information('name1', 0, 10, 1, 0, 0, 100, 100, 'path1', 10) inf2 = editor.Information('name2', 0, 10, 1, 0, 0, 100, 100, 'path2', 15) frame1 = editor.Frame([inf1, inf2], 'video', 'audio') frame1.video = 'video' frame1.audio = 'audio' res_frame = editor.get_res_frame(frame1, 'some_subs1', 'video', 'audio', 'subs') res_frame = editor.get_res_frame(res_frame, 'some_subs2', 'video', 'audio', 'subs') for e in res_frame.information: self.assertEqual(e.subs, ['some_subs1', 'some_subs2'])