Commit graph

8 commits

Author SHA1 Message Date
Thibault Saunier
24c6e49874 Move files from gst-python into the "subprojects/gst-python//" subdir 2021-09-24 16:16:05 -03:00
Olivier Crête
bc3e5b1206 test: Add test for the plugin loader
Fix #8
2020-01-07 10:42:36 +05:30
Mathieu Duponchelle
d64bbc1e0c Tests: refactor testing approach
Instead of fiddling with sys.path, we instead use a custom
sys.meta_path importer
2018-10-31 00:41:31 +01:00
Havard Graff
af4ade3743 meson: use new python module
This patch makes the tests pass running uninstalled and installed, with
python2 and python3 on linux, windows and osx.

The main gist is to use the new python-module to do the lifting done
by pythondetector, and with that add support for python2 and windows.
2018-10-28 17:53:44 +01:00
Thibault Saunier
fcbca025e3 Fix simply running testsuite in meson
- Make sure to never have root folder in sys.path when running meson,
  as pythondetector won't be able to access gi._overridesdir

- Generate a mesonconfig.py file that will be used by the testsuite to
  know where meson generated files, making `python -m unittest` working.
2017-07-26 15:27:21 -04:00
Thibault Saunier
9845c91a5f tests: Move all Fundamental types tests in a file
No reason to have one file per type and it makes it more complicated
to handle.
2017-07-26 15:27:21 -04:00
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
Thibault Saunier
490028ba21 meson: Add testsuite 2016-11-04 11:40:10 -03:00