2 * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include "feature_test.h"
23 #include "animation.h"
25 #include <Elementary.h>
38 static void test_elm_exit(void)
40 s_info.is_exit = true;
43 static void __set_up(void)
45 s_info.is_exit = false;
46 boot_exit = test_elm_exit;
47 vconf_set_int(VCONFKEY_BOOT_ANIMATION_FINISHED, 0);
49 ecore_timer_add(0.1, s_info.group->set_up_complete, s_info.group);
52 static void __tear_down(void)
55 s_info.group->tear_down_complete(s_info.group);
58 static int __get_step_max(int w, int h)
60 if (w == 360 && h == 360)
62 else if (w == 360 && h == 480)
64 else if (w == 480 && h == 800) {
65 if (s_info.animation_type == TYPE_ON)
69 } else if (w == 720 && h == 1280) {
70 if (s_info.animation_type == TYPE_ON)
75 if (s_info.animation_type == TYPE_ON)
82 static unit_case_func_t __continue_check_finish_on_animation(void *data)
86 vconf_get_int(VCONFKEY_BOOT_ANIMATION_FINISHED, &is_finished);
87 TEST_ASSERT_EQUAL_INT(1, is_finished);
89 TEST_ASSERT_TRUE(s_info.is_exit == true);
91 TEST_CASE_DONE(s_info.group);
94 extern Evas_Object *__t__get_window(void);
95 extern Evas_Object *__t__get_display_block(void);
96 static unit_case_func_t __continue_check_finish_off_animation(void *data)
99 int screen_w, screen_h;
101 Evas_Object *window = __t__get_window();
102 TEST_ASSERT_TRUE(window != NULL);
103 elm_win_screen_size_get(window, NULL, NULL, &screen_w, &screen_h);
105 Evas_Object *display_block = __t__get_display_block();
106 TEST_ASSERT_TRUE(display_block != NULL);
108 evas_object_geometry_get(display_block, &rx, &ry, &rw, &rh);
109 TEST_ASSERT_EQUAL_INT(0, rx);
110 TEST_ASSERT_EQUAL_INT(0, ry);
111 TEST_ASSERT_EQUAL_INT(screen_w, rw);
112 TEST_ASSERT_EQUAL_INT(screen_h, rh);
113 TEST_ASSERT_TRUE(evas_object_visible_get(display_block));
115 TEST_CASE_DONE(s_info.group);
118 extern Evas_Object *__t__get_layout(void);
119 extern char * __t__get_layout_file_name(int animation_type, int w, int h);
120 static unit_case_func_t __continue_check_animation_layout(void *data)
123 int screen_w, screen_h;
125 Evas_Object *window = __t__get_window();
126 TEST_ASSERT_TRUE(window != NULL);
128 elm_win_screen_size_get(window, NULL, NULL, &screen_w, &screen_h);
130 evas_object_geometry_get(window, &rx, &ry, &rw, &rh);
131 TEST_ASSERT_EQUAL_INT(0, rx);
132 TEST_ASSERT_EQUAL_INT(0, ry);
133 TEST_ASSERT_EQUAL_INT(screen_w, rw);
134 TEST_ASSERT_EQUAL_INT(screen_h, rh);
135 TEST_ASSERT_TRUE(evas_object_visible_get(window));
137 Evas_Object *layout = __t__get_layout();
138 TEST_ASSERT_TRUE(layout != NULL);
139 evas_object_geometry_get(layout, &rx, &ry, &rw, &rh);
140 TEST_ASSERT_EQUAL_INT(0, rx);
141 TEST_ASSERT_EQUAL_INT(0, ry);
142 TEST_ASSERT_EQUAL_INT(screen_w, rw);
143 TEST_ASSERT_EQUAL_INT(screen_h, rh);
144 TEST_ASSERT_TRUE(evas_object_visible_get(layout));
146 const char *file_name = NULL;
147 elm_layout_file_get(layout, &file_name, NULL);
148 char * expected_file_name = __t__get_layout_file_name(s_info.animation_type, screen_w, screen_h);
149 TEST_ASSERT_EQUAL_STRING(expected_file_name, file_name);
150 free(expected_file_name);
152 int current_step = (int)data;
153 if (current_step < __get_step_max(screen_w, screen_h))
154 TEST_CASE_CONTINUE(0.8, __continue_check_animation_layout, (void*)(current_step + 1));
156 if (s_info.animation_type == TYPE_ON)
157 TEST_CASE_CONTINUE(0.8, __continue_check_finish_on_animation, NULL);
159 TEST_CASE_CONTINUE(0.8, __continue_check_finish_off_animation, NULL);
162 static unit_case_func_t __case_check_animation(void *data)
164 int is_finished = -1;
166 vconf_get_int(VCONFKEY_BOOT_ANIMATION_FINISHED, &is_finished);
167 TEST_ASSERT_EQUAL_INT(0, is_finished);
169 boot_exit = test_elm_exit;
170 s_info.is_exit = false;
172 s_info.animation_type = (int)data;
173 animation_init(s_info.animation_type);
175 /* 0.8 because boot-animation take 6 sec, we should not use divisor */
176 TEST_CASE_CONTINUE(0.8, __continue_check_animation_layout, (void*)1);
179 void group_feature_on_off_animation(unit_group_t * group)
181 s_info.group = group;
182 s_info.group->set_up = __set_up;
183 s_info.group->tear_down = __tear_down;
185 TEST_CASE_ADD(s_info.group, __case_check_animation, (void*)TYPE_ON);
186 TEST_CASE_ADD(s_info.group, __case_check_animation, (void*)TYPE_OFF);
188 TEST_GROUP_RUN(s_info.group);