mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-04 23:46:43 +00:00
564505e16f
Add a simple test for that.
62 lines
No EOL
2.2 KiB
Python
62 lines
No EOL
2.2 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 . import common
|
|
from .common import GESSimpleTimelineTest # noqa
|
|
|
|
Gst.init(None)
|
|
GES.init()
|
|
|
|
|
|
class TestTimeline(GESSimpleTimelineTest):
|
|
|
|
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")))
|
|
|
|
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) |