update tizen source
[framework/messaging/msg-service.git] / TC / msgTC / MapiMessage / utc_msg_mms_get_media.c
1 /*
2 *
3 * Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved.
4 *
5 * This file is part of msg-service.
6 *
7 * Contact: Jaeyun Jeong <jyjeong@samsung.com>
8 *          Sangkoo Kim <sangkoo.kim@samsung.com>
9 *          Seunghwan Lee <sh.cat.lee@samsung.com>
10 *          SoonMin Jung <sm0415.jung@samsung.com>
11 *          Jae-Young Lee <jy4710.lee@samsung.com>
12 *          KeeBum Kim <keebum.kim@samsung.com>
13 *
14 * PROPRIETARY/CONFIDENTIAL
15 *
16 * This software is the confidential and proprietary information of
17 * SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
18 * disclose such Confidential Information and shall use it only in
19 * accordance with the terms of the license agreement you entered
20 * into with SAMSUNG ELECTRONICS.
21 *
22 * SAMSUNG make no representations or warranties about the suitability
23 * of the software, either express or implied, including but not limited
24 * to the implied warranties of merchantability, fitness for a particular
25 * purpose, or non-infringement. SAMSUNG shall not be liable for any
26 * damages suffered by licensee as a result of using, modifying or
27 * distributing this software or its derivatives.
28 *
29 */
30
31 #include "utc_msg_mms_get_media.h"
32
33 static MSG_HANDLE_T msgHandle = NULL;
34 msg_message_t msgInfo;
35 MMS_MESSAGE_DATA_S*      mms_data;
36 MMS_PAGE_S*     page[2];
37 void startup(void)
38 {
39         MSG_ERROR_T err = MSG_SUCCESS;
40         MMS_MEDIA_S*    media[5];
41
42         err = msg_open_msg_handle(&msgHandle);
43         if (err != MSG_SUCCESS)
44         {
45                 tet_result(TET_FAIL);
46                 return;
47         }
48
49         msgInfo = msg_new_message();
50         mms_data = msg_mms_create_message();
51
52         msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff);
53         msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff);
54         msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff);
55
56         //------------>  1st Slide Composing
57         page[0] = msg_mms_add_page(mms_data, 5440);
58
59         media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg");
60         media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr");
61         media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt");
62         media[2]->sMedia.sText.nColor = 0x000000;
63         media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL;
64         media[2]->sMedia.sText.bBold = true;
65
66         //------------>  2nd Slide Composing
67         page[1] = msg_mms_add_page(mms_data, 4544);
68
69         media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt");
70         media[3]->sMedia.sText.nColor = 0x000000;
71         media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL;
72         media[3]->sMedia.sText.bItalic = true;
73         media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp");
74         strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1);
75
76         msg_set_message_type(msgInfo, MSG_TYPE_MMS);
77
78 }
79 void cleanup(void)
80 {
81         msg_mms_destroy_message(mms_data);
82         msg_close_msg_handle(&msgHandle);
83 }
84
85 void utc_msg_mms_get_media_001()
86 {
87         MSG_ERROR_T err = MSG_SUCCESS;
88         MMS_MEDIA_S* tmpMedia = NULL;
89
90         tmpMedia = msg_mms_get_media(page[0], 0);
91         if (tmpMedia == NULL)
92         {
93                 tet_result(TET_FAIL);
94                 return;
95         }
96
97         tet_result(TET_PASS);
98 }
99
100 void utc_msg_mms_get_media_002()
101 {
102         MSG_ERROR_T err = MSG_SUCCESS;
103         MMS_MEDIA_S* tmpMedia = NULL;
104
105         tmpMedia = msg_mms_get_media(page[0], -1);
106         if (tmpMedia == NULL)
107         {
108                 tet_result(TET_PASS);
109                 return;
110         }
111
112         tet_result(TET_FAIL);
113 }