tizen beta release
[framework/base/syspopup.git] / test / test.c
1 /*
2  * syspopup
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
7  * Jaeho Lee <jaeho81.lee@samsung.com>
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  */
22
23 #include <stdlib.h>
24 #include <string.h>
25 #include "syspopup_caller.h"
26
27 void usage()
28 {
29         printf("[usage] sp_test launch/destroy popup_name..."
30                                 "(key1,val1,key2,val2,...)\n");
31 }
32
33 int main(int argc, char **argv)
34 {
35         bundle *b;
36         int i;
37
38         if (argc < 2) {
39                 usage();
40                 return -1;
41         }
42
43         if (strcmp(argv[1], "launch") == 0) {
44                 if ((argc < 3) || (argc % 2 == 0)) {
45                         usage();
46                         return -1;
47                 }
48
49                 b = bundle_create();
50                 for (i = 3; i < argc; i = i + 2)
51                         bundle_add(b, argv[i], argv[i + 1]);
52                 syspopup_launch(argv[2], b);
53                 bundle_free(b);
54         } else if (strcmp(argv[1], "destroy") == 0) {
55                 syspopup_destroy_all();
56         } else {
57                 usage();
58         }
59
60         return 0;
61 }
62