[pitivi] transitions: Fix transition types detection



commit 4a56a40e14f442bb1f855a9f0e199c265df10aec
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Sat Sep 21 02:43:14 2019 +0200

    transitions: Fix transition types detection
    
    Fixes #2352

 pitivi/transitions.py     |  6 +++---
 tests/test_transitions.py | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/transitions.py b/pitivi/transitions.py
index 8062aad8..5b6cdb26 100644
--- a/pitivi/transitions.py
+++ b/pitivi/transitions.py
@@ -129,7 +129,7 @@ class TransitionsListWidget(Gtk.Box, Loggable):
         self.iconview.connect("query-tooltip", self._queryTooltipCb)
 
         # Speed-up startup by only checking available transitions on idle
-        GLib.idle_add(self._loadAvailableTransitionsCb)
+        GLib.idle_add(self._load_available_transitions_cb)
 
         self.pack_start(self.infobar, False, False, 0)
         self.pack_start(self.searchbar, False, False, 0)
@@ -251,9 +251,9 @@ class TransitionsListWidget(Gtk.Box, Loggable):
 
 # UI methods
 
-    def _loadAvailableTransitionsCb(self):
+    def _load_available_transitions_cb(self):
         """Loads the transitions types and icons into the storemodel."""
-        for trans_asset in GES.list_assets(GES.BaseTransitionClip):
+        for trans_asset in GES.list_assets(GES.TransitionClip):
             trans_asset.icon = self._getIcon(trans_asset.get_id())
             self.storemodel.append([trans_asset,
                                     str(trans_asset.get_id()),
diff --git a/tests/test_transitions.py b/tests/test_transitions.py
new file mode 100644
index 00000000..95fe3bfb
--- /dev/null
+++ b/tests/test_transitions.py
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+# Pitivi video editor
+# Copyright (c) 2019, Alex Băluț <alexandru balut gmail 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.
+"""Tests for the transitions module."""
+from pitivi.transitions import TransitionsListWidget
+from tests import common
+
+
+class TransitionsListWidgetTest(common.TestCase):
+    """Tests for the TransitionsListWidget class."""
+
+    def test_transition_types_loaded(self):
+        """Checks the transition types are properly detected."""
+        app = common.create_pitivi_mock()
+        widget = TransitionsListWidget(app)
+        mainloop = common.create_main_loop()
+        mainloop.run(until_empty=True)
+        self.assertGreater(len(widget.storemodel), 10)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]