Tizen 2.0 beta
[framework/api/media-content.git] / TC / testcase / utc_media_audio.c
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18 #include <tet_api.h>
19 #include <stdlib.h>
20 #include <media_content.h>
21
22 static void startup(void);
23 static void cleanup(void);
24
25 void (*tet_startup)(void) = startup;
26 void (*tet_cleanup)(void) = cleanup;
27
28 static void utc_audio_meta_destroy_n(void);
29 static void utc_audio_meta_destroy_p(void);
30 static void utc_audio_meta_clone_n(void);
31 static void utc_audio_meta_clone_p(void);
32 static void utc_audio_meta_get_media_id_n(void);
33 static void utc_audio_meta_get_media_id_p(void);
34 static void utc_audio_meta_get_title_n(void);
35 static void utc_audio_meta_get_title_p(void);
36 static void utc_audio_meta_get_album_n(void);
37 static void utc_audio_meta_get_album_p(void);
38 static void utc_audio_meta_get_artist_n(void);
39 static void utc_audio_meta_get_artist_p(void);
40 static void utc_audio_meta_get_genre_n(void);
41 static void utc_audio_meta_get_genre_p(void);
42 static void utc_audio_meta_get_composer_n(void);
43 static void utc_audio_meta_get_composer_p(void);
44 static void utc_audio_meta_get_year_n(void);
45 static void utc_audio_meta_get_year_p(void);
46 static void utc_audio_meta_get_recorded_date_n(void);
47 static void utc_audio_meta_get_recorded_date_p(void);
48 static void utc_audio_meta_get_copyright_n(void);
49 static void utc_audio_meta_get_copyright_p(void);
50 static void utc_audio_meta_get_track_num_n(void);
51 static void utc_audio_meta_get_track_num_p(void);
52 static void utc_audio_meta_get_bit_rate_n(void);
53 static void utc_audio_meta_get_bit_rate_p(void);
54 static void utc_audio_meta_get_sample_rate_n(void);
55 static void utc_audio_meta_get_sample_rate_p(void);
56 static void utc_audio_meta_get_channel_n(void);
57 static void utc_audio_meta_get_channel_p(void);
58 static void utc_audio_meta_get_duration_n(void);
59 static void utc_audio_meta_get_duration_p(void);
60 static void utc_audio_meta_get_played_count_n(void);
61 static void utc_audio_meta_get_played_count_p(void);
62 static void utc_audio_meta_get_played_time_n(void);
63 static void utc_audio_meta_get_played_time_p(void);
64 static void utc_audio_meta_get_played_position_n(void);
65 static void utc_audio_meta_get_played_position_p(void);
66 static void utc_audio_meta_update_to_db_n(void);
67 static void utc_audio_meta_update_to_db_p(void);
68 static void utc_audio_meta_set_played_count_n(void);
69 static void utc_audio_meta_set_played_count_p(void);
70 static void utc_audio_meta_set_played_time_n(void);
71 static void utc_audio_meta_set_played_time_p(void);
72 static void utc_audio_meta_set_played_position_n(void);
73 static void utc_audio_meta_set_played_position_p(void);
74
75
76 struct tet_testlist tet_testlist[] = {
77         { utc_audio_meta_destroy_n, 5 },
78         { utc_audio_meta_destroy_p, 5 },
79         { utc_audio_meta_clone_n, 4 },
80         { utc_audio_meta_clone_p, 4 },
81         { utc_audio_meta_get_media_id_n, 1 },
82         { utc_audio_meta_get_media_id_p, 1 },
83         { utc_audio_meta_get_title_n, 1 },
84         { utc_audio_meta_get_title_p, 1 },
85         { utc_audio_meta_get_album_n, 1 },
86         { utc_audio_meta_get_album_p, 1 },
87         { utc_audio_meta_get_artist_n, 1 },
88         { utc_audio_meta_get_artist_p, 1 },
89         { utc_audio_meta_get_genre_n, 1 },
90         { utc_audio_meta_get_genre_p, 1 },
91         { utc_audio_meta_get_composer_n, 1 },
92         { utc_audio_meta_get_composer_p, 1 },
93         { utc_audio_meta_get_year_n, 1 },
94         { utc_audio_meta_get_year_p, 1 },
95         { utc_audio_meta_get_recorded_date_n, 1 },
96         { utc_audio_meta_get_recorded_date_p, 1 },
97         { utc_audio_meta_get_copyright_n, 1 },
98         { utc_audio_meta_get_copyright_p, 1 },
99         { utc_audio_meta_get_track_num_n, 1 },
100         { utc_audio_meta_get_track_num_p, 1 },
101         { utc_audio_meta_get_bit_rate_n, 1 },
102         { utc_audio_meta_get_bit_rate_p, 1 },
103         { utc_audio_meta_get_sample_rate_n, 1 },
104         { utc_audio_meta_get_sample_rate_p, 1 },
105         { utc_audio_meta_get_channel_n, 1 },
106         { utc_audio_meta_get_channel_p, 1 },
107         { utc_audio_meta_get_duration_n, 1 },
108         { utc_audio_meta_get_duration_p, 1 },
109         { utc_audio_meta_get_played_count_n, 1 },
110         { utc_audio_meta_get_played_count_p, 1 },
111         { utc_audio_meta_get_played_time_n, 1 },
112         { utc_audio_meta_get_played_time_p, 1 },
113         { utc_audio_meta_get_played_position_n, 1 },
114         { utc_audio_meta_get_played_position_p, 1 },
115         { utc_audio_meta_set_played_count_n, 2 },
116         { utc_audio_meta_set_played_count_p, 2 },
117         { utc_audio_meta_set_played_time_n, 2 },
118         { utc_audio_meta_set_played_time_p, 2 },
119         { utc_audio_meta_set_played_position_n, 2 },
120         { utc_audio_meta_set_played_position_p, 2 },
121         { utc_audio_meta_update_to_db_n, 3 },
122         { utc_audio_meta_update_to_db_p, 3 },
123         { NULL, 0 },
124 };
125
126 static audio_meta_h g_audio;
127 static audio_meta_h g_audio_dst;
128 static char *g_media_id = NULL;
129
130 bool media_item_cb(media_info_h media, void *user_data)
131 {
132         int ret = MEDIA_CONTENT_ERROR_NONE;
133
134         ret = media_info_get_media_id(media, &g_media_id);
135         if((ret != MEDIA_CONTENT_ERROR_NONE) || (g_media_id == NULL))
136         {
137                 tet_printf("\n get media_id failed");
138                 return false;
139         }
140
141         ret = media_info_get_audio(media, &g_audio);
142         if((ret != MEDIA_CONTENT_ERROR_NONE) || (g_audio == NULL))
143         {
144                 tet_printf("\n get audio_meta failed");
145                 return false;
146         }
147
148         return true;
149 }
150
151 static void startup(void)
152 {
153         /* start of TC */
154         tet_printf("\n TC start");
155         filter_h filter;
156         g_audio = NULL;
157         g_audio_dst = NULL;
158
159         int ret = media_content_connect();
160         if(ret != MEDIA_CONTENT_ERROR_NONE)
161         {
162                 tet_printf("\n database connection is failed");
163                 return;
164         }
165         else
166         {
167                 tet_printf("\n database connection is success");
168         }
169
170         char *condition = "MEDIA_TYPE=3";       //Music
171
172         media_filter_create(&filter);
173         media_filter_set_condition(filter, condition, MEDIA_CONTENT_COLLATE_DEFAULT);
174         media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_TITLE, MEDIA_CONTENT_COLLATE_DEFAULT);
175         if(filter == NULL)
176         {
177                 tet_printf("\n filter create failed");
178                 return;
179         }
180
181         ret = media_info_foreach_media_from_db(filter, media_item_cb, NULL);
182         if(ret != MEDIA_CONTENT_ERROR_NONE)
183         {
184                 tet_printf("\n get media_info failed");
185                 return;
186         }
187
188         media_filter_destroy(filter);
189
190         tet_printf("\n TC start END");
191 }
192
193 static void cleanup(void)
194 {
195         /* end of TC */
196         tet_printf("\n TC end");
197
198         if(g_media_id != NULL)
199                 free(g_media_id);
200
201         if(g_audio != NULL)
202                 audio_meta_destroy(g_audio);
203
204         int ret = media_content_disconnect();
205         
206         if(ret != MEDIA_CONTENT_ERROR_NONE)
207                 tet_printf("\n database disconnection is failed");
208         else
209                 tet_printf("\n database disconnection is success");
210 }
211
212 /**
213  * @brief Negative test case of content_imageinfo_destroy()
214  */
215 static void utc_audio_meta_destroy_n(void)
216 {
217         int ret = MEDIA_CONTENT_ERROR_NONE;
218
219         ret = audio_meta_destroy(NULL);
220
221         dts_check_eq("utc_audio_meta_destroy_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
222 }
223
224 /**
225  * @brief Positive test case of content_imageinfo_destroy()
226  */
227 static void utc_audio_meta_destroy_p(void)
228 {
229         int ret = MEDIA_CONTENT_ERROR_NONE;
230
231         ret = audio_meta_destroy(g_audio_dst);
232
233         dts_check_eq("utc_audio_meta_destroy_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to destroy audio_meta object");
234 }
235
236 /**
237  * @brief Negative test case of imageinfo_clone()
238  */
239 static void utc_audio_meta_clone_n(void)
240 {
241         int ret = MEDIA_CONTENT_ERROR_NONE;
242
243         ret = audio_meta_clone(&g_audio_dst, NULL);
244         dts_check_eq("utc_audio_meta_clone_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
245 }
246
247 /**
248  * @brief Positive test case of imageinfo_clone()
249  */
250 static void utc_audio_meta_clone_p(void)
251 {
252         int ret = MEDIA_CONTENT_ERROR_NONE;
253
254         ret = audio_meta_clone(&g_audio_dst, g_audio);
255
256         dts_check_eq("utc_audio_meta_clone_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to clone audio_meta object");
257 }
258
259 /**
260  * @brief Negative test case of audio_meta_get_media_id()
261  */
262 static void utc_audio_meta_get_media_id_n(void)
263 {
264         int ret = MEDIA_CONTENT_ERROR_NONE;
265         char *media_id = NULL;
266
267         ret = audio_meta_get_media_id(NULL, &media_id);
268
269         dts_check_eq("utc_audio_meta_get_media_id_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
270 }
271
272 /**
273  * @brief Positive test case of audio_meta_get_media_id()
274  */
275 static void utc_audio_meta_get_media_id_p(void)
276 {
277         int ret = MEDIA_CONTENT_ERROR_NONE;
278         char *media_id = NULL;
279
280         ret = audio_meta_get_media_id(g_audio, &media_id);
281
282         dts_check_eq("utc_audio_meta_get_media_id_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to get album");
283 }
284
285 /**
286  * @brief Negative test case of imageinfo_get_latitude()
287  */
288 static void utc_audio_meta_get_title_n(void)
289 {
290         int ret = MEDIA_CONTENT_ERROR_NONE;
291         char *title = NULL;
292
293         ret = audio_meta_get_title(NULL, &title);
294
295         dts_check_eq("utc_audio_meta_get_album_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
296 }
297
298 /**
299  * @brief Positive test case of imageinfo_get_latitude()
300  */
301 static void utc_audio_meta_get_title_p(void)
302 {
303         int ret = MEDIA_CONTENT_ERROR_NONE;
304         char *title = NULL;
305
306         ret = audio_meta_get_title(g_audio, &title);
307
308         if(title)
309                 free(title);
310
311         dts_check_eq("utc_audio_meta_get_album_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to get album");
312 }
313
314 /**
315  * @brief Negative test case of imageinfo_get_latitude()
316  */
317 static void utc_audio_meta_get_album_n(void)
318 {
319         int ret = MEDIA_CONTENT_ERROR_NONE;
320         char *album = NULL;
321
322         ret = audio_meta_get_album(NULL, &album);
323
324         dts_check_eq("utc_audio_meta_get_album_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
325 }
326
327 /**
328  * @brief Positive test case of imageinfo_get_latitude()
329  */
330 static void utc_audio_meta_get_album_p(void)
331 {
332         int ret = MEDIA_CONTENT_ERROR_NONE;
333         char *album = NULL;
334
335         ret = audio_meta_get_album(g_audio, &album);
336
337         if(album)
338                 free(album);
339
340         dts_check_eq("utc_audio_meta_get_album_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to get album");
341 }
342
343 /**
344  * @brief Negative test case of imageinfo_get_description()
345  */
346 static void utc_audio_meta_get_artist_n(void)
347 {
348         int ret = MEDIA_CONTENT_ERROR_NONE;
349         char *artist = NULL;
350
351         ret = audio_meta_get_artist(NULL, &artist);
352
353         dts_check_eq("utc_audio_meta_get_artist_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
354 }
355
356 /**
357  * @brief Positive test case of imageinfo_get_description()
358  */
359 static void utc_audio_meta_get_artist_p(void)
360 {
361         int ret = MEDIA_CONTENT_ERROR_NONE;
362         char *artist = NULL;
363
364         ret = audio_meta_get_artist(g_audio, &artist);
365
366         if(artist)
367                 free(artist);
368
369         dts_check_eq("utc_audio_meta_get_artist_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to get artist");
370 }
371
372 /**
373  * @brief Negative test case of audio_meta_get_genre()
374  */
375 static void utc_audio_meta_get_genre_n(void)
376 {
377         int ret = MEDIA_CONTENT_ERROR_NONE;
378         char *genre = NULL;
379
380         ret = audio_meta_get_genre(NULL, &genre);
381         dts_check_eq("utc_audio_meta_get_genre_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
382 }
383
384 /**
385  * @brief Positive test case of audio_meta_get_genre()
386  */
387 static void utc_audio_meta_get_genre_p(void)
388 {
389         int ret = MEDIA_CONTENT_ERROR_NONE;
390         char *genre = NULL;
391
392         ret = audio_meta_get_genre(g_audio, &genre);
393
394         if(genre)
395                 free(genre);
396
397         dts_check_eq("utc_audio_meta_get_genre_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to get genre");
398 }
399
400 /**
401  * @brief Negative test case of audio_meta_get_composer()
402  */
403 static void utc_audio_meta_get_composer_n(void)
404 {
405         int ret = MEDIA_CONTENT_ERROR_NONE;
406         char *composer = NULL;
407
408         ret = audio_meta_get_composer(NULL, &composer);
409         dts_check_eq("utc_audio_meta_get_composer_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
410 }
411
412
413 /**
414  * @brief Positive test case of audio_meta_get_composer()
415  */
416 static void utc_audio_meta_get_composer_p(void)
417 {
418         int ret = MEDIA_CONTENT_ERROR_NONE;
419         char *composer = NULL;
420
421         ret = audio_meta_get_composer(g_audio, &composer);
422
423         if(composer)
424                 free(composer);
425
426         dts_check_eq("utc_audio_meta_get_composer_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to get the composer");
427 }
428
429 /**
430  * @brief Negative test case of sim_get_imageinfo_get_height()
431  */
432 static void utc_audio_meta_get_year_n(void)
433 {
434         int ret = MEDIA_CONTENT_ERROR_NONE;
435         char *year = NULL;
436
437         ret = audio_meta_get_year(NULL, &year);
438
439         dts_check_eq("utc_audio_meta_get_year_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
440 }
441
442 /**
443  * @brief Positive test case of sim_get_imageinfo_get_height()
444  */
445 static void utc_audio_meta_get_year_p(void)
446 {
447         int ret = MEDIA_CONTENT_ERROR_NONE;
448         char *year = NULL;
449
450         ret = audio_meta_get_year(g_audio, &year);
451
452         if(year)
453                 free(year);
454
455         dts_check_eq("utc_audio_meta_get_year_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to get year");
456 }
457
458 /**
459  * @brief Negative test case of audio_meta_get_recorded_date()
460  */
461 static void utc_audio_meta_get_recorded_date_n(void)
462 {
463         int ret = MEDIA_CONTENT_ERROR_NONE;
464         char *recorded_date = NULL;
465
466         ret = audio_meta_get_recorded_date(NULL, &recorded_date);
467
468         dts_check_eq("utc_audio_meta_get_recorded_date_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Failed to get recorded_date");
469 }
470
471 /**
472  * @brief Positive test case of audio_meta_get_recorded_date()
473  */
474 static void utc_audio_meta_get_recorded_date_p(void)
475 {
476         int ret = MEDIA_CONTENT_ERROR_NONE;
477         char *recorded_date = NULL;
478
479         ret = audio_meta_get_year(g_audio, &recorded_date);
480
481         if(recorded_date)
482                 free(recorded_date);
483
484         dts_check_eq("utc_audio_meta_get_recorded_date_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to get recorded_date");
485 }
486
487 /**
488  * @brief Negative test case of audio_meta_get_copyright()
489  */
490 static void utc_audio_meta_get_copyright_n(void)
491 {
492         int ret = MEDIA_CONTENT_ERROR_NONE;
493         char *copyright = NULL;
494
495         ret = audio_meta_get_copyright(NULL, &copyright);
496
497         dts_check_eq("utc_audio_meta_get_copyright_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
498 }
499
500 /**
501  * @brief Positive test case of audio_meta_get_copyright()
502  */
503 static void utc_audio_meta_get_copyright_p(void)
504 {
505         int ret = MEDIA_CONTENT_ERROR_NONE;
506         char *copyright = NULL;
507
508         ret = audio_meta_get_copyright(g_audio, &copyright);
509
510         if(copyright)
511                 free(copyright);
512
513         dts_check_eq("utc_audio_meta_get_copyright_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to get copyright");
514 }
515
516 static void utc_audio_meta_get_track_num_n(void)
517 {
518         int ret = MEDIA_CONTENT_ERROR_NONE;
519         char *tracknum = NULL;
520
521         ret = audio_meta_get_track_num(NULL, &tracknum);
522
523         dts_check_eq("utc_audio_meta_get_track_num_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
524 }
525
526 static void utc_audio_meta_get_track_num_p(void)
527 {
528         int ret = MEDIA_CONTENT_ERROR_NONE;
529         char *tracknum = NULL;
530
531         ret = audio_meta_get_track_num(g_audio, &tracknum);
532
533         if(tracknum)
534                 free(tracknum);
535
536         dts_check_eq("utc_audio_meta_get_track_num_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to get track num");
537 }
538
539 static void utc_audio_meta_get_bit_rate_n(void)
540 {
541         int ret = MEDIA_CONTENT_ERROR_NONE;
542         int bit_rate = 0;
543
544         ret = audio_meta_get_bit_rate(NULL, &bit_rate);
545
546         dts_check_eq("utc_audio_meta_get_bit_rate_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
547 }
548
549 static void utc_audio_meta_get_bit_rate_p(void)
550 {
551         int ret = MEDIA_CONTENT_ERROR_NONE;
552         int bit_rate = 0;
553
554         ret = audio_meta_get_bit_rate(g_audio, &bit_rate);
555
556         dts_check_eq("utc_audio_meta_get_bit_rate_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to get the bit_rate");
557 }
558
559 static void utc_audio_meta_get_sample_rate_n(void)
560 {
561         int ret = MEDIA_CONTENT_ERROR_NONE;
562         int sample_rate = 0;
563
564         ret = audio_meta_get_sample_rate(NULL, &sample_rate);
565
566         dts_check_eq("utc_audio_meta_get_sample_rate_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
567 }
568
569 static void utc_audio_meta_get_sample_rate_p(void)
570 {
571         int ret = MEDIA_CONTENT_ERROR_NONE;
572         int sample_rate = 0;
573
574         ret = audio_meta_get_sample_rate(g_audio, &sample_rate);
575
576         dts_check_eq("utc_audio_meta_get_sample_rate_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to get the sample_rate");
577 }
578
579 static void utc_audio_meta_get_channel_n(void)
580 {
581         int ret = MEDIA_CONTENT_ERROR_NONE;
582         int channel = 0;
583
584         ret = audio_meta_get_channel(NULL, &channel);
585
586         dts_check_eq("utc_audio_meta_get_sample_rate_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
587 }
588
589 static void utc_audio_meta_get_channel_p(void)
590 {
591         int ret = MEDIA_CONTENT_ERROR_NONE;
592         int channel = 0;
593
594         ret = audio_meta_get_channel(g_audio, &channel);
595
596         dts_check_eq("utc_audio_meta_get_sample_rate_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to get the channel");
597 }
598
599 static void utc_audio_meta_get_duration_n(void)
600 {
601         int ret = MEDIA_CONTENT_ERROR_NONE;
602         int duration = 0;
603
604         ret = audio_meta_get_duration(NULL, &duration);
605
606         dts_check_eq("utc_audio_meta_get_duration_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
607 }
608
609 static void utc_audio_meta_get_duration_p(void)
610 {
611         int ret = MEDIA_CONTENT_ERROR_NONE;
612         int duration = 0;
613
614         ret = audio_meta_get_duration(g_audio, &duration);
615
616         dts_check_eq("utc_audio_meta_get_duration_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to get duration");
617 }
618
619 static void utc_audio_meta_get_played_count_n(void)
620 {
621         int ret = MEDIA_CONTENT_ERROR_NONE;
622         int count = 0;
623
624         ret = audio_meta_get_played_count(NULL, &count);
625
626         dts_check_eq("utc_audio_meta_get_played_count_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
627 }
628
629 static void utc_audio_meta_get_played_count_p(void)
630 {
631         int ret = MEDIA_CONTENT_ERROR_NONE;
632         int count = 0;
633
634         ret = audio_meta_get_played_count(g_audio, &count);
635
636         dts_check_eq("utc_audio_meta_get_played_count_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to get played count");
637 }
638
639 static void utc_audio_meta_get_played_time_n(void)
640 {
641         int ret = MEDIA_CONTENT_ERROR_NONE;
642         time_t played_time = 0;
643
644         ret = audio_meta_get_played_time(NULL, &played_time);
645
646         dts_check_eq("utc_audio_meta_get_played_time_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
647 }
648
649 static void utc_audio_meta_get_played_time_p(void)
650 {
651         int ret = MEDIA_CONTENT_ERROR_NONE;
652         time_t played_time = 0;
653
654         ret = audio_meta_get_played_time(g_audio, &played_time);
655
656         dts_check_eq("utc_audio_meta_get_played_time_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to get played time");
657 }
658
659 static void utc_audio_meta_get_played_position_n(void)
660 {
661         int ret = MEDIA_CONTENT_ERROR_NONE;
662         int position = 0;
663
664         ret = audio_meta_get_played_position(NULL, &position);
665
666         dts_check_eq("utc_audio_meta_get_played_position_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
667 }
668
669 static void utc_audio_meta_get_played_position_p(void)
670 {
671         int ret = MEDIA_CONTENT_ERROR_NONE;
672         int position = 0;
673
674         ret = audio_meta_get_played_position(g_audio, &position);
675
676         dts_check_eq("utc_audio_meta_get_played_position_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to get played position");
677 }
678
679 static void utc_audio_meta_set_played_count_n(void)
680 {
681         int ret = MEDIA_CONTENT_ERROR_NONE;
682         int played_count = 3;
683
684         ret = audio_meta_set_played_count(NULL, played_count);
685
686         dts_check_eq("utc_audio_meta_set_played_count_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
687 }
688
689 static void utc_audio_meta_set_played_count_p(void)
690 {
691         int ret = MEDIA_CONTENT_ERROR_NONE;
692         int played_count = 3;
693
694         ret = audio_meta_set_played_count(g_audio, played_count);
695
696         dts_check_eq("utc_audio_meta_set_played_count_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to set played count");
697 }
698
699 static void utc_audio_meta_set_played_time_n(void)
700 {
701         int ret = MEDIA_CONTENT_ERROR_NONE;
702         time_t played_time = 0;
703
704         ret = audio_meta_set_played_time(NULL, played_time);
705
706         dts_check_eq("utc_audio_meta_set_played_time_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
707 }
708
709 static void utc_audio_meta_set_played_time_p(void)
710 {
711         int ret = MEDIA_CONTENT_ERROR_NONE;
712         time_t played_time = 0;
713
714         ret = audio_meta_set_played_time(g_audio, played_time);
715
716         dts_check_eq("utc_audio_meta_set_played_time_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to set played time");
717 }
718
719 static void utc_audio_meta_set_played_position_n(void)
720 {
721         int ret = MEDIA_CONTENT_ERROR_NONE;
722         int played_position = 0;
723
724         ret = audio_meta_set_played_position(NULL, played_position);
725
726         dts_check_eq("audio_meta_set_played_position", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
727 }
728
729 static void utc_audio_meta_set_played_position_p(void)
730 {
731         int ret = MEDIA_CONTENT_ERROR_NONE;
732         int played_position = 0;
733
734         ret = audio_meta_set_played_position(g_audio, played_position);
735
736         dts_check_eq("utc_audio_meta_set_played_position_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to set playedposition");
737 }
738
739 static void utc_audio_meta_update_to_db_n(void)
740 {
741         int ret = MEDIA_CONTENT_ERROR_NONE;
742
743         ret = audio_meta_update_to_db(NULL);
744
745         dts_check_eq("utc_audio_meta_update_to_db_n", ret, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Must return MEDIA_CONTENT_ERROR_INVALID_PARAMETER in case of invalid parameter");
746 }
747
748 static void utc_audio_meta_update_to_db_p(void)
749 {
750         int ret = MEDIA_CONTENT_ERROR_NONE;
751
752         tet_printf("audio : 0x%x\n", g_audio);
753         ret = audio_meta_update_to_db(g_audio);
754
755         dts_check_eq("utc_audio_meta_update_to_db_p", ret, MEDIA_CONTENT_ERROR_NONE, "Failed to update metadata");
756 }