extern char *optarg;
extern int optind, opterr, optopt;
-struct args {
- int argc;
- char **argv;
-};
-
//#define SOUND_PROFILE
#ifdef SOUND_PROFILE
#include <mm_sound_private.h>
}
#endif
-static int __prepare_animation(keynode_t * node, void *user_data)
+static int __check_on_off_type(void *user_data)
{
int c;
+ int i;
int argc;
char **argv;
int type = TYPE_UNKNOWN;
{"clear", no_argument, 0, 'c' },
{0, 0, 0, 0 },
};
- static int invoked_flag = 0;
-
- _D("xready_cb");
- printf("xready_cb\n");
-
- if (invoked_flag == 1) {
- _E("Already launched");
- printf("Error Already launched\n");
- return EXIT_FAILURE;
- }
-
- invoked_flag = 1;
-
argc = args->argc;
argv = args->argv;
- int i;
for (i = 0; i < argc; i++) {
_D("argc %d [%s]", i, argv[i]);
printf("argc %d [%s]\n", i, argv[i]);
}
}
+ return type;
+}
+
+static int __prepare_animation(keynode_t * node, void *user_data)
+{
#ifdef SOUND_PROFILE
/* Sound is not supported Since Tizen 4.0 */
/* check sound profile */
char wav_path[256];
int soundon = 1; /* default sound on */
+
if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &soundon) < 0) {
_D("VCONFKEY_SETAPPL_SOUND_STATUS_BOOL ==> FAIL!!");
printf("VCONFKEY_SETAPPL_SOUND_STATUS_BOOL ==> FAIL!!\n");
printf("Sound status: %d\n", soundon);
#endif
+ int type = -1;
+ type = __check_on_off_type(user_data);
+ if (type < 0) {
+ _E("Failed to get on off type or UNKNOWN_TYPE: %d", type);
+ return EXIT_FAILURE;
+ }
+
if (init_animation(type) != EXIT_SUCCESS) {
- _D("Exit boot-animation");
+ _E("Exit boot-animation");
printf("Exit boot-animation\n");
return EXIT_FAILURE;
}
args.argc = argc;
args.argv = argv;
+ static int invoked_flag = 0;
+ if (invoked_flag == 1) {
+ return -1;
+ }
+ invoked_flag = 1;
+
#if 0
_boot_ani_ui_set_scale();
#endif
return 0;
}
+
+#endif
+
+#include "test.h"
+#if TEST_MODE
+int __t__check_on_off_type(void *user_data)
+{
+ return __check_on_off_type(user_data);
+}
#endif
#include "function_test.h"
#include "animation.h"
+#include "boot.h"
#include <Elementary.h>
#define LAYOUT "/usr/share/edje/720x1280_PowerOn.edj"
#define LAYOUT_W 720
#define LAYOUT_H 1280
-#define STATE 1
+#define TYPE_POWER_ON 1
+#define TYPE_POWER_OFF 2
+extern int __t__check_on_off_type(void *user_data);
static void __case_get_layout_file_name(bool * is_passed);
static struct {
s_info.win = NULL;
}
+static void __case_check_on_off_type(bool * is_passed)
+{
+ struct args args;
+ args.argc = 2;
+ args.argv = (char *)malloc(4 * 2);
+
+ args.argv[0] = "/usr/bin/boot-animation";
+ args.argv[1] = "--start";
+ TEST_ASSERT_EQUAL_INT(TYPE_POWER_ON, __t__check_on_off_type(&args));
+
+ args.argv[1] = "--off";
+ TEST_ASSERT_EQUAL_INT(TYPE_POWER_OFF, __t__check_on_off_type(&args));
+
+ free(args.argv);
+
+ *is_passed = true;
+}
+
static void __case_create_win(bool * is_passed)
{
TEST_ASSERT_TRUE(s_info.win != NULL);
void group_function_create_animation(unit_group_t * group)
{
+ TEST_CASE(group, __case_check_on_off_type);
TEST_CASE(group, __case_create_win);
TEST_CASE(group, __case_get_layout_file_name);
TEST_CASE(group, __case_is_layout_file_exist);