gstreamer/testsuite
Nicolas Dufresne a4566ffbc8 overrides: Add more GstValue overrides
This patch adds overrides to support IntRange, Int64Range, DoubleRange,
FractionRange, Array and List. For integer ranges, it maps this
to python 'range'. Gst.IntRange() and Gst.Int64Range() are simple cast
to let the underlying code know which GType to use. To set such range in
python you will do:

  structure["range"] = Gst.IntRange(range(0,10,2)))

Same for the 64 bit variant. And when you do:

  r = structure.get_value("range")

A range will be returned directly, without the wrapper. For DoubleRange
and FractionRange, there is no native support in python. So the usage
will be:

  structure["range"] = Gst.DoubleRange(0,10.0)
  structure["range"] =
      Gst.FractionRange(Gst.Fraction(1/30), Gst.Fraction(1/5)

When getting this value, Gst.DoubleRange and Gst.FractionRange class are
returned. They both have start/stop members. The naming was taken from
range type.

For Array and List, both uses the native list type, though they can be
constructed from any python sequence. So again, the class is just like
a cast, to let it pick the right GType and python list are being
returned.

  structure["list"] = Gst.ValueList([1,2,3,4])
  structure["array"] = Gst.ValueArray([1,2,3,4)

Using string and tuple could also work. Since Gst.ValueList/Array are
sequence, you can convert one to the other with:

  list = Gst.ValueList([1,2,3,4])
  array = Gst.ValueArray (list)

https://bugzilla.gnome.org/show_bug.cgi?id=753754
2017-03-24 13:26:21 -04:00
..
old tests: Add test_fraction back in the testsuite 2015-04-24 11:21:44 +02:00
.gitignore Ignore log files. 2006-06-13 11:05:08 +00:00
__init__.py Release 1.5.2 2015-06-24 17:44:30 +02:00
cleanup.py testsuite/: Added cleanup file to initialize registry before running checks. 2006-06-12 16:51:36 +00:00
common.py overrides: Add more GstValue overrides 2017-03-24 13:26:21 -04:00
gstpython.supp testsuite/gstpython.supp: Keeping suppresions 2006-06-13 17:43:40 +00:00
Makefile.am overrides: Add more GstValue overrides 2017-03-24 13:26:21 -04:00
meson.build overrides: Add more GstValue overrides 2017-03-24 13:26:21 -04:00
overrides_hack.py Play nicely with gst-build uninstalled 2016-11-04 11:40:10 -03:00
python.supp testsuite/python.supp: Added suppressions for FC5 64 bit 2006-05-09 10:25:17 +00:00
runtests.py meson: Add testsuite 2016-11-04 11:40:10 -03:00
test_doublerange.py overrides: Add more GstValue overrides 2017-03-24 13:26:21 -04:00
test_fraction.py overrides: Add more GstValue overrides 2017-03-24 13:26:21 -04:00
test_fractionrange.py overrides: Add more GstValue overrides 2017-03-24 13:26:21 -04:00
test_gst.py tests: Fix tests in python2 2015-04-24 11:25:38 +02:00
test_int64range.py overrides: Add more GstValue overrides 2017-03-24 13:26:21 -04:00
test_intrange.py overrides: Add more GstValue overrides 2017-03-24 13:26:21 -04:00
test_valuearray.py overrides: Add more GstValue overrides 2017-03-24 13:26:21 -04:00
test_valuelist.py overrides: Add more GstValue overrides 2017-03-24 13:26:21 -04:00