Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/bin Modified Files: Ewl_Test.h ewl_embed_test.c ewl_simple_test.c main.c Log Message: - tabs are a tricky beast. looks like I missed some. =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/bin/Ewl_Test.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- Ewl_Test.h 6 May 2008 20:09:01 -0000 1.12 +++ Ewl_Test.h 7 May 2008 13:38:14 -0000 1.13 @@ -28,12 +28,12 @@ */ struct Ewl_Unit_Test { - const char *name; /**< The test name */ + const char *name; /**< The test name */ int (*func)(char *buf, int len); /**< The test function */ - char *failure_reason; /**< Test failure reason */ - short status; /**< Test status */ - unsigned int quiet: 1; /**< Boolean to disable stderr */ + char *failure_reason; /**< Test failure reason */ + short status; /**< Test status */ + unsigned int quiet: 1; /**< Boolean to disable stderr */ }; /** @@ -46,14 +46,14 @@ */ struct Ewl_Test { - const char *name; /**< The test name */ - const char *filename; /**< Filename of the test */ - const char *tip; /**< Tooltip for the test */ + const char *name; /**< The test name */ + const char *filename; /**< Filename of the test */ + const char *tip; /**< Tooltip for the test */ - Ecore_Plugin *plugin; /**< Dynamic file handle for test */ - Ewl_Test_Type type; /**< The type of test */ + Ecore_Plugin *plugin; /**< Dynamic file handle for test */ + Ewl_Test_Type type; /**< The type of test */ int (*func)(Ewl_Container *con); /**< The test function */ - Ewl_Unit_Test *unit_tests; /**< The test unit tests */ + Ewl_Unit_Test *unit_tests; /**< The test unit tests */ }; #endif =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/bin/ewl_embed_test.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -3 -r1.20 -r1.21 --- ewl_embed_test.c 6 May 2008 20:09:01 -0000 1.20 +++ ewl_embed_test.c 7 May 2008 13:38:14 -0000 1.21 @@ -60,9 +60,9 @@ t = ewl_text_text_get(EWL_TEXT(entry)); if (t) { - ewl_text_text_append(EWL_TEXT(text), "\n"); - ewl_text_text_append(EWL_TEXT(text), t); - ewl_text_clear(EWL_TEXT(entry)); + ewl_text_text_append(EWL_TEXT(text), "\n"); + ewl_text_text_append(EWL_TEXT(text), t); + ewl_text_clear(EWL_TEXT(entry)); } } @@ -100,12 +100,12 @@ edje = edje_object_add(evas); if (!edje_object_file_set(edje, - PACKAGE_DATA_DIR "/ewl/themes/ewl_embed_test.edj", - "main")) + PACKAGE_DATA_DIR "/ewl/themes/ewl_embed_test.edj", + "main")) { - fprintf(stderr, "Error in: %s\n", - PACKAGE_DATA_DIR "/ewl/themes/ewl_embed_test.edj"); - return 1; + fprintf(stderr, "Error in: %s\n", + PACKAGE_DATA_DIR "/ewl/themes/ewl_embed_test.edj"); + return 1; } evas_object_move(edje, 0, 0); @@ -118,7 +118,7 @@ emb = ewl_embed_new(); ewl_object_fill_policy_set(EWL_OBJECT(emb), EWL_FLAG_FILL_ALL); eo = ewl_embed_canvas_set(EWL_EMBED(emb), evas, - (void *) ecore_evas_software_x11_window_get(ee)); + (void *) ecore_evas_software_x11_window_get(ee)); ewl_embed_focus_set(EWL_EMBED(emb), TRUE); ewl_widget_show(emb); @@ -146,17 +146,17 @@ text = ewl_text_new(); ewl_container_child_append(EWL_CONTAINER(wg), text); ewl_text_text_append(EWL_TEXT(text), - "You can use EWL in side a evas/edje only app.\n" - "It can actually behave like a normal evas object\n" - "So forget to figure out how to write an entry object,\n" - "simply use the ewl widget! :)\n\n"); + "You can use EWL in side a evas/edje only app.\n" + "It can actually behave like a normal evas object\n" + "So forget to figure out how to write an entry object,\n" + "simply use the ewl widget! :)\n\n"); ewl_object_fill_policy_set(EWL_OBJECT(text), EWL_FLAG_FILL_HFILL | - EWL_FLAG_FILL_VFILL); + EWL_FLAG_FILL_VFILL); ewl_widget_show(text); c = ewl_hbox_new(); ewl_object_fill_policy_set(EWL_OBJECT(c), EWL_FLAG_FILL_NONE | - EWL_FLAG_FILL_HFILL); + EWL_FLAG_FILL_HFILL); ewl_container_child_append(EWL_CONTAINER(vbox), c); ewl_widget_show(c); @@ -180,7 +180,7 @@ emb = ewl_embed_new(); ewl_object_fill_policy_set(EWL_OBJECT(emb), EWL_FLAG_FILL_ALL); eo = ewl_embed_canvas_set(EWL_EMBED(emb), evas, - (void *) ecore_evas_software_x11_window_get(ee)); + (void *) ecore_evas_software_x11_window_get(ee)); ewl_widget_show(emb); /* @@ -194,7 +194,7 @@ c = ewl_hbox_new(); ewl_object_fill_policy_set(EWL_OBJECT(c), EWL_FLAG_FILL_NONE | - EWL_FLAG_FILL_HFILL); + EWL_FLAG_FILL_HFILL); ewl_container_child_append(EWL_CONTAINER(emb), c); ewl_widget_show(c); @@ -221,7 +221,7 @@ emb = ewl_embed_new(); ewl_object_fill_policy_set(EWL_OBJECT(emb), EWL_FLAG_FILL_ALL); eo = ewl_embed_canvas_set(EWL_EMBED(emb), evas, - (void *) ecore_evas_software_x11_window_get(ee)); + (void *) ecore_evas_software_x11_window_get(ee)); ewl_embed_focus_set(EWL_EMBED(emb), TRUE); ewl_widget_show(emb); =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/bin/ewl_simple_test.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -3 -r1.21 -r1.22 --- ewl_simple_test.c 6 May 2008 20:09:01 -0000 1.21 +++ ewl_simple_test.c 7 May 2008 13:38:14 -0000 1.22 @@ -19,7 +19,7 @@ static void edje_text(void *data, Evas_Object *obj __UNUSED__, - const char *emission, const char *source) + const char *emission, const char *source) { char *buf; char *text; @@ -27,7 +27,7 @@ Ewl_Widget *label = data; if (strstr(emission, "Present") != emission) - return; + return; text = (char *)emission + strlen("Present"); len = strlen(text); @@ -52,7 +52,7 @@ static void start_text(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__, - void *user_data) + void *user_data) { Ewl_Widget *label = user_data; @@ -65,7 +65,7 @@ ewl_text_font_set(EWL_TEXT(label), "ewl/default"); ewl_text_font_size_set(EWL_TEXT(label), 7); ewl_text_text_append(EWL_TEXT(label), "We hope you enjoy your stay.\n" - "Please visit us at:\n"); + "Please visit us at:\n"); ewl_text_color_set(EWL_TEXT(label), 0, 0, 255, 190); ewl_text_text_append(EWL_TEXT(label), "http://www.enlightenment.org/"); ewl_text_color_set(EWL_TEXT(label), 0, 0, 0, 255); @@ -75,27 +75,27 @@ reveal_logo_cb(Ewl_Widget *w, void *ev_data __UNUSED__, void *user_data) { edje_object_signal_callback_add(w->theme_object, "Present*", "*", - edje_text, user_data); + edje_text, user_data); } static void obscure_logo_cb(Ewl_Widget *w, void *ev_data __UNUSED__, - void *user_data __UNUSED__) + void *user_data __UNUSED__) { edje_object_signal_callback_del(w->theme_object, "Present*", "*", - edje_text); + edje_text); } static void close_cb(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__, - void *user_data __UNUSED__) + void *user_data __UNUSED__) { ewl_main_quit(); } static void button_down(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__, - void *user_data) + void *user_data) { Ewl_Widget *logo = user_data; ewl_widget_state_set(logo, "start_tour", EWL_STATE_PERSISTENT); @@ -105,7 +105,7 @@ static void quit_demo(Ewl_Widget *w __UNUSED__, void *ev_data __UNUSED__, - void *user_data __UNUSED__) + void *user_data __UNUSED__) { ewl_main_quit(); } =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/bin/main.c,v retrieving revision 1.100 retrieving revision 1.101 diff -u -3 -r1.100 -r1.101 --- main.c 6 May 2008 20:09:01 -0000 1.100 +++ main.c 7 May 2008 13:38:14 -0000 1.101 @@ -36,26 +36,26 @@ static Ewl_Model *expansion_model = NULL; static char *ewl_test_about_body = - "The EWL Test application serves two purposes. " - "The first is to allow us to test the different " - "components of EWL as we develop them.\n\n" - "The second is to allow deveopers to view " - "tutorials and source listings for the different " - "widgets in the system.\n\n" - "If you develop your own EWL widget you can add " - "a test to the test widget without needing to " - "recompile or edit the test application."; + "The EWL Test application serves two purposes. " + "The first is to allow us to test the different " + "components of EWL as we develop them.\n\n" + "The second is to allow deveopers to view " + "tutorials and source listings for the different " + "widgets in the system.\n\n" + "If you develop your own EWL widget you can add " + "a test to the test widget without needing to " + "recompile or edit the test application."; static char *ewl_test_help_body = - "Select the test you want from the test tree under the " - "'Tests' tab. You can then use the 'UI Tests' tab " - "to view the UI test for that widget. The 'Unit Tests' " - "tab will let you execute the available unit tests.\n\n" - "To view the source for the current test click on the " - "'Source' tab. A short tutorial on the widget will be " - "available under the 'Tutorial' tab.\n\n" - "If you encounter any bugs in the test application " - "please report them to http://bugs.enlightenment.org."; + "Select the test you want from the test tree under the " + "'Tests' tab. You can then use the 'UI Tests' tab " + "to view the UI test for that widget. The 'Unit Tests' " + "tab will let you execute the available unit tests.\n\n" + "To view the source for the current test click on the " + "'Source' tab. A short tutorial on the widget will be " + "available under the 'Tutorial' tab.\n\n" + "If you encounter any bugs in the test application " + "please report them to http://bugs.enlightenment.org."; static int ewl_test_setup_tests(void); static void ewl_test_free(Ewl_Test *test); @@ -88,13 +88,13 @@ static void ewl_test_cb_about(Ewl_Widget *w, void *ev, void *data); static void *ewl_test_cb_category_fetch(void *data, unsigned int row, - unsigned int column); + unsigned int column); static int ewl_test_cb_category_expandable(void *data, unsigned int row); static void *ewl_test_cb_category_expansion_fetch(void *data, unsigned int row); static Ewl_Model *ewl_test_cb_category_expansion_model_fetch(void *data, - unsigned int row); + unsigned int row); static void *ewl_test_cb_expansion_fetch(void *data, unsigned int row, - unsigned int column); + unsigned int column); static void ewl_test_cb_test_selected(Ewl_Widget *w, void *ev, void *data); static Ewl_Widget *cb_unit_test_header_fetch(void *data, unsigned int column); @@ -129,52 +129,52 @@ /* check for any flags before ewl_init to avoid opening the display */ for (i = 0; i < argc; i++) { - if (!strncmp(argv[i], "-list", 5)) - { - ewl_test_print_tests(); - exit(0); - } - else if (!strncmp(argv[i], "-h", 2) || - !strncmp(argv[i], "-help", 5) || - !strncmp(argv[i], "--help", 6)) - { - printf("Usage: %s [options] [test name]\n" - "\t-all\tRun tests for all widgets\n" - "\t-help\tDisplay this help text\n" - "\t-list\tPrint available tests\n" - "\t-profile\tTime test results\n" - "\t-p\tHide passed test information\n" - "\t-d\tEnable all debugging output\n" - "\t-unit\tRun unit tests\n", - argv[0]); - exit(0); - } - else if (!strncmp(argv[i], "-profile", 8)) - profile_tests = 1; - else if (!strncmp(argv[i], "-p", 2)) - hide_passed = 1; - else if (!strncmp(argv[i], "-d", 2)) - show_debug = 1; - else if (!strncmp(argv[i], "-all", 4)) - all_tests = 1; - else if (!strncmp(argv[i], "-unit", 5)) - { - unit_test = 1; - setenv("EWL_ENGINE_NAME", "evas_buffer", 1); - } + if (!strncmp(argv[i], "-list", 5)) + { + ewl_test_print_tests(); + exit(0); + } + else if (!strncmp(argv[i], "-h", 2) || + !strncmp(argv[i], "-help", 5) || + !strncmp(argv[i], "--help", 6)) + { + printf("Usage: %s [options] [test name]\n" + "\t-all\tRun tests for all widgets\n" + "\t-help\tDisplay this help text\n" + "\t-list\tPrint available tests\n" + "\t-profile\tTime test results\n" + "\t-p\tHide passed test information\n" + "\t-d\tEnable all debugging output\n" + "\t-unit\tRun unit tests\n", + argv[0]); + exit(0); + } + else if (!strncmp(argv[i], "-profile", 8)) + profile_tests = 1; + else if (!strncmp(argv[i], "-p", 2)) + hide_passed = 1; + else if (!strncmp(argv[i], "-d", 2)) + show_debug = 1; + else if (!strncmp(argv[i], "-all", 4)) + all_tests = 1; + else if (!strncmp(argv[i], "-unit", 5)) + { + unit_test = 1; + setenv("EWL_ENGINE_NAME", "evas_buffer", 1); + } } /* initialize the ewl library */ if (!ewl_init(&argc, argv)) { - printf("Unable to init Ewl.\n"); - return 1; + printf("Unable to init Ewl.\n"); + return 1; } if (!ewl_test_setup_tests()) { - printf("Unable to setup tests.\n"); - return 1; + printf("Unable to setup tests.\n"); + return 1; } if (profile_tests) start_time = ecore_time_get(); @@ -182,53 +182,53 @@ /* check for any flags */ for (i = 0; i < argc || all_tests; i++) { - Ewl_Test *t; + Ewl_Test *t; - /* see if this thing was a test to run */ - ecore_list_first_goto(tests); - while ((t = ecore_list_next(tests))) - { - if (all_tests || !strcasecmp(argv[i], t->name)) - { - if (unit_test) - ret = run_unit_tests(t); - else - run_window_test(t, MAIN_WIDTH, MAIN_HEIGHT); - - ran_test ++; - if (!all_tests) break; - } - } - if (all_tests) break; + /* see if this thing was a test to run */ + ecore_list_first_goto(tests); + while ((t = ecore_list_next(tests))) + { + if (all_tests || !strcasecmp(argv[i], t->name)) + { + if (unit_test) + ret = run_unit_tests(t); + else + run_window_test(t, MAIN_WIDTH, MAIN_HEIGHT); + + ran_test ++; + if (!all_tests) break; + } + } + if (all_tests) break; } if (profile_tests) { - end_time = ecore_time_get(); - printf("Tests completed in %.03fs\n", end_time - start_time); + end_time = ecore_time_get(); + printf("Tests completed in %.03fs\n", end_time - start_time); } /* no passed in tests, run the main test app */ if (!ran_test) { - Ewl_Test test; + Ewl_Test test; - test.name = "The Enlightened Widget Library Test App"; - test.func = create_main_test_window; - test.filename = NULL; - test.tip = NULL; + test.name = "The Enlightened Widget Library Test App"; + test.func = create_main_test_window; + test.filename = NULL; + test.tip = NULL; - run_window_test(&test, MAIN_WIDTH, MAIN_HEIGHT); + run_window_test(&test, MAIN_WIDTH, MAIN_HEIGHT); } if (!unit_test) - ewl_main(); + ewl_main(); else - ewl_shutdown(); + ewl_shutdown(); if (unit_test && !ran_test) - fprintf(stderr, "Must supply either -all parameter or test " - "name when running unit tests.\n"); + fprintf(stderr, "Must supply either -all parameter or test " + "name when running unit tests.\n"); if (tests) ecore_list_destroy(tests); if (tests_path_group) ecore_path_group_del(tests_path_group); @@ -245,24 +245,24 @@ * If stderr is already disabled, bail out early. */ if (show_debug || saved_stderr >= 0) - return; + return; /* * Open /dev/null the first time it's necessary, and maintain a * reference to it for the lifetime of the test app. */ if (null_fd < 0) - null_fd = open(NULL_PATH, O_RDONLY); + null_fd = open(NULL_PATH, O_RDONLY); if (null_fd >= 0) { - saved_stderr = dup(fileno(stderr)); + saved_stderr = dup(fileno(stderr)); - if (dup2(null_fd, fileno(stderr)) < 0) - { - close(saved_stderr); - saved_stderr = -1; - } + if (dup2(null_fd, fileno(stderr)) < 0) + { + close(saved_stderr); + saved_stderr = -1; + } } } @@ -273,7 +273,7 @@ * Return early if stderr is not disabled. */ if (show_debug || saved_stderr < 0) - return; + return; dup2(saved_stderr, fileno(stderr)); saved_stderr = -1; @@ -289,35 +289,35 @@ unit_tests = data; if (unit_tests[current_unit_test].func) { - int val; - Ewl_Widget *tree, *progress, *stat; + int val; + Ewl_Widget *tree, *progress, *stat; - stat = ewl_widget_name_find("statusbar"); - ewl_statusbar_push(EWL_STATUSBAR(stat), - (char *)unit_tests[current_unit_test].name); - if (unit_tests[current_unit_test].quiet) - ewl_test_stderr_disable(); - val = unit_tests[current_unit_test].func(buf, sizeof(buf)); - if (unit_tests[current_unit_test].quiet) - ewl_test_stderr_enable(); - ewl_statusbar_pop(EWL_STATUSBAR(stat)); - - tree = ewl_widget_name_find("unit_test_tree"); - progress = ewl_widget_name_find("unit_test_progress"); + stat = ewl_widget_name_find("statusbar"); + ewl_statusbar_push(EWL_STATUSBAR(stat), + (char *)unit_tests[current_unit_test].name); + if (unit_tests[current_unit_test].quiet) + ewl_test_stderr_disable(); + val = unit_tests[current_unit_test].func(buf, sizeof(buf)); + if (unit_tests[current_unit_test].quiet) + ewl_test_stderr_enable(); + ewl_statusbar_pop(EWL_STATUSBAR(stat)); + + tree = ewl_widget_name_find("unit_test_tree"); + progress = ewl_widget_name_find("unit_test_progress"); - unit_tests[current_unit_test].status = val; - unit_tests[current_unit_test].failure_reason = (val ? NULL : strdup(buf)); + unit_tests[current_unit_test].status = val; + unit_tests[current_unit_test].failure_reason = (val ? NULL : strdup(buf)); - ewl_mvc_dirty_set(EWL_MVC(tree), TRUE); + ewl_mvc_dirty_set(EWL_MVC(tree), TRUE); - ewl_range_value_set(EWL_RANGE(progress), - (double)(++current_unit_test)); + ewl_range_value_set(EWL_RANGE(progress), + (double)(++current_unit_test)); } else { - unit_test_timer = NULL; - current_unit_test = 0; - ret = 0; + unit_test_timer = NULL; + current_unit_test = 0; + ret = 0; } return ret; @@ -325,17 +325,17 @@ static void ewl_test_cb_delete_window(Ewl_Widget *w, void *ev __UNUSED__, - void *data __UNUSED__) + void *data __UNUSED__) { ewl_widget_destroy(w); if ((--window_count) < 1) - ewl_main_quit(); + ewl_main_quit(); } static void ewl_test_cb_exit(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, - void *data __UNUSED__) + void *data __UNUSED__) { ewl_main_quit(); } @@ -348,7 +348,7 @@ printf("Ewl_Test Test List:\n"); ecore_list_first_goto(tests); while ((t = ecore_list_next(tests))) - printf(" %s\n", t->name); + printf(" %s\n", t->name); } static void @@ -364,9 +364,9 @@ ewl_window_name_set(EWL_WINDOW(win), test->name); ewl_window_class_set(EWL_WINDOW(win), "Ewl Test Window"); ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW, - ewl_test_cb_delete_window, NULL); + ewl_test_cb_delete_window, NULL); if ((width > 0) && (height > 0)) - ewl_object_size_request(EWL_OBJECT(win), width, height); + ewl_object_size_request(EWL_OBJECT(win), width, height); ewl_widget_show(win); @@ -391,24 +391,24 @@ for (i = 0; test->unit_tests[i].func; i++) { - int ret; + int ret; - if (test->unit_tests[i].quiet) - ewl_test_stderr_disable(); + if (test->unit_tests[i].quiet) + ewl_test_stderr_disable(); - ret = test->unit_tests[i].func(buf, sizeof(buf)); - if (!ret || !hide_passed) - { - printf("Running %s: ", test->unit_tests[i].name); - printf("%s %s\n", (ret ? "PASSED" : "FAILED"), - (ret ? "" : buf)); - } - buf[0] = '\0'; + ret = test->unit_tests[i].func(buf, sizeof(buf)); + if (!ret || !hide_passed) + { + printf("Running %s: ", test->unit_tests[i].name); + printf("%s %s\n", (ret ? "PASSED" : "FAILED"), + (ret ? "" : buf)); + } + buf[0] = '\0'; - if (!ret) failures++; + if (!ret) failures++; - if (test->unit_tests[i].quiet) - ewl_test_stderr_enable(); + if (test->unit_tests[i].quiet) + ewl_test_stderr_enable(); } return failures; @@ -459,9 +459,9 @@ /* make sure we have a function if we aren't a straight unit test */ if ((t->type != EWL_TEST_TYPE_UNIT) && (!t->func)) { - printf("WARNING: No UI test function defined for (%s).\n", - t->name); - return; + printf("WARNING: No UI test function defined for (%s).\n", + t->name); + return; } c = ewl_widget_name_find("execute_box"); @@ -495,27 +495,27 @@ while ((name = ecore_list_first_goto(list))) { - Ecore_Plugin *plugin; - void (*func_info)(Ewl_Test *test); + Ecore_Plugin *plugin; + void (*func_info)(Ewl_Test *test); - plugin = ecore_plugin_load(tests_path_group, name, NULL); - if (!plugin) - continue; - - - /* the UI test info */ - func_info = ecore_plugin_symbol_get(plugin, "test_info"); - if (func_info) - { - Ewl_Test *t; - - t = calloc(1, sizeof(Ewl_Test)); - func_info(t); - t->plugin = plugin; - ecore_list_append(tests, t); - } + plugin = ecore_plugin_load(tests_path_group, name, NULL); + if (!plugin) + continue; + + + /* the UI test info */ + func_info = ecore_plugin_symbol_get(plugin, "test_info"); + if (func_info) + { + Ewl_Test *t; + + t = calloc(1, sizeof(Ewl_Test)); + func_info(t); + t->plugin = plugin; + ecore_list_append(tests, t); + } - ecore_list_remove_destroy(list); + ecore_list_remove_destroy(list); } ecore_list_destroy(list); @@ -524,7 +524,7 @@ /* sort the tests in alphabetical order */ ecore_list_sort(tests, ECORE_COMPARE_CB(ewl_test_compare), - ECORE_SORT_MIN); + ECORE_SORT_MIN); return 1; } @@ -553,28 +553,28 @@ Ewl_View *view; Ewl_Menu_Info file_menu[] = { - {"Exit", NULL, ewl_test_cb_exit}, - {NULL, NULL, NULL} + {"Exit", NULL, ewl_test_cb_exit}, + {NULL, NULL, NULL} }; Ewl_Menu_Info help_menu[] = { - {"About Ewl_Test ...", NULL, ewl_test_cb_about}, - {"Ewl Test Help ...", NULL, ewl_test_cb_help}, - {NULL, NULL, NULL} + {"About Ewl_Test ...", NULL, ewl_test_cb_about}, + {"Ewl Test Help ...", NULL, ewl_test_cb_help}, + {NULL, NULL, NULL} }; Ewl_Menubar_Info menubar_info[] = { - {"File", file_menu}, - {"Help", help_menu}, - {NULL, NULL} + {"File", file_menu}, + {"Help", help_menu}, + {NULL, NULL} }; file_menu[0].img = ewl_icon_theme_icon_path_get(EWL_ICON_APPLICATION_EXIT, - EWL_ICON_SIZE_SMALL); + EWL_ICON_SIZE_SMALL); help_menu[0].img = ewl_icon_theme_icon_path_get(EWL_ICON_HELP_ABOUT, - EWL_ICON_SIZE_SMALL); + EWL_ICON_SIZE_SMALL); help_menu[1].img = ewl_icon_theme_icon_path_get(EWL_ICON_HELP_FAQ, - EWL_ICON_SIZE_SMALL); + EWL_ICON_SIZE_SMALL); menubar = ewl_hmenubar_new(); ewl_container_child_append(EWL_CONTAINER(box), menubar); @@ -585,7 +585,7 @@ ewl_container_child_append(box, note); ewl_widget_name_set(note, "test_notebook"); ewl_notebook_tabbar_alignment_set(EWL_NOTEBOOK(note), - EWL_FLAG_ALIGN_CENTER); + EWL_FLAG_ALIGN_CENTER); ewl_widget_show(note); /* our data will be a list of lists. each of the child lists will @@ -613,11 +613,11 @@ ewl_model_data_count_set(model, ewl_model_cb_ecore_list_count); ewl_model_data_expandable_set(model, ewl_test_cb_category_expandable); ewl_model_data_unref_set(model, - EWL_MODEL_DATA_UNREF(ecore_list_destroy)); + EWL_MODEL_DATA_UNREF(ecore_list_destroy)); ewl_model_expansion_data_fetch_set(model, - ewl_test_cb_category_expansion_fetch); + ewl_test_cb_category_expansion_fetch); ewl_model_expansion_model_fetch_set(model, - ewl_test_cb_category_expansion_model_fetch); + ewl_test_cb_category_expansion_model_fetch); tree = ewl_tree_new(); ewl_container_child_append(EWL_CONTAINER(note), tree); @@ -629,9 +629,9 @@ ewl_mvc_view_set(EWL_MVC(tree), ewl_label_view_get()); ewl_mvc_data_set(EWL_MVC(tree), categories); ewl_callback_append(tree, EWL_CALLBACK_VALUE_CHANGED, - ewl_test_cb_test_selected, NULL); + ewl_test_cb_test_selected, NULL); ewl_callback_append(tree, EWL_CALLBACK_DESTROY, ewl_cb_mvc_free, - NULL); + NULL); ewl_widget_show(tree); @@ -639,25 +639,25 @@ ecore_list_first_goto(tests); while ((t = ecore_list_next(tests))) { - Ecore_List *parent = NULL; + Ecore_List *parent = NULL; - if (t->type == EWL_TEST_TYPE_SIMPLE) - parent = simple; - else if (t->type == EWL_TEST_TYPE_ADVANCED) - parent = adv; - else if (t->type == EWL_TEST_TYPE_CONTAINER) - parent = container; - else if (t->type == EWL_TEST_TYPE_MISC) - parent = misc; - else if (t->type == EWL_TEST_TYPE_UNIT) - parent = unit; - - ecore_list_append(parent, t); - - /* if we've got unit tests add to the unit category */ - if ((parent != unit) && - (t->unit_tests && t->unit_tests[0].func)) - ecore_list_append(unit, t); + if (t->type == EWL_TEST_TYPE_SIMPLE) + parent = simple; + else if (t->type == EWL_TEST_TYPE_ADVANCED) + parent = adv; + else if (t->type == EWL_TEST_TYPE_CONTAINER) + parent = container; + else if (t->type == EWL_TEST_TYPE_MISC) + parent = misc; + else if (t->type == EWL_TEST_TYPE_UNIT) + parent = unit; + + ecore_list_append(parent, t); + + /* if we've got unit tests add to the unit category */ + if ((parent != unit) && + (t->unit_tests && t->unit_tests[0].func)) + ecore_list_append(unit, t); } o = ewl_vbox_new(); @@ -688,7 +688,7 @@ ewl_mvc_view_set(EWL_MVC(o2), view); ewl_widget_name_set(o2, "unit_test_tree"); ewl_callback_append(o2, EWL_CALLBACK_DESTROY, ewl_cb_mvc_free, - NULL); + NULL); ewl_widget_show(o2); o2 = ewl_hbox_new(); @@ -740,7 +740,7 @@ o2 = ewl_label_new(); ewl_container_child_append(EWL_CONTAINER(o), o2); ewl_callback_append(EWL_WIDGET(box), EWL_CALLBACK_MOUSE_MOVE, - statusbar_label_update, o2); + statusbar_label_update, o2); ewl_widget_show(o2); return 1; @@ -765,7 +765,7 @@ char filename[PATH_MAX]; snprintf(filename, sizeof(filename), - PACKAGE_DATA_DIR "/ewl/examples/%s", test->filename); + PACKAGE_DATA_DIR "/ewl/examples/%s", test->filename); txt = read_file(filename); text_parse(txt); @@ -783,7 +783,7 @@ if ((p != NULL) && (*p != '\0')) *p = '\0'; snprintf(filename, sizeof(filename), - PACKAGE_DATA_DIR "/ewl/tutorials/%s.dox", file); + PACKAGE_DATA_DIR "/ewl/tutorials/%s.dox", file); txt = read_file(filename); tutorial_parse(txt); @@ -798,52 +798,52 @@ if (ecore_file_exists(filename)) { - FILE *file; + FILE *file; - file = fopen(filename, "r"); - if (!file) return NULL; + file = fopen(filename, "r"); + if (!file) return NULL; - stat(filename, &buf); + stat(filename, &buf); - str = malloc(sizeof(char) * (buf.st_size + 1)); - fread(str, buf.st_size, 1, file); - str[buf.st_size] = '\0'; - fclose(file); + str = malloc(sizeof(char) * (buf.st_size + 1)); + fread(str, buf.st_size, 1, file); + str[buf.st_size] = '\0'; + fclose(file); } else { - gzFile file; - unsigned int size, step, len = 0; - char path[PATH_MAX]; - int ret; - - /* let see if a compressed version exists */ - snprintf(path, sizeof(path), "%s.gz", filename); - if (!ecore_file_exists(path)) return NULL; - - file = gzopen(path, "rb"); - if (!file) return NULL; - - stat(filename, &buf); - - step = buf.st_size; - size = step * 4; - str = malloc(sizeof(char) * (size + 1)); - while ((ret = gzread(file, str + (size - 4 * step), step))) - { - if (ret < 0) - { - fprintf(stderr, "Could not open gzipped file\n"); - gzclose(file); - free(str); - return NULL; - } - size += step; - str = realloc(str, sizeof(char) * (size + 1)); - len += ret; - } - str[len] = '\0'; - gzclose(file); + gzFile file; + unsigned int size, step, len = 0; + char path[PATH_MAX]; + int ret; + + /* let see if a compressed version exists */ + snprintf(path, sizeof(path), "%s.gz", filename); + if (!ecore_file_exists(path)) return NULL; + + file = gzopen(path, "rb"); + if (!file) return NULL; + + stat(filename, &buf); + + step = buf.st_size; + size = step * 4; + str = malloc(sizeof(char) * (size + 1)); + while ((ret = gzread(file, str + (size - 4 * step), step))) + { + if (ret < 0) + { + fprintf(stderr, "Could not open gzipped file\n"); + gzclose(file); + free(str); + return NULL; + } + size += step; + str = realloc(str, sizeof(char) * (size + 1)); + len += ret; + } + str[len] = '\0'; + gzclose(file); } return str; } @@ -866,11 +866,11 @@ ewl_mvc_data_set(EWL_MVC(tree), current_test); for (i = 0; test->unit_tests[i].func; i++) { - if (test->unit_tests[i].failure_reason) - free(test->unit_tests[i].failure_reason); - test->unit_tests[i].failure_reason = NULL; + if (test->unit_tests[i].failure_reason) + free(test->unit_tests[i].failure_reason); + test->unit_tests[i].failure_reason = NULL; - test->unit_tests[i].status = -1; + test->unit_tests[i].status = -1; } ewl_mvc_dirty_set(EWL_MVC(tree), TRUE); @@ -882,7 +882,7 @@ static void cb_run_unit_tests(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, - void *data __UNUSED__) + void *data __UNUSED__) { int i; Ewl_Test *test; @@ -894,7 +894,7 @@ if ((!test) || (!test->unit_tests)) return; for (i = 0; test->unit_tests[i].func; i++) - ; + ; progress = ewl_widget_name_find("unit_test_progress"); ewl_range_maximum_value_set(EWL_RANGE(progress), (double)(i)); @@ -902,13 +902,13 @@ if (unit_test_timer) { - ecore_timer_del(unit_test_timer); - unit_test_timer = NULL; - current_unit_test = 0; + ecore_timer_del(unit_test_timer); + unit_test_timer = NULL; + current_unit_test = 0; } unit_test_timer = ecore_timer_add(0.1, ewl_test_cb_unit_test_timer, - test->unit_tests); + test->unit_tests); } static void @@ -925,10 +925,10 @@ txt = ewl_io_manager_string_read(str, "text/c"); if (txt) { - ewl_text_wrap_set(EWL_TEXT(txt), EWL_TEXT_WRAP_WORD); - ewl_text_selectable_set(EWL_TEXT(txt), TRUE); - ewl_widget_show(txt); - ewl_container_child_append(EWL_CONTAINER(txtpane), txt); + ewl_text_wrap_set(EWL_TEXT(txt), EWL_TEXT_WRAP_WORD); + ewl_text_selectable_set(EWL_TEXT(txt), TRUE); + ewl_widget_show(txt); + ewl_container_child_append(EWL_CONTAINER(txtpane), txt); } } @@ -953,198 +953,198 @@ while (start && (*start != '\0')) { - int did_newline = 0; + int did_newline = 0; - /* we strip out newlines so the text will wrap nicely */ - if (*end == '\n') - { - /* we just handled a \n and got a second one so this is a new - * paragraph so actually insert the two \n's */ - if (handled_newline) - { - if (in_codeblock || not_double) - ewl_text_text_append(tutorial, "\n"); - else - ewl_text_text_append(tutorial, "\n\n"); - } - - /* append the text before and skip the newline */ - else - { - char tmp; - - tmp = *(end + 1); - *(end + 1) = '\0'; - - if (!in_codeblock) - *end = ' '; - - ewl_text_text_append(tutorial, start); - - *(end + 1) = tmp; - } - start = ++end; - did_newline = 1; - not_double = 0; - } - - /* The * is only special after a newline character */ - else if ((*end == '*' || *end == ' ' || *end == '/') && handled_newline) - { - if (*end == ' ') end++; - while (*end == '*') end++; - - /* we only want to skip "* " if in a code block */ - if (in_codeblock) - { - if (*end == ' ') end ++; - } - /* otherwise skip the * and all spaces */ - else - { - while ((*end == '*') || (*end == ' ') || - (*end == '/') || (*end == '\t')) - end++; - } - - if (*end == '\n') - /* don't let the *'s at the begining of lines effect the \n - * handling */ - did_newline = handled_newline; - - start = end; - } - else if (*end == '@') - { - /* stick on everything before the @ symbol. If we don't have a - * keyword here we'll just end up sticking the next chunk onto - * this node so shouldn't be a big deal */ - *end = '\0'; - - ewl_text_text_append(tutorial, start); - *end = '@'; - start = end; - - if ((!strncasecmp(end, "@addtogroup ", 12)) - || (!strncasecmp(end, "@section ", 9))) - { - char tmp, key; - int size = 14; - - key = *(end + 1); - end += 9; - - /* we increment end so that we can skip over the keyword and - * the space after it */ - if (key == 'a') - { - size = 22; - end += 3; - } - - while (*end == ' ') end ++; - start = end; - - /* skip to the end of the line */ - end = strchr(end, '\n'); - - /* if this is the section header we need to skip - * the section name */ - if (key == 's') - { - while (!isspace(*start)) start ++; - while (*start == ' ') start ++; - } - - not_double = 1; - - tmp = *(end + 1); - *(end + 1) = '\0'; - - ewl_text_font_size_set(tutorial, size); - ewl_text_text_append(tutorial, start); - ewl_text_font_size_set(tutorial, 12); - - *(end + 1) = tmp; - start = ++end; - - did_newline = 1; - } - else if (!strncasecmp(end, "@code", 5)) - { - in_codeblock = 1; - end += 5; - while (*end == ' ') end ++; - - /* if there is nothing after the @code we want to skip the - * \n or we'll end up with too much space before the block */ - if (*end == '\n') - { - end ++; - did_newline = 1; - } - - ewl_text_color_set(tutorial, 32, 71, 109, 255); - ewl_text_font_set(tutorial, "ewl/monospace"); - start = end; - } - else if (!strncasecmp(end, "@endcode", 8)) - { - *end = '\0'; - - ewl_text_text_append(tutorial, start); - ewl_text_color_set(tutorial, 0, 0, 0, 255); - in_codeblock = 0; - - end += 8; - while (*end == ' ') end ++; - - /* if there is nothing after the @code we want to skip the - * \n or we'll end up with too much space before the block */ - if (*end == '\n') - { - end ++; - did_newline = 1; - } - not_double = 1; - start = end; - } + /* we strip out newlines so the text will wrap nicely */ + if (*end == '\n') + { + /* we just handled a \n and got a second one so this is a new + * paragraph so actually insert the two \n's */ + if (handled_newline) + { + if (in_codeblock || not_double) + ewl_text_text_append(tutorial, "\n"); + else + ewl_text_text_append(tutorial, "\n\n"); + } + + /* append the text before and skip the newline */ + else + { + char tmp; + + tmp = *(end + 1); + *(end + 1) = '\0'; + + if (!in_codeblock) + *end = ' '; + + ewl_text_text_append(tutorial, start); + + *(end + 1) = tmp; + } + start = ++end; + did_newline = 1; + not_double = 0; + } + + /* The * is only special after a newline character */ + else if ((*end == '*' || *end == ' ' || *end == '/') && handled_newline) + { + if (*end == ' ') end++; + while (*end == '*') end++; + + /* we only want to skip "* " if in a code block */ + if (in_codeblock) + { + if (*end == ' ') end ++; + } + /* otherwise skip the * and all spaces */ + else + { + while ((*end == '*') || (*end == ' ') || + (*end == '/') || (*end == '\t')) + end++; + } + + if (*end == '\n') + /* don't let the *'s at the begining of lines effect the \n + * handling */ + did_newline = handled_newline; + + start = end; + } + else if (*end == '@') + { + /* stick on everything before the @ symbol. If we don't have a + * keyword here we'll just end up sticking the next chunk onto + * this node so shouldn't be a big deal */ + *end = '\0'; + + ewl_text_text_append(tutorial, start); + *end = '@'; + start = end; + + if ((!strncasecmp(end, "@addtogroup ", 12)) + || (!strncasecmp(end, "@section ", 9))) + { + char tmp, key; + int size = 14; + + key = *(end + 1); + end += 9; + + /* we increment end so that we can skip over the keyword and + * the space after it */ + if (key == 'a') + { + size = 22; + end += 3; + } + + while (*end == ' ') end ++; + start = end; + + /* skip to the end of the line */ + end = strchr(end, '\n'); + + /* if this is the section header we need to skip + * the section name */ + if (key == 's') + { + while (!isspace(*start)) start ++; + while (*start == ' ') start ++; + } + + not_double = 1; + + tmp = *(end + 1); + *(end + 1) = '\0'; + + ewl_text_font_size_set(tutorial, size); + ewl_text_text_append(tutorial, start); + ewl_text_font_size_set(tutorial, 12); + + *(end + 1) = tmp; + start = ++end; + + did_newline = 1; + } + else if (!strncasecmp(end, "@code", 5)) + { + in_codeblock = 1; + end += 5; + while (*end == ' ') end ++; + + /* if there is nothing after the @code we want to skip the + * \n or we'll end up with too much space before the block */ + if (*end == '\n') + { + end ++; + did_newline = 1; + } + + ewl_text_color_set(tutorial, 32, 71, 109, 255); + ewl_text_font_set(tutorial, "ewl/monospace"); + start = end; + } + else if (!strncasecmp(end, "@endcode", 8)) + { + *end = '\0'; + + ewl_text_text_append(tutorial, start); + ewl_text_color_set(tutorial, 0, 0, 0, 255); + in_codeblock = 0; + + end += 8; + while (*end == ' ') end ++; + + /* if there is nothing after the @code we want to skip the + * \n or we'll end up with too much space before the block */ + if (*end == '\n') + { + end ++; + did_newline = 1; + } + not_double = 1; + start = end; + } #if 0 - else if (!strncasecmp(end, "@note", 5)) - { + else if (!strncasecmp(end, "@note", 5)) + { - } - /* make next word bold */ - else if (!strncasecmp(end, "@b ", 3)) - { - } - /* supost to be typewriter font, make next word italic */ - else if (!strncasecmp(end, "@c ", 3)) - { - } + } + /* make next word bold */ + else if (!strncasecmp(end, "@b ", 3)) + { + } + /* supost to be typewriter font, make next word italic */ + else if (!strncasecmp(end, "@c ", 3)) + { + } #endif - /* if we don't know what it is just write it into the text */ - else - end ++; - } - else if (*end == '<') - { - if (0) - { - } - /* skip it if we don't know what it is */ - else - end ++; - } - else - end ++; - - handled_newline = did_newline; - if (!end || (*end == '\0')) - { - ewl_text_text_append(tutorial, start); - start = end; - } + /* if we don't know what it is just write it into the text */ + else + end ++; + } + else if (*end == '<') + { + if (0) + { + } + /* skip it if we don't know what it is */ + else + end ++; + } + else + end ++; + + handled_newline = did_newline; + if (!end || (*end == '\0')) + { + ewl_text_text_append(tutorial, start); + start = end; + } } } @@ -1160,7 +1160,7 @@ ewl_window_class_set(EWL_WINDOW(win), "ewl_test"); ewl_window_name_set(EWL_WINDOW(win), "ewl_test"); ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW, - ewl_test_cb_delete_window, NULL); + ewl_test_cb_delete_window, NULL); ewl_object_size_request(EWL_OBJECT(win), 400, 400); ewl_widget_show(win); @@ -1187,36 +1187,36 @@ static void ewl_test_cb_help(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, - void *data __UNUSED__) + void *data __UNUSED__) { ewl_test_create_info_window("Ewl Test Help", ewl_test_help_body); } static void ewl_test_cb_about(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, - void *data __UNUSED__) + void *data __UNUSED__) { ewl_test_create_info_window("Ewl Test About", ewl_test_about_body); } static void * ewl_test_cb_category_fetch(void *data __UNUSED__, unsigned int row, - unsigned int column __UNUSED__) + unsigned int column __UNUSED__) { switch(row) { - case 0: return "Simple"; - case 1: return "Advanced"; - case 2: return "Container"; - case 3: return "Misc"; - case 4: return "Unit"; + case 0: return "Simple"; + case 1: return "Advanced"; + case 2: return "Container"; + case 3: return "Misc"; + case 4: return "Unit"; } return "ERROR"; } static int ewl_test_cb_category_expandable(void *data __UNUSED__, - unsigned int row __UNUSED__) + unsigned int row __UNUSED__) { return 1; } @@ -1230,7 +1230,7 @@ static Ewl_Model * ewl_test_cb_category_expansion_model_fetch(void *data __UNUSED__, - unsigned int row __UNUSED__) + unsigned int row __UNUSED__) { if (expansion_model) return expansion_model; @@ -1243,7 +1243,7 @@ static void * ewl_test_cb_expansion_fetch(void *data, unsigned int row, - unsigned int column __UNUSED__) + unsigned int column __UNUSED__) { Ewl_Test *test; @@ -1255,7 +1255,7 @@ static void ewl_test_cb_test_selected(Ewl_Widget *w, void *ev __UNUSED__, - void *data __UNUSED__) + void *data __UNUSED__) { Ecore_List *tree_data, *unit; Ewl_Selection_Idx *sel; @@ -1264,26 +1264,26 @@ tree_data = ewl_mvc_data_get(EWL_MVC(w)); sel = ewl_mvc_selected_get(EWL_MVC(w)); if (!sel) - goto EXIT_CALLBACK; + goto EXIT_CALLBACK; /* don't care about the top level rows */ if (tree_data == sel->sel.data) - goto CLEAR_SELECTION; + goto CLEAR_SELECTION; /* get the test */ ecore_list_index_goto(sel->sel.data, sel->row); test = ecore_list_current(sel->sel.data); if (!test) - goto FREE_SELECTION; + goto FREE_SELECTION; /* we need to determine if this is the unit test case. if it is we * need to treat it specially */ ecore_list_last_goto(tree_data); unit = ecore_list_current(tree_data); if (unit == sel->sel.data) - run_unit_test_boxed(test); + run_unit_test_boxed(test); else - run_test_boxed(test); + run_test_boxed(test); CLEAR_SELECTION: ewl_mvc_selected_clear(EWL_MVC(w)); @@ -1297,10 +1297,10 @@ cb_unit_test_header_data_fetch(void *data __UNUSED__, unsigned int column) { if (column == 0) - return "Test"; + return "Test"; if (column == 1) - return "Status"; + return "Status"; return "Failure Reason"; } @@ -1324,14 +1324,14 @@ t = data; if (column == 0) - return (void *)t->unit_tests[row].name; + return (void *)t->unit_tests[row].name; else if (column == 1) - return ((t->unit_tests[row].status < 0) ? "" : - (t->unit_tests[row].status == 0) ? "FAIL" : "PASS"); + return ((t->unit_tests[row].status < 0) ? "" : + (t->unit_tests[row].status == 0) ? "FAIL" : "PASS"); else - return t->unit_tests[row].failure_reason; + return t->unit_tests[row].failure_reason; } static unsigned int @@ -1344,7 +1344,7 @@ if (!data) return 0; for (i = 0; t->unit_tests[i].func; i++) - ; + ; return i; } ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs