2
# PiTiVi , Non-linear video editor
4
# test_formatters_base.py
6
# Copyright (c) 2011, Alex Balut <alexandru.balut@gmail.com>
8
# This program is free software; you can redistribute it and/or
9
# modify it under the terms of the GNU Lesser General Public
10
# License as published by the Free Software Foundation; either
11
# version 2.1 of the License, or (at your option) any later version.
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
# Lesser General Public License for more details.
18
# You should have received a copy of the GNU Lesser General Public
19
# License along with this program; if not, write to the
20
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
21
# Boston, MA 02110-1301, USA.
26
from pitivi.formatters.base import Formatter
28
from common import TestCase
31
class TestFormatter(TestCase):
35
self.formatter = Formatter(avalaible_effects=None)
37
def testSearchMissingFile(self):
38
# The scenario is that a file has been moved from dir1 to dir2.
39
dir0 = tempfile.mkdtemp()
41
dir1 = tempfile.mkdtemp(dir=dir0)
42
dir2 = tempfile.mkdtemp(dir=dir0)
43
unused_file2, file2_path = tempfile.mkstemp(dir=dir2)
44
uri2 = 'file://%s' % file2_path
45
uri1 = uri2.replace(dir2, dir1)
47
self.assertIsNone(self.formatter._searchMissingFile(uri1))
49
self.formatter.addMapping('file://%s' % dir1, 'file://%s' % dir2)
50
self.assertEqual(uri2, self.formatter._searchMissingFile(uri1))