gstreamer/tests/check/python/test_assets.py
Thibault Saunier bad64296d9 uri-asset: Use the same code path for sync discovery as the async one
And start handling relocated assets.

Also expose the discoverer callback as a vmethod so that we can
overridde the discoverer when necessary (to handle discovering of
timeline through gesdemux for example)
2019-01-29 00:06:32 +00:00

50 lines
No EOL
1.7 KiB
Python

# -*- 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
from .common import GESSimpleTimelineTest # noqa
Gst.init(None)
GES.init()
class TestTimeline(unittest.TestCase):
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,
Gst.filename_to_uri(os.path.join(__file__, "../../assets/png.png")))