elementary_test: fix formatting

SVN revision: 68000
This commit is contained in:
Jihoon Kim 2012-02-16 05:03:57 +00:00
parent e95974c024
commit 1bdfd32580
7 changed files with 187 additions and 199 deletions

View File

@ -46,12 +46,12 @@ _print_cal_info(Evas_Object *cal, Evas_Object *en)
wds = elm_calendar_weekdays_names_get(cal);
snprintf(info, sizeof(info),
" Day: %i, Mon: %i, Year %i, WeekDay: %i<br/>"
" Interval: %0.2f, Year_Min: %i, Year_Max %i, Sel Enabled : %i<br/>"
" Weekdays: %s, %s, %s, %s, %s, %s, %s<br/>",
stime.tm_mday, stime.tm_mon, stime.tm_year + 1900, stime.tm_wday,
interval, year_min, year_max, sel_enabled,
wds[0], wds[1], wds[2], wds[3], wds[4], wds[5], wds[6]);
" Day: %i, Mon: %i, Year %i, WeekDay: %i<br/>"
" Interval: %0.2f, Year_Min: %i, Year_Max %i, Sel Enabled : %i<br/>"
" Weekdays: %s, %s, %s, %s, %s, %s, %s<br/>",
stime.tm_mday, stime.tm_mon, stime.tm_year + 1900, stime.tm_wday,
interval, year_min, year_max, sel_enabled,
wds[0], wds[1], wds[2], wds[3], wds[4], wds[5], wds[6]);
elm_object_text_set(en, info);
}
@ -167,7 +167,7 @@ test_calendar2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
current_time = time(NULL) - 5 * 84600;
localtime_r(&current_time, &selected_time);
mark = elm_calendar_mark_add(cal, "holiday", &selected_time,
ELM_CALENDAR_WEEKLY);
ELM_CALENDAR_WEEKLY);
current_time = time(NULL) + 1 * 84600;
localtime_r(&current_time, &selected_time);

View File

@ -74,11 +74,12 @@ _edit_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__)
{
Evas_Object *ck = data;
if (!elm_clock_edit_get(ck)) {
elm_object_text_set(obj, "Done");
elm_clock_edit_set(ck, EINA_TRUE);
return;
}
if (!elm_clock_edit_get(ck))
{
elm_object_text_set(obj, "Done");
elm_clock_edit_set(ck, EINA_TRUE);
return;
}
elm_object_text_set(obj, "Edit");
elm_clock_edit_set(ck, EINA_FALSE);
}
@ -88,11 +89,12 @@ _hmode_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__)
{
Evas_Object *ck = data;
if (!elm_clock_show_am_pm_get(ck)) {
elm_object_text_set(obj, "24h");
elm_clock_show_am_pm_set(ck, EINA_TRUE);
return;
}
if (!elm_clock_show_am_pm_get(ck))
{
elm_object_text_set(obj, "24h");
elm_clock_show_am_pm_set(ck, EINA_TRUE);
return;
}
elm_object_text_set(obj, "12h");
elm_clock_show_am_pm_set(ck, EINA_FALSE);
}

View File

@ -92,6 +92,5 @@ test_colorselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve
evas_object_resize(win, 320, 480);
evas_object_show(win);
}
#endif

View File

@ -90,7 +90,7 @@ test_conformant(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event
static void
popobj(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
elm_pager_content_pop(data);
elm_pager_content_pop(data);
}
void

View File

@ -110,22 +110,21 @@ grid_content_get(void *data, Evas_Object *obj, const char *part)
const Testitem *ti = data;
if (!strcmp(part, "elm.swallow.icon"))
{
Evas_Object *icon = elm_bg_add(obj);
elm_bg_file_set(icon, ti->path, NULL);
evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
evas_object_show(icon);
return icon;
Evas_Object *icon = elm_bg_add(obj);
elm_bg_file_set(icon, ti->path, NULL);
evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
evas_object_show(icon);
return icon;
}
else if (!strcmp(part, "elm.swallow.end"))
{
Evas_Object *ck;
ck = elm_check_add(obj);
evas_object_propagate_events_set(ck, 0);
elm_check_state_set(ck, ti->onoff);
evas_object_smart_callback_add(ck, "changed", grid_item_check_changed, data);
evas_object_show(ck);
return ck;
Evas_Object *ck;
ck = elm_check_add(obj);
evas_object_propagate_events_set(ck, 0);
elm_check_state_set(ck, ti->onoff);
evas_object_smart_callback_add(ck, "changed", grid_item_check_changed, data);
evas_object_show(ck);
return ck;
}
return NULL;
}
@ -189,13 +188,13 @@ test_gengrid(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_inf
n = 0;
for (i = 0; i < 12 * 12; i++)
{
snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n]);
n = (n + 1) % 9;
ti[i].mode = i;
ti[i].path = eina_stringshare_add(buf);
ti[i].item = elm_gengrid_item_append(grid, &gic, &(ti[i]), grid_sel, NULL);
if (!(i % 5))
elm_gengrid_item_selected_set(ti[i].item, EINA_TRUE);
snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n]);
n = (n + 1) % 9;
ti[i].mode = i;
ti[i].path = eina_stringshare_add(buf);
ti[i].item = elm_gengrid_item_append(grid, &gic, &(ti[i]), grid_sel, NULL);
if (!(i % 5))
elm_gengrid_item_selected_set(ti[i].item, EINA_TRUE);
}
evas_object_show(grid);
@ -429,21 +428,20 @@ test_gengrid3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
ggic.func.state_get = NULL;
ggic.func.del = NULL;
n = 0;
for (i = 0; i < 12 * 12; i++)
{
snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n]);
n = (n + 1) % 9;
ti[i].mode = i;
ti[i].path = eina_stringshare_add(buf);
snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n]);
n = (n + 1) % 9;
ti[i].mode = i;
ti[i].path = eina_stringshare_add(buf);
if (i == 0 || i == 18 || i == 53 || i == 100)
//if (i == 0 || i == 18)
//if (i == 0 || i == 18)
ti[i].item = elm_gengrid_item_append(grid, &ggic, &(ti[i]), grid_sel, NULL);
else
ti[i].item = elm_gengrid_item_append(grid, &gic, &(ti[i]), grid_sel, NULL);
if (!(i % 5))
elm_gengrid_item_selected_set(ti[i].item, EINA_TRUE);
if (!(i % 5))
elm_gengrid_item_selected_set(ti[i].item, EINA_TRUE);
}
evas_object_show(grid);

View File

@ -341,7 +341,6 @@ static const char vertex_shader[] =
" gl_FragColor = color + white * dot(light_direction, rotated_normal);\n"
"}\n";
static void
gears_init(GLData *gld)
{
@ -388,7 +387,6 @@ gears_init(GLData *gld)
gld->gear3 = make_gear(gld, 1.3, 2.0, 0.5, 10, 0.7);
}
static void
gldata_init(GLData *gld)
{
@ -442,7 +440,6 @@ _del_gl(Evas_Object *obj)
free(gld);
}
static void
_resize_gl(Evas_Object *obj)
{
@ -456,8 +453,6 @@ _resize_gl(Evas_Object *obj)
gears_reshape(gld, w,h);
}
static void
_draw_gl(Evas_Object *obj)
{
@ -482,7 +477,6 @@ _on_done(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
evas_object_del((Evas_Object*)data);
}
static void
_del(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
@ -490,7 +484,6 @@ _del(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *obj, void *event
ecore_animator_del(ani);
}
static void
_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
{
@ -561,7 +554,6 @@ _mouse_up(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *eve
gld->mouse_down = 0;
}
void
test_glview(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
@ -578,7 +570,6 @@ test_glview(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
elm_win_title_set(win, "GLView");
elm_win_autodel_set(win, EINA_TRUE);
// add a standard bg
bg = elm_bg_add(win);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@ -611,7 +602,6 @@ test_glview(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_UP, _mouse_up, gl);
evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move, gl);
// Animator and other vars
ani = ecore_animator_add(_anim, gl);
gld->glapi = elm_glview_gl_api_get(gl);
@ -619,7 +609,6 @@ test_glview(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
evas_object_data_set(gl, "gld", gld);
evas_object_event_callback_add(gl, EVAS_CALLBACK_DEL, _del, gl);
/* add an ok button */
bt = elm_button_add(win);
elm_object_text_set(bt, "OK");

View File

@ -90,32 +90,32 @@ static const Elm_Store_Item_Mapping it1_mapping[] =
static Eina_Bool
_st_store_list(void *data __UNUSED__, Elm_Store_Item_Info *item_info)
{
Elm_Store_Item_Info_Filesystem *info = (Elm_Store_Item_Info_Filesystem *)item_info;
int id;
char sort_id[7];
Elm_Store_Item_Info_Filesystem *info = (Elm_Store_Item_Info_Filesystem *)item_info;
int id;
char sort_id[7];
// create a sort id based on the filename itself assuming it is a numeric
// value like the id number in mh mail folders which is what this test
// uses as a data source
char *file = strrchr(info->path, '/');
if (file) file++;
else file = info->path;
id = atoi(file);
sort_id[0] = ((id >> 30) & 0x3f) + 32;
sort_id[1] = ((id >> 24) & 0x3f) + 32;
sort_id[2] = ((id >> 18) & 0x3f) + 32;
sort_id[3] = ((id >> 12) & 0x3f) + 32;
sort_id[4] = ((id >> 6) & 0x3f) + 32;
sort_id[5] = ((id >> 0) & 0x3f) + 32;
sort_id[6] = 0;
info->base.sort_id = strdup(sort_id);
// choose the item genlist item class to use (only item style should be
// provided by the app, store will fill everything else in, so it also
// has to be writable
info->base.item_class = &itc1; // based on item info - return the item class wanted (only style field used - rest reset to internal funcs store sets up to get label/icon etc)
info->base.mapping = it1_mapping;
info->base.data = NULL; // if we can already parse and load all of item here and want to - set this
return EINA_TRUE; // return true to include this, false not to
// create a sort id based on the filename itself assuming it is a numeric
// value like the id number in mh mail folders which is what this test
// uses as a data source
char *file = strrchr(info->path, '/');
if (file) file++;
else file = info->path;
id = atoi(file);
sort_id[0] = ((id >> 30) & 0x3f) + 32;
sort_id[1] = ((id >> 24) & 0x3f) + 32;
sort_id[2] = ((id >> 18) & 0x3f) + 32;
sort_id[3] = ((id >> 12) & 0x3f) + 32;
sort_id[4] = ((id >> 6) & 0x3f) + 32;
sort_id[5] = ((id >> 0) & 0x3f) + 32;
sort_id[6] = 0;
info->base.sort_id = strdup(sort_id);
// choose the item genlist item class to use (only item style should be
// provided by the app, store will fill everything else in, so it also
// has to be writable
info->base.item_class = &itc1; // based on item info - return the item class wanted (only style field used - rest reset to internal funcs store sets up to get label/icon etc)
info->base.mapping = it1_mapping;
info->base.data = NULL; // if we can already parse and load all of item here and want to - set this
return EINA_TRUE; // return true to include this, false not to
}
// ************************************************************************
//// * End of separate thread function. *
@ -127,90 +127,90 @@ _st_store_list(void *data __UNUSED__, Elm_Store_Item_Info *item_info)
static void
_st_store_fetch(void *data __UNUSED__, Elm_Store_Item *sti)
{
const char *path = elm_store_item_filesystem_path_get(sti);
My_Item *myit;
FILE *f;
char buf[4096], *p;
Eina_Bool have_content = EINA_FALSE;
char *content = NULL, *content_pos = NULL, *content_end = NULL;
const char *path = elm_store_item_filesystem_path_get(sti);
My_Item *myit;
FILE *f;
char buf[4096], *p;
Eina_Bool have_content = EINA_FALSE;
char *content = NULL, *content_pos = NULL, *content_end = NULL;
// if we already have my item data - skip
if (elm_store_item_data_get(sti)) return;
// open the mail file and parse it
f = fopen(path, "rb");
if (!f) return;
// if we already have my item data - skip
if (elm_store_item_data_get(sti)) return;
// open the mail file and parse it
f = fopen(path, "rb");
if (!f) return;
// alloc my item in memory that holds data to show in the list
myit = calloc(1, sizeof(My_Item));
if (!myit)
{
fclose(f);
return;
}
while (fgets(buf, sizeof(buf), f))
{
if (!have_content)
{
if (!isblank(buf[0]))
{
// get key: From:, Subject: etc.
if (!strncmp(buf, "From:", 5))
{
p = buf + 5;
while ((*p) && (isblank(*p))) p++;
p = strdup(p);
if (p)
// alloc my item in memory that holds data to show in the list
myit = calloc(1, sizeof(My_Item));
if (!myit)
{
fclose(f);
return;
}
while (fgets(buf, sizeof(buf), f))
{
if (!have_content)
{
if (!isblank(buf[0]))
{
// get key: From:, Subject: etc.
if (!strncmp(buf, "From:", 5))
{
myit->from = p;
p = strchr(p, '\n');
if (p) *p = 0;
p = buf + 5;
while ((*p) && (isblank(*p))) p++;
p = strdup(p);
if (p)
{
myit->from = p;
p = strchr(p, '\n');
if (p) *p = 0;
}
}
}
else if (!strncmp(buf, "Subject:", 8))
{
p = buf + 8;
while ((*p) && (isblank(*p))) p++;
p = strdup(p);
if (p)
else if (!strncmp(buf, "Subject:", 8))
{
myit->subject = p;
p = strchr(p, '\n');
if (p) *p = 0;
p = buf + 8;
while ((*p) && (isblank(*p))) p++;
p = strdup(p);
if (p)
{
myit->subject = p;
p = strchr(p, '\n');
if (p) *p = 0;
}
}
}
else if (!strncmp(buf, "Date:", 5))
{
p = buf + 5;
while ((*p) && (isblank(*p))) p++;
p = strdup(p);
if (p)
else if (!strncmp(buf, "Date:", 5))
{
myit->date = p;
p = strchr(p, '\n');
if (p) *p = 0;
p = buf + 5;
while ((*p) && (isblank(*p))) p++;
p = strdup(p);
if (p)
{
myit->date = p;
p = strchr(p, '\n');
if (p) *p = 0;
}
}
}
else if (buf[0] == '\n') // begin of content
have_content = EINA_TRUE;
}
}
else
{
// get first 320 bytes of content/body
if (!content)
{
content = calloc(1, 320);
content_pos = content;
content_end = content + 319;
}
strncat(content_pos, buf, content_end - content_pos - 1);
content_pos = content + strlen(content);
}
}
fclose(f);
myit->head_content = elm_entry_utf8_to_markup(content);
free(content);
elm_store_item_data_set(sti, myit);
else if (buf[0] == '\n') // begin of content
have_content = EINA_TRUE;
}
}
else
{
// get first 320 bytes of content/body
if (!content)
{
content = calloc(1, 320);
content_pos = content;
content_end = content + 319;
}
strncat(content_pos, buf, content_end - content_pos - 1);
content_pos = content + strlen(content);
}
}
fclose(f);
myit->head_content = elm_entry_utf8_to_markup(content);
free(content);
elm_store_item_data_set(sti, myit);
}
// ************************************************************************
//// * End of separate thread function. *
@ -219,57 +219,57 @@ _st_store_fetch(void *data __UNUSED__, Elm_Store_Item *sti)
static void
_st_store_unfetch(void *data __UNUSED__, Elm_Store_Item *sti)
{
My_Item *myit = elm_store_item_data_get(sti);
if (!myit) return;
if (myit->from) free(myit->from);
if (myit->subject) free(myit->subject);
if (myit->date) free(myit->date);
if (myit->head_content) free(myit->head_content);
free(myit);
elm_store_item_data_set(sti, NULL);
My_Item *myit = elm_store_item_data_get(sti);
if (!myit) return;
if (myit->from) free(myit->from);
if (myit->subject) free(myit->subject);
if (myit->date) free(myit->date);
if (myit->head_content) free(myit->head_content);
free(myit);
elm_store_item_data_set(sti, NULL);
}
void
test_store(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Evas_Object *win, *bg, *gl, *bx;
Evas_Object *win, *bg, *gl, *bx;
Elm_Store *st;
Elm_Store *st;
win = elm_win_add(NULL, "store", ELM_WIN_BASIC);
elm_win_title_set(win, "Store");
elm_win_autodel_set(win, EINA_TRUE);
win = elm_win_add(NULL, "store", ELM_WIN_BASIC);
elm_win_title_set(win, "Store");
elm_win_autodel_set(win, EINA_TRUE);
bg = elm_bg_add(win);
elm_win_resize_object_add(win, bg);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(bg);
bg = elm_bg_add(win);
elm_win_resize_object_add(win, bg);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(bg);
bx = elm_box_add(win);
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, bx);
evas_object_show(bx);
bx = elm_box_add(win);
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, bx);
evas_object_show(bx);
gl = elm_genlist_add(win);
elm_genlist_height_for_width_mode_set(gl, EINA_TRUE);
evas_object_smart_callback_add(gl, "selected", _st_selected, NULL);
evas_object_smart_callback_add(gl, "clicked,double", _st_double_clicked, NULL);
evas_object_smart_callback_add(gl, "longpressed", _st_longpress, NULL);
evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(bx, gl);
evas_object_show(gl);
gl = elm_genlist_add(win);
elm_genlist_height_for_width_mode_set(gl, EINA_TRUE);
evas_object_smart_callback_add(gl, "selected", _st_selected, NULL);
evas_object_smart_callback_add(gl, "clicked,double", _st_double_clicked, NULL);
evas_object_smart_callback_add(gl, "longpressed", _st_longpress, NULL);
evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(bx, gl);
evas_object_show(gl);
st = elm_store_filesystem_new();
elm_store_list_func_set(st, _st_store_list, NULL);
elm_store_fetch_func_set(st, _st_store_fetch, NULL);
//elm_store_fetch_thread_set(st, EINA_FALSE);
elm_store_unfetch_func_set(st, _st_store_unfetch, NULL);
elm_store_sorted_set(st, EINA_TRUE);
elm_store_target_genlist_set(st, gl);
elm_store_filesystem_directory_set(st, "./store");
st = elm_store_filesystem_new();
elm_store_list_func_set(st, _st_store_list, NULL);
elm_store_fetch_func_set(st, _st_store_fetch, NULL);
//elm_store_fetch_thread_set(st, EINA_FALSE);
elm_store_unfetch_func_set(st, _st_store_unfetch, NULL);
elm_store_sorted_set(st, EINA_TRUE);
elm_store_target_genlist_set(st, gl);
elm_store_filesystem_directory_set(st, "./store");
evas_object_resize(win, 480, 800);
evas_object_show(win);
evas_object_resize(win, 480, 800);
evas_object_show(win);
}
#endif