update tizen source
[framework/messaging/msg-service.git] / TC / msgTC / MapiTransport / utc_msg_mms_send_message.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_send_message.h"
32
33 static MSG_HANDLE_T msgHandle = NULL;
34 msg_message_t msgInfo;
35 MSG_SENDINGOPT_S sendOpt;
36
37 void sentStatusCB(MSG_HANDLE_T Handle, MSG_SENT_STATUS_S *pStatus, void *pUserParam)
38 {
39         return;
40 }
41
42 void startup(void)
43 {
44         MSG_ERROR_T err = MSG_SUCCESS;
45         MMS_MESSAGE_DATA_S*      mms_data;
46         MMS_PAGE_S*     page[2];
47         MMS_MEDIA_S*    media[5];
48
49         err = msg_open_msg_handle(&msgHandle);
50         if (err != MSG_SUCCESS)
51         {
52                 tet_result(TET_FAIL);
53                 return;
54         }
55
56         msg_reg_sent_status_callback(msgHandle, &sentStatusCB, (void*)"sent status callback");
57
58         msgInfo = msg_new_message();
59         mms_data = msg_mms_create_message();
60
61         msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff);
62         msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff);
63         msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff);
64
65         //------------>  1st Slide Composing
66         page[0] = msg_mms_add_page(mms_data, 5440);
67
68         media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg");
69         media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr");
70         media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt");
71         media[2]->sMedia.sText.nColor = 0x000000;
72         media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL;
73         media[2]->sMedia.sText.bBold = true;
74
75         //------------>  2nd Slide Composing
76         page[1] = msg_mms_add_page(mms_data, 4544);
77
78         media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt");
79         media[3]->sMedia.sText.nColor = 0x000000;
80         media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL;
81         media[3]->sMedia.sText.bItalic = true;
82         media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp");
83         strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1);
84
85         msg_set_message_type(msgInfo, MSG_TYPE_MMS);
86
87         msg_mms_set_message_body(msgInfo, mms_data);
88
89         msg_mms_destroy_message(mms_data);
90
91         msg_add_address(msgInfo, "01000000000", MSG_RECIPIENTS_TYPE_TO);
92
93         memset(&sendOpt, 0x00, sizeof(sendOpt));
94
95         sendOpt.bSetting = false;
96 }
97 void cleanup(void)
98 {
99         msg_close_msg_handle(&msgHandle);
100 }
101
102 void utc_msg_mms_send_message_001()
103 {
104         int err = MSG_SUCCESS;
105         MSG_REQUEST_S req;
106
107         memset(&req, 0x00, sizeof(req));
108
109         req.msg = msgInfo;
110         req.sendOpt = sendOpt;
111
112         err = msg_mms_send_message(msgHandle, &req);
113         if (err != MSG_SUCCESS)
114         {
115                 tet_result(TET_FAIL);
116                 return;
117         }
118
119         tet_result(TET_PASS);
120 }
121
122 void utc_msg_mms_send_message_002()
123 {
124         int err = MSG_SUCCESS;
125         MSG_REQUEST_S req;
126
127         memset(&req, 0x00, sizeof(req));
128
129         req.msg = msgInfo;
130         req.sendOpt = sendOpt;
131
132         err = msg_mms_send_message(NULL, &req);
133         if (err != MSG_SUCCESS)
134         {
135                 tet_result(TET_PASS);
136                 return;
137         }
138
139         tet_result(TET_FAIL);
140 }