update tizen source
[framework/messaging/msg-service.git] / TC / msgTC / MapiMessage / utc_msg_mms_get_attachment.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_attachment.h"
32
33 static MSG_HANDLE_T msgHandle = NULL;
34 msg_message_t msgInfo;
35 MMS_MESSAGE_DATA_S*      mms_data;
36
37 void startup(void)
38 {
39         MSG_ERROR_T err = MSG_SUCCESS;
40         MMS_PAGE_S*     page[2];
41         MMS_MEDIA_S*    media[5];
42
43         err = msg_open_msg_handle(&msgHandle);
44         if (err != MSG_SUCCESS)
45         {
46                 tet_result(TET_FAIL);
47                 return;
48         }
49
50         msgInfo = msg_new_message();
51         mms_data = msg_mms_create_message();
52
53         msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff);
54         msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff);
55         msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff);
56
57         //------------>  1st Slide Composing
58         page[0] = msg_mms_add_page(mms_data, 5440);
59
60         media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg");
61         media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr");
62         media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt");
63         media[2]->sMedia.sText.nColor = 0x000000;
64         media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL;
65         media[2]->sMedia.sText.bBold = true;
66
67         //------------>  2nd Slide Composing
68         page[1] = msg_mms_add_page(mms_data, 4544);
69
70         media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt");
71         media[3]->sMedia.sText.nColor = 0x000000;
72         media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL;
73         media[3]->sMedia.sText.bItalic = true;
74         media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp");
75         strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1);
76
77         msg_mms_add_attachment(mms_data, "/opt/etc/msg-service/Temp1_0.txt");
78
79 }
80 void cleanup(void)
81 {
82         msg_mms_destroy_message(mms_data);
83         msg_close_msg_handle(&msgHandle);
84 }
85
86 void utc_msg_mms_get_attachment_001()
87 {
88         MSG_ERROR_T err = MSG_SUCCESS;
89
90         MMS_ATTACH_S*   pAttach = msg_mms_get_attachment(mms_data, 0);
91         if (pAttach == NULL)
92         {
93                 tet_result(TET_FAIL);
94                 return;
95         }
96
97         tet_result(TET_PASS);
98 }
99
100 void utc_msg_mms_get_attachment_002()
101 {
102         MSG_ERROR_T err = MSG_SUCCESS;
103
104         MMS_ATTACH_S*   pAttach = msg_mms_get_attachment(mms_data, -1);
105         if (pAttach == NULL)
106         {
107                 tet_result(TET_PASS);
108                 return;
109         }
110
111         tet_result(TET_FAIL);
112 }