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) {
70 } else if (w == 720 && h == 1280) {
71 if (s_info.animation_type == TYPE_ON) {
77 if (s_info.animation_type == TYPE_ON) {
85 static unit_case_func_t __continue_check_finish_on_animation(void *data)
89 vconf_get_int(VCONFKEY_BOOT_ANIMATION_FINISHED, &is_finished);
90 TEST_ASSERT_EQUAL_INT(1, is_finished);
92 TEST_ASSERT_TRUE(s_info.is_exit == true);
94 TEST_CASE_DONE(s_info.group);
97 extern Evas_Object *__t__get_window(void);
98 extern Evas_Object *__t__get_display_block(void);
99 static unit_case_func_t __continue_check_finish_off_animation(void *data)
102 int screen_w, screen_h;
104 Evas_Object *window = __t__get_window();
105 TEST_ASSERT_TRUE(window != NULL);
106 elm_win_screen_size_get(window, NULL, NULL, &screen_w, &screen_h);
108 Evas_Object *display_block = __t__get_display_block();
109 TEST_ASSERT_TRUE(display_block != NULL);
111 evas_object_geometry_get(display_block, &rx, &ry, &rw, &rh);
112 TEST_ASSERT_EQUAL_INT(0, rx);
113 TEST_ASSERT_EQUAL_INT(0, ry);
114 TEST_ASSERT_EQUAL_INT(screen_w, rw);
115 TEST_ASSERT_EQUAL_INT(screen_h, rh);
116 TEST_ASSERT_TRUE(evas_object_visible_get(display_block));
118 TEST_CASE_DONE(s_info.group);
121 extern Evas_Object *__t__get_layout(void);
122 extern char * __t__get_layout_file_name(int animation_type, int w, int h);
123 static unit_case_func_t __continue_check_animation_layout(void *data)
126 int screen_w, screen_h;
128 Evas_Object *window = __t__get_window();
129 TEST_ASSERT_TRUE(window != NULL);
131 elm_win_screen_size_get(window, NULL, NULL, &screen_w, &screen_h);
133 evas_object_geometry_get(window, &rx, &ry, &rw, &rh);
134 TEST_ASSERT_EQUAL_INT(0, rx);
135 TEST_ASSERT_EQUAL_INT(0, ry);
136 TEST_ASSERT_EQUAL_INT(screen_w, rw);
137 TEST_ASSERT_EQUAL_INT(screen_h, rh);
138 TEST_ASSERT_TRUE(evas_object_visible_get(window));
140 Evas_Object *layout = __t__get_layout();
141 TEST_ASSERT_TRUE(layout != NULL);
142 evas_object_geometry_get(layout, &rx, &ry, &rw, &rh);
143 TEST_ASSERT_EQUAL_INT(0, rx);
144 TEST_ASSERT_EQUAL_INT(0, ry);
145 TEST_ASSERT_EQUAL_INT(screen_w, rw);
146 TEST_ASSERT_EQUAL_INT(screen_h, rh);
147 TEST_ASSERT_TRUE(evas_object_visible_get(layout));
149 const char *file_name = NULL;
150 elm_layout_file_get(layout, &file_name, NULL);
151 char * expected_file_name = __t__get_layout_file_name(s_info.animation_type, screen_w, screen_h);
152 TEST_ASSERT_EQUAL_STRING(expected_file_name, file_name);
153 free(expected_file_name);
155 int current_step = (int)data;
156 if (current_step < __get_step_max(screen_w, screen_h)) {
157 TEST_CASE_CONTINUE(0.8, __continue_check_animation_layout, (void*)(current_step + 1));
160 if (s_info.animation_type == TYPE_ON)
161 TEST_CASE_CONTINUE(0.8, __continue_check_finish_on_animation, NULL);
163 TEST_CASE_CONTINUE(0.8, __continue_check_finish_off_animation, NULL);
166 static unit_case_func_t __case_check_animation(void *data)
168 int is_finished = -1;
170 vconf_get_int(VCONFKEY_BOOT_ANIMATION_FINISHED, &is_finished);
171 TEST_ASSERT_EQUAL_INT(0, is_finished);
173 boot_exit = test_elm_exit;
174 s_info.is_exit = false;
176 s_info.animation_type = (int)data;
177 animation_init(s_info.animation_type);
179 /* 0.8 because boot-animation take 6 sec, we should not use divisor */
180 TEST_CASE_CONTINUE(0.8, __continue_check_animation_layout, (void*)1);
183 void group_feature_on_off_animation(unit_group_t * group)
185 s_info.group = group;
186 s_info.group->set_up = __set_up;
187 s_info.group->tear_down = __tear_down;
189 TEST_CASE_ADD(s_info.group, __case_check_animation, (void*)TYPE_ON);
190 TEST_CASE_ADD(s_info.group, __case_check_animation, (void*)TYPE_OFF);
192 TEST_GROUP_RUN(s_info.group);