summaryrefslogtreecommitdiff
path: root/src/tests/efreet/ef_menu.c
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2012-12-29 23:04:40 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2012-12-29 23:04:40 +0000
commit4bc0210bd31ed1de6554441562bd93ea863ee9d9 (patch)
tree5d83be12538f8c8d3816bbf65916ce383d050c2e /src/tests/efreet/ef_menu.c
parent727ddbeaf0c53f31cd62c254fdebe26823d537eb (diff)
efl: merge efreet.
seems to be fine, pass distcheck and friends. please report. changes: - documentation hierarchy fixes - replaced __UNUSED__ with EINA_UNUSED - replaced PKG_DATA_DIR with PACKAGE_DATA_DIR"/efreet" SVN revision: 81889
Diffstat (limited to 'src/tests/efreet/ef_menu.c')
-rw-r--r--src/tests/efreet/ef_menu.c150
1 files changed, 150 insertions, 0 deletions
diff --git a/src/tests/efreet/ef_menu.c b/src/tests/efreet/ef_menu.c
new file mode 100644
index 0000000000..be42f128a3
--- /dev/null
+++ b/src/tests/efreet/ef_menu.c
@@ -0,0 +1,150 @@
1#include "Efreet.h"
2#include "config.h"
3#include <stdio.h>
4#include <unistd.h>
5
6#if 0
7static void
8ef_menu_desktop_exec(Efreet_Menu *menu)
9{
10 Eina_List *l;
11
12 if (menu->entries)
13 {
14 Efreet_Desktop *desktop;
15
16 EINA_LIST_FOREACH(menu->entries, l, desktop)
17 efreet_desktop_exec(desktop, NULL);
18 }
19 if (menu->sub_menus)
20 {
21 Efreet_Menu *sub_menu;
22
23 EINA_LIST_FOREACH(menu->sub_menus, l, sub_menu)
24 ef_menu_desktop_exec(sub_menu);
25 }
26}
27#endif
28
29int
30ef_cb_menu_get(void)
31{
32 Efreet_Menu *menu;
33
34 menu = efreet_menu_get();
35// menu = efreet_menu_parse(PACKAGE_DATA_DIR"/efreet/test/test.menu");
36 if (!menu)
37 {
38 printf("efreet_menu_get() returned NULL\n");
39 return 0;
40 }
41 printf("\n");
42 efreet_menu_dump(menu, "");
43 efreet_menu_free(menu);
44
45 return 1;
46}
47
48int
49ef_cb_menu_with_slashes(void)
50{
51 Efreet_Menu *menu;
52
53 menu = efreet_menu_parse(PACKAGE_DATA_DIR"/efreet/test/test_menu_slash_bad.menu");
54 if (menu)
55 {
56 printf("efreet_menu_get() didn't return NULL\n");
57 return 0;
58 }
59
60 return 1;
61}
62
63int
64ef_cb_menu_save(void)
65{
66 Efreet_Menu *menu;
67 int ret;
68
69// menu = efreet_menu_get();
70 menu = efreet_menu_parse(PACKAGE_DATA_DIR"/efreet/test/test.menu");
71 if (!menu)
72 {
73 printf("efreet_menu_get() returned NULL\n");
74 return 0;
75 }
76 unlink("/tmp/test.menu");
77 ret = efreet_menu_save(menu, "/tmp/test.menu");
78 efreet_menu_free(menu);
79 return ret;
80}
81
82int
83ef_cb_menu_edit(void)
84{
85 Efreet_Menu *menu, *entry;
86 Efreet_Desktop *desktop;
87
88// menu = efreet_menu_get();
89 menu = efreet_menu_parse(PACKAGE_DATA_DIR"/efreet/test/test.menu");
90 if (!menu)
91 {
92 printf("efreet_menu_get() returned NULL\n");
93 return 0;
94 }
95#if 0
96 printf("\n");
97 efreet_menu_dump(menu, "");
98 printf("\n");
99#endif
100
101 desktop = efreet_desktop_get(PACKAGE_DATA_DIR"/efreet/test/test.desktop");
102 if (!desktop)
103 {
104 efreet_menu_free(menu);
105 printf("No desktop found.\n");
106 return 0;
107 }
108
109 efreet_menu_desktop_insert(menu, desktop, 0);
110#if 0
111 printf("\n");
112 efreet_menu_dump(menu, "");
113 printf("\n");
114#endif
115 entry = eina_list_data_get(menu->entries);
116 if (desktop != entry->desktop)
117 {
118 efreet_menu_free(menu);
119 return 0;
120 }
121
122 efreet_menu_desktop_insert(menu, desktop, 2);
123#if 0
124 printf("\n");
125 efreet_menu_dump(menu, "");
126 printf("\n");
127#endif
128 entry = eina_list_nth(menu->entries, 2);
129 if (desktop != entry->desktop)
130 {
131 efreet_menu_free(menu);
132 return 0;
133 }
134
135 efreet_menu_desktop_insert(menu, desktop, -1);
136#if 0
137 printf("\n");
138 efreet_menu_dump(menu, "");
139 printf("\n");
140#endif
141 entry = eina_list_data_get(eina_list_last(menu->entries));
142 if (desktop != entry->desktop)
143 {
144 efreet_menu_free(menu);
145 return 0;
146 }
147
148 efreet_menu_free(menu);
149 return 1;
150}