Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GStreamer
gstreamer
Commits
a129b7df
Commit
a129b7df
authored
Jan 09, 2019
by
Jan Alexander Steffens
Committed by
Tim-Philipp Müller
Jan 09, 2019
Browse files
tests: Add more int range fixation tests
parent
c5eddea7
Pipeline
#14495
passed with stages
in 35 minutes and 3 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
tests/check/gst/gststructure.c
View file @
a129b7df
...
...
@@ -438,17 +438,66 @@ GST_END_TEST;
GST_START_TEST
(
test_fixate
)
{
GstStructure
*
s
;
gint
i
;
s
=
gst_structure_new
(
"name"
,
"int"
,
G_TYPE_INT
,
5
,
"intrange"
,
GST_TYPE_INT_RANGE
,
5
,
10
,
"intrange2"
,
GST_TYPE_INT_RANGE
,
5
,
10
,
NULL
);
"intrange"
,
GST_TYPE_INT_RANGE
,
10
,
20
,
"intrange2"
,
GST_TYPE_INT_RANGE
,
10
,
20
,
"intrange3"
,
GST_TYPE_INT_RANGE
,
10
,
20
,
NULL
);
/* basic test */
fail_if
(
gst_structure_fixate_field_nearest_int
(
s
,
"int"
,
5
));
fail_unless
(
gst_structure_fixate_field_nearest_int
(
s
,
"intrange"
,
5
));
fail_if
(
gst_structure_fixate_field_nearest_int
(
s
,
"intrange"
,
5
));
fail_unless
(
gst_structure_fixate_field_nearest_int
(
s
,
"intrange2"
,
15
));
fail_if
(
gst_structure_fixate_field_nearest_int
(
s
,
"intrange2"
,
15
));
fail_unless
(
gst_structure_fixate_field_nearest_int
(
s
,
"intrange"
,
15
));
fail_if
(
gst_structure_fixate_field_nearest_int
(
s
,
"intrange"
,
15
));
fail_unless
(
gst_structure_get_int
(
s
,
"intrange"
,
&
i
));
fail_unless_equals_int
(
i
,
15
);
/* test range min */
fail_unless
(
gst_structure_fixate_field_nearest_int
(
s
,
"intrange2"
,
5
));
fail_unless
(
gst_structure_get_int
(
s
,
"intrange2"
,
&
i
));
fail_unless_equals_int
(
i
,
10
);
/* test range max */
fail_unless
(
gst_structure_fixate_field_nearest_int
(
s
,
"intrange3"
,
25
));
fail_unless
(
gst_structure_get_int
(
s
,
"intrange3"
,
&
i
));
fail_unless_equals_int
(
i
,
20
);
gst_structure_free
(
s
);
}
GST_END_TEST
;
GST_START_TEST
(
test_fixate_stepped
)
{
GstStructure
*
s
;
GValue
v
=
G_VALUE_INIT
;
gint
i
;
s
=
gst_structure_new_empty
(
"name"
);
g_value_init
(
&
v
,
GST_TYPE_INT_RANGE
);
gst_value_set_int_range_step
(
&
v
,
10
,
20
,
5
);
gst_structure_set_value
(
s
,
"intrange1"
,
&
v
);
gst_structure_set_value
(
s
,
"intrange2"
,
&
v
);
gst_structure_set_value
(
s
,
"intrange3"
,
&
v
);
g_value_unset
(
&
v
);
/* exact */
fail_unless
(
gst_structure_fixate_field_nearest_int
(
s
,
"intrange1"
,
15
));
fail_unless
(
gst_structure_get_int
(
s
,
"intrange1"
,
&
i
));
fail_unless_equals_int
(
i
,
15
);
/* round down */
fail_unless
(
gst_structure_fixate_field_nearest_int
(
s
,
"intrange2"
,
12
));
fail_unless
(
gst_structure_get_int
(
s
,
"intrange2"
,
&
i
));
fail_unless_equals_int
(
i
,
10
);
/* round up */
fail_unless
(
gst_structure_fixate_field_nearest_int
(
s
,
"intrange3"
,
13
));
fail_unless
(
gst_structure_get_int
(
s
,
"intrange3"
,
&
i
));
fail_unless_equals_int
(
i
,
15
);
gst_structure_free
(
s
);
}
...
...
@@ -905,6 +954,7 @@ gst_structure_suite (void)
tcase_add_test
(
tc_chain
,
test_complete_structure
);
tcase_add_test
(
tc_chain
,
test_structure_new
);
tcase_add_test
(
tc_chain
,
test_fixate
);
tcase_add_test
(
tc_chain
,
test_fixate_stepped
);
tcase_add_test
(
tc_chain
,
test_fixate_frac_list
);
tcase_add_test
(
tc_chain
,
test_is_subset_equal_array_list
);
tcase_add_test
(
tc_chain
,
test_is_subset_different_name
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment