2019-01-18 18:45:39 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
# Copyright (c) 2019 Thibault Saunier <tsaunier@igalia.com>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this program; if not, write to the
|
|
|
|
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
# Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
from . import overrides_hack
|
|
|
|
|
|
|
|
import os
|
|
|
|
import gi
|
|
|
|
|
|
|
|
gi.require_version("Gst", "1.0")
|
|
|
|
gi.require_version("GES", "1.0")
|
|
|
|
|
|
|
|
from gi.repository import Gst # noqa
|
|
|
|
from gi.repository import GLib # noqa
|
|
|
|
from gi.repository import GES # noqa
|
|
|
|
import unittest # noqa
|
|
|
|
from unittest import mock
|
|
|
|
|
2019-06-21 15:45:20 +00:00
|
|
|
from . import common
|
2019-01-18 18:45:39 +00:00
|
|
|
from .common import GESSimpleTimelineTest # noqa
|
|
|
|
|
|
|
|
Gst.init(None)
|
|
|
|
GES.init()
|
|
|
|
|
|
|
|
|
2019-06-21 15:45:20 +00:00
|
|
|
class TestTimeline(GESSimpleTimelineTest):
|
2019-01-18 18:45:39 +00:00
|
|
|
|
|
|
|
def test_request_relocated_assets_sync(self):
|
|
|
|
path = os.path.join(__file__, "../../../", "png.png")
|
|
|
|
with self.assertRaises(GLib.Error):
|
|
|
|
GES.UriClipAsset.request_sync(Gst.filename_to_uri(path))
|
|
|
|
|
|
|
|
GES.add_missing_uri_relocation_uri(Gst.filename_to_uri(os.path.join(__file__, "../../assets")), False)
|
|
|
|
path = os.path.join(__file__, "../../", "png.png")
|
|
|
|
self.assertEqual(GES.UriClipAsset.request_sync(Gst.filename_to_uri(path)).props.id,
|
2019-06-21 15:45:20 +00:00
|
|
|
Gst.filename_to_uri(os.path.join(__file__, "../../assets/png.png")))
|
|
|
|
|
|
|
|
def test_request_relocated_twice(self):
|
|
|
|
mainloop = common.create_main_loop()
|
|
|
|
|
|
|
|
GES.add_missing_uri_relocation_uri(Gst.filename_to_uri(os.path.join(__file__, "../../")), True)
|
|
|
|
proj = GES.Project.new()
|
|
|
|
|
|
|
|
asset = proj.create_asset_sync("file:///png.png", GES.UriClip)
|
|
|
|
self.assertIsNotNone(asset)
|
|
|
|
asset = proj.create_asset_sync("file:///png.png", GES.UriClip)
|
|
|
|
self.assertIsNotNone(asset)
|