Initial import to Tizen
[profile/ivi/gstreamer-python.git] / testsuite / test_xml.py
1 # -*- Mode: Python -*-
2 # vi:si:et:sw=4:sts=4:ts=4
3 #
4 # gst-python - Python bindings for GStreamer
5 # Copyright (C) 2002 David I. Lehn
6 # Copyright (C) 2004 Johan Dahlin
7 # Copyright (C) 2005 Edward Hervey
8 #
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public
11 # License as published by the Free Software Foundation; either
12 # version 2.1 of the License, or (at your option) any later version.
13 #
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 # Lesser General Public License for more details.
18 #
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with this library; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
22
23 from common import gst, unittest, TestCase
24
25 class PadTest(TestCase):
26         
27     def testQuery(self):
28         # don't run this test if we don't have the libxml2 module
29         try:
30             import libxml2
31         except:
32             return
33         xml = gst.XML()
34         xml.parse_memory("""<?xml version="1.0"?>
35 <gstreamer xmlns:gst="http://gstreamer.net/gst-core/1.0/">
36   <gst:element>
37     <gst:name>test-pipeline</gst:name>
38     <gst:type>pipeline</gst:type>
39     <gst:param>
40       <gst:name>name</gst:name>
41       <gst:value>test-pipeline</gst:value>
42     </gst:param>
43   </gst:element>
44 </gstreamer>""")
45         elements = xml.get_topelements()
46         assert len(elements) == 1
47         element = elements[0]
48         assert isinstance(element, gst.Pipeline)
49         assert element.get_name() == 'test-pipeline'
50         
51 if __name__ == "__main__":
52     unittest.main()
53