[svn-commits] file: branch group/media_formats r407191 - /team/group/media_formats/tests/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Feb 3 10:44:41 CST 2014


Author: file
Date: Mon Feb  3 10:44:35 2014
New Revision: 407191

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=407191
Log:
Add test for format_cap_append.

Modified:
    team/group/media_formats/tests/test_format_cap.c

Modified: team/group/media_formats/tests/test_format_cap.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/tests/test_format_cap.c?view=diff&rev=407191&r1=407190&r2=407191
==============================================================================
--- team/group/media_formats/tests/test_format_cap.c (original)
+++ team/group/media_formats/tests/test_format_cap.c Mon Feb  3 10:44:35 2014
@@ -292,6 +292,55 @@
 	return AST_TEST_PASS;
 }
 
+AST_TEST_DEFINE(format_cap_append)
+{
+	RAII_VAR(struct ast_format_cap *, dst_caps, NULL, ao2_cleanup);
+	RAII_VAR(struct ast_format_cap *, src_caps, NULL, ao2_cleanup);
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "format_cap_append";
+		info->category = "/main/format_cap/";
+		info->summary = "format capabilities append unit test";
+		info->description =
+			"Test that appending video formats from one capabilities structure to another succeeds";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	dst_caps = ast_format_cap_ng_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
+	if (!dst_caps) {
+		ast_test_status_update(test, "Could not allocate an empty format capabilities structure\n");
+		return AST_TEST_FAIL;
+	} else if (ast_format_cap_ng_add_all_by_type(dst_caps, AST_MEDIA_TYPE_AUDIO)) {
+		ast_test_status_update(test, "Failed to add all audio media formats to capabilities structure\n");
+		return AST_TEST_FAIL;
+	}
+
+	src_caps = ast_format_cap_ng_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
+	if (!src_caps) {
+		ast_test_status_update(test, "Could not allocate an empty format capabilities structure\n");
+		return AST_TEST_FAIL;
+	} else if (ast_format_cap_ng_add_all_by_type(src_caps, AST_MEDIA_TYPE_VIDEO)) {
+		ast_test_status_update(test, "Failed to add all video media formats to capabilities structure\n");
+		return AST_TEST_FAIL;
+	}
+
+	if (ast_format_cap_ng_append(dst_caps, src_caps)) {
+		ast_test_status_update(test, "Failed to append formats to capabilities structure\n");
+		return AST_TEST_FAIL;
+	} else if (!ast_format_cap_ng_has_type(dst_caps, AST_MEDIA_TYPE_AUDIO)) {
+		ast_test_status_update(test, "Successfully appended video formats to destination capabilities but it no longer contains audio formats\n");
+		return AST_TEST_FAIL;
+	} else if (!ast_format_cap_ng_has_type(dst_caps, AST_MEDIA_TYPE_VIDEO)) {
+		ast_test_status_update(test, "Successfully appended formats but video formats do not exist in destination capabilities\n");
+		return AST_TEST_FAIL;
+	}
+
+	return AST_TEST_PASS;
+}
+
 AST_TEST_DEFINE(format_cap_set_framing)
 {
 	RAII_VAR(struct ast_format_cap *, caps, NULL, ao2_cleanup);
@@ -574,6 +623,7 @@
 	AST_TEST_UNREGISTER(format_cap_add_multiple);
 	AST_TEST_UNREGISTER(format_cap_add_all_unknown);
 	AST_TEST_UNREGISTER(format_cap_add_all_audio);
+	AST_TEST_UNREGISTER(format_cap_append);
 	AST_TEST_UNREGISTER(format_cap_set_framing);
 	AST_TEST_UNREGISTER(format_cap_remove_single);
 	AST_TEST_UNREGISTER(format_cap_remove_multiple);
@@ -589,6 +639,7 @@
 	AST_TEST_REGISTER(format_cap_add_multiple);
 	AST_TEST_REGISTER(format_cap_add_all_unknown);
 	AST_TEST_REGISTER(format_cap_add_all_audio);
+	AST_TEST_REGISTER(format_cap_append);
 	AST_TEST_REGISTER(format_cap_set_framing);
 	AST_TEST_REGISTER(format_cap_remove_single);
 	AST_TEST_REGISTER(format_cap_remove_multiple);




More information about the svn-commits mailing list