summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2012-12-23 15:26:59 +0000
committerTim-Philipp Müller <tim@centricular.net>2012-12-23 15:26:59 +0000
commit42f971c5eb7998faa742fb7479834c6445db730e (patch)
tree7ae6739e5b5320fe49e5a5e66cd0d459e3df175d /tests
parent76c0cca765799e2f16cd3c0af3fe23a421c285e7 (diff)
encoding-profile: add gst_encoding_profile_get_file_extension()
API: gst_encoding_profile_get_file_extension() https://bugzilla.gnome.org/show_bug.cgi?id=636753
Diffstat (limited to 'tests')
-rw-r--r--tests/check/libs/profile.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/check/libs/profile.c b/tests/check/libs/profile.c
index a4fca08d0..44e9f3929 100644
--- a/tests/check/libs/profile.c
+++ b/tests/check/libs/profile.c
@@ -605,6 +605,70 @@ test_teardown (void)
remove_profile_file ();
}
+GST_START_TEST (test_file_extension)
+{
+ GstEncodingContainerProfile *cprof;
+ GstCaps *ogg, *speex, *vorbis, *theora, *id3, *mp3;
+
+ /* 1 - ogg variants */
+ ogg = gst_caps_new_empty_simple ("application/ogg");
+ cprof = gst_encoding_container_profile_new ("myprofile", NULL, ogg, NULL);
+ gst_caps_unref (ogg);
+
+ fail_unless_equals_string (gst_encoding_profile_get_file_extension
+ (GST_ENCODING_PROFILE (cprof)), "ogg");
+
+ speex = gst_caps_new_empty_simple ("audio/x-speex");
+ gst_encoding_container_profile_add_profile (cprof,
+ (GstEncodingProfile *) gst_encoding_audio_profile_new (speex, NULL,
+ NULL, 1));
+ gst_caps_unref (speex);
+
+ fail_unless_equals_string (gst_encoding_profile_get_file_extension
+ (GST_ENCODING_PROFILE (cprof)), "spx");
+
+ vorbis = gst_caps_new_empty_simple ("audio/x-vorbis");
+ gst_encoding_container_profile_add_profile (cprof,
+ (GstEncodingProfile *) gst_encoding_audio_profile_new (vorbis, NULL,
+ NULL, 1));
+ gst_caps_unref (vorbis);
+
+ fail_unless_equals_string (gst_encoding_profile_get_file_extension
+ (GST_ENCODING_PROFILE (cprof)), "ogg");
+
+ theora = gst_caps_new_empty_simple ("video/x-theora");
+ gst_encoding_container_profile_add_profile (cprof,
+ (GstEncodingProfile *) gst_encoding_video_profile_new (theora, NULL,
+ NULL, 1));
+ gst_caps_unref (theora);
+
+ fail_unless_equals_string (gst_encoding_profile_get_file_extension
+ (GST_ENCODING_PROFILE (cprof)), "ogv");
+
+ gst_encoding_profile_unref (cprof);
+
+ /* 2 - tag container */
+ id3 = gst_caps_new_empty_simple ("application/x-id3");
+ cprof = gst_encoding_container_profile_new ("myprofile", NULL, id3, NULL);
+ gst_caps_unref (id3);
+
+ fail_unless (gst_encoding_profile_get_file_extension (GST_ENCODING_PROFILE
+ (cprof)) == NULL);
+
+ mp3 = gst_caps_new_simple ("audio/mpeg", "mpegversion", G_TYPE_INT, 1,
+ "layer", G_TYPE_INT, 3, NULL);
+ gst_encoding_container_profile_add_profile (cprof,
+ (GstEncodingProfile *) gst_encoding_audio_profile_new (mp3, NULL,
+ NULL, 1));
+ gst_caps_unref (mp3);
+
+ fail_unless_equals_string (gst_encoding_profile_get_file_extension
+ (GST_ENCODING_PROFILE (cprof)), "mp3");
+
+ gst_encoding_profile_unref (cprof);
+}
+
+GST_END_TEST;
static Suite *
profile_suite (void)
@@ -625,6 +689,7 @@ profile_suite (void)
tcase_add_test (tc_chain, test_profile_input_caps);
tcase_add_test (tc_chain, test_target_naming);
tcase_add_test (tc_chain, test_target_profile);
+ tcase_add_test (tc_chain, test_file_extension);
if (can_write) {
tcase_add_test (tc_chain, test_loading_profile);
tcase_add_test (tc_chain, test_saving_profile);