summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@yahoo.com>2018-12-05 22:54:38 +0200
committerChristopher Michael <cp.michael@samsung.com>2018-12-06 12:06:17 -0500
commitebc2e0f5828318fc39ea0b6db2ac890aaddc586b (patch)
tree013743e5c191a0a4afcb5c458f5cd001bda4e8af
parente8827de96da406986605ac8b56c2e00aa06efcc7 (diff)
Tests: adapt some tests for Exactness
Home directory cannot be used for the tests as the shots will always be different between machines. A test directory is created to solve this issue.
-rw-r--r--src/bin/elementary/test_fileselector.c27
-rw-r--r--src/bin/elementary/test_fileselector_button.c4
-rw-r--r--src/bin/elementary/test_fileselector_entry.c20
-rw-r--r--src/bin/elementary/test_panel.c24
4 files changed, 58 insertions, 17 deletions
diff --git a/src/bin/elementary/test_fileselector.c b/src/bin/elementary/test_fileselector.c
index 3568fcdb57..1c23066097 100644
--- a/src/bin/elementary/test_fileselector.c
+++ b/src/bin/elementary/test_fileselector.c
@@ -511,13 +511,33 @@ _edje_filter(const char *path, Eina_Bool dir,
511 return EINA_FALSE; 511 return EINA_FALSE;
512} 512}
513 513
514static void
515_create_dir_struct(void)
516{
517 FILE *fp;
518 if (mkdir("/tmp/test_fs", S_IRWXU) < 0)
519 printf("make dir /tmp/test_fs failed!\n");
520 fp = fopen("/tmp/test_fs/a_file.txt", "w");
521 if (fp) fclose(fp);
522 fp = fopen("/tmp/test_fs/k_file.txt", "w");
523 if (fp) fclose(fp);
524 fp = fopen("/tmp/test_fs/m_file.txt", "w");
525 if (fp) fclose(fp);
526
527 if (mkdir("/tmp/test_fs/a_subdir", S_IRWXU) < 0)
528 printf("make dir /tmp/test_fs/a_subdir failed!\n");
529 fp = fopen("/tmp/test_fs/a_subdir/d_sub_file.txt", "w");
530 if (fp) fclose(fp);
531 fp = fopen("/tmp/test_fs/a_subdir/j_sub_file.txt", "w");
532 if (fp) fclose(fp);
533}
534
514void 535void
515test_fileselector(void *data EINA_UNUSED, 536test_fileselector(void *data EINA_UNUSED,
516 Evas_Object *obj EINA_UNUSED, 537 Evas_Object *obj EINA_UNUSED,
517 void *event_info EINA_UNUSED) 538 void *event_info EINA_UNUSED)
518{ 539{
519 Evas_Object *win, *fs, *box, *vbox, *sep; 540 Evas_Object *win, *fs, *box, *vbox, *sep;
520 const char * home_env;
521 541
522 /* Set the locale according to the system pref. 542 /* Set the locale according to the system pref.
523 * If you don't do so the file selector will order the files list in 543 * If you don't do so the file selector will order the files list in
@@ -538,6 +558,7 @@ test_fileselector(void *data EINA_UNUSED,
538 elm_win_resize_object_add(win, box); 558 elm_win_resize_object_add(win, box);
539 evas_object_show(box); 559 evas_object_show(box);
540 560
561 _create_dir_struct(); /* Create a dir struct in /tmp */
541 fs = elm_fileselector_add(box); 562 fs = elm_fileselector_add(box);
542 evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 563 evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
543 evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL); 564 evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -548,9 +569,7 @@ test_fileselector(void *data EINA_UNUSED,
548 elm_fileselector_is_save_set(fs, EINA_TRUE); 569 elm_fileselector_is_save_set(fs, EINA_TRUE);
549 /* make the file list a tree with dir expandable in place */ 570 /* make the file list a tree with dir expandable in place */
550 elm_fileselector_expandable_set(fs, EINA_FALSE); 571 elm_fileselector_expandable_set(fs, EINA_FALSE);
551 /* start the fileselector in the home dir */ 572 elm_fileselector_path_set(fs, "/tmp/test_fs");
552 home_env = eina_environment_home_get();
553 elm_fileselector_path_set(fs, home_env);
554 573
555 /* provides suggested name (just for showing) */ 574 /* provides suggested name (just for showing) */
556 elm_fileselector_current_name_set(fs, "No name"); 575 elm_fileselector_current_name_set(fs, "No name");
diff --git a/src/bin/elementary/test_fileselector_button.c b/src/bin/elementary/test_fileselector_button.c
index f87db9d0e9..b04e9d38ef 100644
--- a/src/bin/elementary/test_fileselector_button.c
+++ b/src/bin/elementary/test_fileselector_button.c
@@ -65,7 +65,7 @@ _api_bt_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
65} 65}
66 66
67static void 67static void
68create_dir_struct(void) 68_create_dir_struct(void)
69{ 69{
70 FILE *fp; 70 FILE *fp;
71 if (mkdir("/tmp/test_fs_bt", S_IRWXU) < 0) 71 if (mkdir("/tmp/test_fs_bt", S_IRWXU) < 0)
@@ -182,7 +182,7 @@ test_fileselector_button(void *data EINA_UNUSED,
182 182
183 elm_box_pack_end(bxx, vbox); 183 elm_box_pack_end(bxx, vbox);
184 184
185 create_dir_struct(); /* Create a dir struct in /tmp */ 185 _create_dir_struct(); /* Create a dir struct in /tmp */
186 /* file selector button */ 186 /* file selector button */
187 ic = elm_icon_add(win); 187 ic = elm_icon_add(win);
188 elm_icon_standard_set(ic, "file"); 188 elm_icon_standard_set(ic, "file");
diff --git a/src/bin/elementary/test_fileselector_entry.c b/src/bin/elementary/test_fileselector_entry.c
index 07d6cf0fba..3bfd438204 100644
--- a/src/bin/elementary/test_fileselector_entry.c
+++ b/src/bin/elementary/test_fileselector_entry.c
@@ -65,25 +65,25 @@ _api_bt_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
65} 65}
66 66
67static void 67static void
68create_dir_struct(void) 68_create_dir_struct(void)
69{ 69{
70 FILE *fp; 70 FILE *fp;
71 int ret = 0; 71 int ret = 0;
72 72
73 ret = mkdir("/tmp/test_fs_bt", S_IRWXU); 73 ret = mkdir("/tmp/test_fs_en", S_IRWXU);
74 if (ret < 0) return; 74 if (ret < 0) return;
75 fp = fopen("/tmp/test_fs_bt/a_file.txt", "w"); 75 fp = fopen("/tmp/test_fs_en/a_file.txt", "w");
76 if (fp) fclose(fp); 76 if (fp) fclose(fp);
77 fp = fopen("/tmp/test_fs_bt/k_file.txt", "w"); 77 fp = fopen("/tmp/test_fs_en/k_file.txt", "w");
78 if (fp) fclose(fp); 78 if (fp) fclose(fp);
79 fp = fopen("/tmp/test_fs_bt/m_file.txt", "w"); 79 fp = fopen("/tmp/test_fs_en/m_file.txt", "w");
80 if (fp) fclose(fp); 80 if (fp) fclose(fp);
81 81
82 ret = mkdir("/tmp/test_fs_bt/a_subdir", S_IRWXU); 82 ret = mkdir("/tmp/test_fs_en/a_subdir", S_IRWXU);
83 if (ret < 0) return; 83 if (ret < 0) return;
84 fp = fopen("/tmp/test_fs_bt/a_subdir/d_sub_file.txt", "w"); 84 fp = fopen("/tmp/test_fs_en/a_subdir/d_sub_file.txt", "w");
85 if (fp) fclose(fp); 85 if (fp) fclose(fp);
86 fp = fopen("/tmp/test_fs_bt/a_subdir/j_sub_file.txt", "w"); 86 fp = fopen("/tmp/test_fs_en/a_subdir/j_sub_file.txt", "w");
87 if (fp) fclose(fp); 87 if (fp) fclose(fp);
88} 88}
89 89
@@ -190,14 +190,14 @@ test_fileselector_entry(void *data EINA_UNUSED,
190 190
191 elm_box_pack_end(bxx, vbox); 191 elm_box_pack_end(bxx, vbox);
192 192
193 create_dir_struct(); /* Create a dir struct in /tmp */ 193 _create_dir_struct(); /* Create a dir struct in /tmp */
194 194
195 /* file selector entry */ 195 /* file selector entry */
196 ic = elm_icon_add(win); 196 ic = elm_icon_add(win);
197 elm_icon_standard_set(ic, "file"); 197 elm_icon_standard_set(ic, "file");
198 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); 198 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
199 fs_en = elm_fileselector_entry_add(win); 199 fs_en = elm_fileselector_entry_add(win);
200 elm_fileselector_path_set(fs_en, "/tmp/test_fs_bt"); 200 elm_fileselector_path_set(fs_en, "/tmp/test_fs_en");
201 elm_object_text_set(fs_en, "Select a file"); 201 elm_object_text_set(fs_en, "Select a file");
202 elm_object_part_content_set(fs_en, "button icon", ic); 202 elm_object_part_content_set(fs_en, "button icon", ic);
203 evas_object_size_hint_weight_set(fs_en, EVAS_HINT_EXPAND, 0.0); 203 evas_object_size_hint_weight_set(fs_en, EVAS_HINT_EXPAND, 0.0);
diff --git a/src/bin/elementary/test_panel.c b/src/bin/elementary/test_panel.c
index 60ad94edb2..371e6d5541 100644
--- a/src/bin/elementary/test_panel.c
+++ b/src/bin/elementary/test_panel.c
@@ -84,6 +84,27 @@ _item_del(void *data, Evas_Object *obj EINA_UNUSED)
84} 84}
85 85
86static void 86static void
87_create_dir_struct(void)
88{
89 FILE *fp;
90 if (mkdir("/tmp/test_panel", S_IRWXU) < 0)
91 printf("make dir /tmp/test_panel failed!\n");
92 fp = fopen("/tmp/test_panel/a_file.txt", "w");
93 if (fp) fclose(fp);
94 fp = fopen("/tmp/test_panel/k_file.txt", "w");
95 if (fp) fclose(fp);
96 fp = fopen("/tmp/test_panel/m_file.txt", "w");
97 if (fp) fclose(fp);
98
99 if (mkdir("/tmp/test_panel/a_subdir", S_IRWXU) < 0)
100 printf("make dir /tmp/test_panel/a_subdir failed!\n");
101 fp = fopen("/tmp/test_panel/a_subdir/d_sub_file.txt", "w");
102 if (fp) fclose(fp);
103 fp = fopen("/tmp/test_panel/a_subdir/j_sub_file.txt", "w");
104 if (fp) fclose(fp);
105}
106
107static void
87_fill_list(Evas_Object *obj, Elm_Genlist_Item_Class *itc) 108_fill_list(Evas_Object *obj, Elm_Genlist_Item_Class *itc)
88{ 109{
89 Eina_List *l; 110 Eina_List *l;
@@ -95,7 +116,8 @@ _fill_list(Evas_Object *obj, Elm_Genlist_Item_Class *itc)
95 Eina_Iterator *it; 116 Eina_Iterator *it;
96 const char *name; 117 const char *name;
97 118
98 it = eina_file_ls(eina_environment_home_get()); 119 _create_dir_struct();
120 it = eina_file_ls("/tmp/test_panel");
99 EINA_ITERATOR_FOREACH(it, name) 121 EINA_ITERATOR_FOREACH(it, name)
100 { 122 {
101 if (x >= LIST_ITEM_MAX) 123 if (x >= LIST_ITEM_MAX)