[vlc-commits] Add test coverage for MRL encoding fix

Tomas Groth git at videolan.org
Fri Oct 2 10:50:10 CEST 2015


vlc/python | branch: master | Tomas Groth <tomasgroth at yahoo.dk> | Fri Oct  2 10:49:48 2015 +0200| [84c141a4f7d01293be4bea70f9f93f76ff1d5e89] | committer: Olivier Aubert

Add test coverage for MRL encoding fix

Signed-off-by: Olivier Aubert <contact at olivieraubert.net>

> http://git.videolan.org/gitweb.cgi/vlc/python.git/?a=commit;h=84c141a4f7d01293be4bea70f9f93f76ff1d5e89
---

 test.py |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/test.py b/test.py
index 45e5834..af35133 100755
--- a/test.py
+++ b/test.py
@@ -1,4 +1,5 @@
 #! /usr/bin/python
+# This Python file uses the following encoding: utf-8
 
 #
 # Code generator for python ctypes bindings for VLC
@@ -26,7 +27,16 @@
 """
 
 import unittest
-import vlc
+try:
+    import urllib.parse as urllib # python3
+except:
+    import urllib # python2
+
+try:
+    import vlc
+except:
+    import generated.vlc as vlc
+
 print ("Checking " + vlc.__file__)
 
 class TestVLCAPI(unittest.TestCase):
@@ -98,5 +108,13 @@ class TestVLCAPI(unittest.TestCase):
         p=i.media_player_new(mrl)
         self.assertEqual(p.get_state(), vlc.State.NothingSpecial)
 
+    # Test that the VLC bindings can handle special characters in the filenames
+    def test_libvlc_player_special_chars(self):
+        mrl = u'/tmp/Test 韓 Korean.mp4'
+        i = vlc.Instance()
+        m = i.media_new(mrl)
+        url_encoded_mrl = urllib.quote(mrl.encode('utf-8'))
+        self.assertEqual(m.get_mrl(), 'file://' + url_encoded_mrl)
+
 if __name__ == '__main__':
     unittest.main()



More information about the vlc-commits mailing list