tests: video: Test video format enum stability

It is really easy to break the API and insert a new video format in the
middle of the enum instead of at the end. This minimal test should catch
the most obvious errors. Ideally, this test should be updated after new
format have been added, so that it won't allow further modification to
the enumeration API.
This commit is contained in:
Nicolas Dufresne 2018-11-16 23:51:44 -05:00 committed by Tim-Philipp Müller
parent 79365f9b41
commit fcaf938e8c

View file

@ -2942,6 +2942,16 @@ GST_START_TEST (test_overlay_composition_over_transparency)
GST_END_TEST; GST_END_TEST;
GST_START_TEST (test_video_format_enum_stability)
{
/* When adding new formats, adding a format in the middle of the enum will
* break the API. This check picks the last known format and checks that
* it's value isn't changing. This test should ideall be updated when a new
* format is added, though will stay valid. */
fail_unless_equals_int (GST_VIDEO_FORMAT_Y210, 82);
}
GST_END_TEST;
static Suite * static Suite *
video_suite (void) video_suite (void)
@ -2982,6 +2992,7 @@ video_suite (void)
tcase_add_test (tc_chain, test_overlay_blend); tcase_add_test (tc_chain, test_overlay_blend);
tcase_add_test (tc_chain, test_video_center_rect); tcase_add_test (tc_chain, test_video_center_rect);
tcase_add_test (tc_chain, test_overlay_composition_over_transparency); tcase_add_test (tc_chain, test_overlay_composition_over_transparency);
tcase_add_test (tc_chain, test_video_format_enum_stability);
return s; return s;
} }