mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
more ignore, add enumcaps.c
Original commit message from CVS: more ignore, add enumcaps.c
This commit is contained in:
parent
06bb8beb03
commit
567bd4a202
6 changed files with 200 additions and 0 deletions
3
tests/old/testsuite/caps/.gitignore
vendored
3
tests/old/testsuite/caps/.gitignore
vendored
|
@ -14,9 +14,11 @@ audioscale
|
||||||
caps
|
caps
|
||||||
compatibility
|
compatibility
|
||||||
deserialize
|
deserialize
|
||||||
|
enumcaps
|
||||||
eratosthenes
|
eratosthenes
|
||||||
filtercaps
|
filtercaps
|
||||||
fixed
|
fixed
|
||||||
|
fraction-convert
|
||||||
fraction-multiply-and-zero
|
fraction-multiply-and-zero
|
||||||
intersect2
|
intersect2
|
||||||
intersection
|
intersection
|
||||||
|
@ -27,6 +29,7 @@ union
|
||||||
simplify
|
simplify
|
||||||
sets
|
sets
|
||||||
string-conversions
|
string-conversions
|
||||||
|
structure
|
||||||
subtract
|
subtract
|
||||||
value_compare
|
value_compare
|
||||||
value_intersect
|
value_intersect
|
||||||
|
|
95
tests/old/testsuite/caps/enumcaps.c
Normal file
95
tests/old/testsuite/caps/enumcaps.c
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
/* GStreamer test
|
||||||
|
* (c) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
TEST_YES,
|
||||||
|
TEST_NO
|
||||||
|
}
|
||||||
|
TestBool;
|
||||||
|
|
||||||
|
#define TEST_BOOL_TYPE (test_bool_get_type ())
|
||||||
|
GType
|
||||||
|
test_bool_get_type (void)
|
||||||
|
{
|
||||||
|
static GType etype = 0;
|
||||||
|
|
||||||
|
if (etype == 0) {
|
||||||
|
static const GEnumValue values[] = {
|
||||||
|
{TEST_YES, "TEST_YES", "yes"},
|
||||||
|
{TEST_NO, "TEST_NO", "no"},
|
||||||
|
{0, NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
etype = g_enum_register_static ("TestBool", values);
|
||||||
|
}
|
||||||
|
return etype;
|
||||||
|
}
|
||||||
|
|
||||||
|
gint
|
||||||
|
main (gint argc, gchar * argv[])
|
||||||
|
{
|
||||||
|
gchar *str;
|
||||||
|
GstCaps *caps, *res_caps;
|
||||||
|
GstStructure *strc;
|
||||||
|
GValue value = { 0 };
|
||||||
|
TestBool yes, no;
|
||||||
|
|
||||||
|
/* register multichannel type */
|
||||||
|
gst_init (&argc, &argv);
|
||||||
|
test_bool_get_type ();
|
||||||
|
|
||||||
|
/* test some caps */
|
||||||
|
caps = gst_caps_new_simple ("application/x-gst-test", NULL);
|
||||||
|
str = gst_caps_to_string (caps);
|
||||||
|
g_assert (str);
|
||||||
|
g_free (str);
|
||||||
|
|
||||||
|
/* set enums in list */
|
||||||
|
strc = gst_caps_get_structure (caps, 0);
|
||||||
|
g_value_init (&value, TEST_BOOL_TYPE);
|
||||||
|
g_value_set_enum (&value, TEST_YES);
|
||||||
|
gst_structure_set_value (strc, "yes", &value);
|
||||||
|
g_value_set_enum (&value, TEST_NO);
|
||||||
|
gst_structure_set_value (strc, "no", &value);
|
||||||
|
g_value_unset (&value);
|
||||||
|
|
||||||
|
/* test to-/from-string conversions for enums */
|
||||||
|
str = gst_caps_to_string (caps);
|
||||||
|
g_assert (str);
|
||||||
|
res_caps = gst_caps_from_string (str);
|
||||||
|
g_free (str);
|
||||||
|
|
||||||
|
/* see if all worked */
|
||||||
|
strc = gst_caps_get_structure (res_caps, 0);
|
||||||
|
yes = g_value_get_enum (gst_structure_get_value (strc, "yes"));
|
||||||
|
no = g_value_get_enum (gst_structure_get_value (strc, "no"));
|
||||||
|
g_assert (yes == TEST_YES && no == TEST_NO);
|
||||||
|
gst_caps_free (caps);
|
||||||
|
gst_caps_free (res_caps);
|
||||||
|
|
||||||
|
/* yes */
|
||||||
|
return 0;
|
||||||
|
}
|
2
tests/old/testsuite/schedulers/.gitignore
vendored
2
tests/old/testsuite/schedulers/.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
|
group_link
|
||||||
relink_sink
|
relink_sink
|
||||||
relink_src
|
relink_src
|
||||||
unlink_sink
|
unlink_sink
|
||||||
|
@ -12,3 +13,4 @@ useless_iteration
|
||||||
147713
|
147713
|
||||||
147819
|
147819
|
||||||
147894
|
147894
|
||||||
|
147894-2
|
||||||
|
|
3
testsuite/caps/.gitignore
vendored
3
testsuite/caps/.gitignore
vendored
|
@ -14,9 +14,11 @@ audioscale
|
||||||
caps
|
caps
|
||||||
compatibility
|
compatibility
|
||||||
deserialize
|
deserialize
|
||||||
|
enumcaps
|
||||||
eratosthenes
|
eratosthenes
|
||||||
filtercaps
|
filtercaps
|
||||||
fixed
|
fixed
|
||||||
|
fraction-convert
|
||||||
fraction-multiply-and-zero
|
fraction-multiply-and-zero
|
||||||
intersect2
|
intersect2
|
||||||
intersection
|
intersection
|
||||||
|
@ -27,6 +29,7 @@ union
|
||||||
simplify
|
simplify
|
||||||
sets
|
sets
|
||||||
string-conversions
|
string-conversions
|
||||||
|
structure
|
||||||
subtract
|
subtract
|
||||||
value_compare
|
value_compare
|
||||||
value_intersect
|
value_intersect
|
||||||
|
|
95
testsuite/caps/enumcaps.c
Normal file
95
testsuite/caps/enumcaps.c
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
/* GStreamer test
|
||||||
|
* (c) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
TEST_YES,
|
||||||
|
TEST_NO
|
||||||
|
}
|
||||||
|
TestBool;
|
||||||
|
|
||||||
|
#define TEST_BOOL_TYPE (test_bool_get_type ())
|
||||||
|
GType
|
||||||
|
test_bool_get_type (void)
|
||||||
|
{
|
||||||
|
static GType etype = 0;
|
||||||
|
|
||||||
|
if (etype == 0) {
|
||||||
|
static const GEnumValue values[] = {
|
||||||
|
{TEST_YES, "TEST_YES", "yes"},
|
||||||
|
{TEST_NO, "TEST_NO", "no"},
|
||||||
|
{0, NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
etype = g_enum_register_static ("TestBool", values);
|
||||||
|
}
|
||||||
|
return etype;
|
||||||
|
}
|
||||||
|
|
||||||
|
gint
|
||||||
|
main (gint argc, gchar * argv[])
|
||||||
|
{
|
||||||
|
gchar *str;
|
||||||
|
GstCaps *caps, *res_caps;
|
||||||
|
GstStructure *strc;
|
||||||
|
GValue value = { 0 };
|
||||||
|
TestBool yes, no;
|
||||||
|
|
||||||
|
/* register multichannel type */
|
||||||
|
gst_init (&argc, &argv);
|
||||||
|
test_bool_get_type ();
|
||||||
|
|
||||||
|
/* test some caps */
|
||||||
|
caps = gst_caps_new_simple ("application/x-gst-test", NULL);
|
||||||
|
str = gst_caps_to_string (caps);
|
||||||
|
g_assert (str);
|
||||||
|
g_free (str);
|
||||||
|
|
||||||
|
/* set enums in list */
|
||||||
|
strc = gst_caps_get_structure (caps, 0);
|
||||||
|
g_value_init (&value, TEST_BOOL_TYPE);
|
||||||
|
g_value_set_enum (&value, TEST_YES);
|
||||||
|
gst_structure_set_value (strc, "yes", &value);
|
||||||
|
g_value_set_enum (&value, TEST_NO);
|
||||||
|
gst_structure_set_value (strc, "no", &value);
|
||||||
|
g_value_unset (&value);
|
||||||
|
|
||||||
|
/* test to-/from-string conversions for enums */
|
||||||
|
str = gst_caps_to_string (caps);
|
||||||
|
g_assert (str);
|
||||||
|
res_caps = gst_caps_from_string (str);
|
||||||
|
g_free (str);
|
||||||
|
|
||||||
|
/* see if all worked */
|
||||||
|
strc = gst_caps_get_structure (res_caps, 0);
|
||||||
|
yes = g_value_get_enum (gst_structure_get_value (strc, "yes"));
|
||||||
|
no = g_value_get_enum (gst_structure_get_value (strc, "no"));
|
||||||
|
g_assert (yes == TEST_YES && no == TEST_NO);
|
||||||
|
gst_caps_free (caps);
|
||||||
|
gst_caps_free (res_caps);
|
||||||
|
|
||||||
|
/* yes */
|
||||||
|
return 0;
|
||||||
|
}
|
2
testsuite/schedulers/.gitignore
vendored
2
testsuite/schedulers/.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
|
group_link
|
||||||
relink_sink
|
relink_sink
|
||||||
relink_src
|
relink_src
|
||||||
unlink_sink
|
unlink_sink
|
||||||
|
@ -12,3 +13,4 @@ useless_iteration
|
||||||
147713
|
147713
|
||||||
147819
|
147819
|
||||||
147894
|
147894
|
||||||
|
147894-2
|
||||||
|
|
Loading…
Reference in a new issue