int main (void) { int n; SRunner *sr; fork_setup(); setup_fixture(); sr = srunner_create (make_master_suite()); srunner_add_suite(sr, make_list_suite()); srunner_add_suite(sr, make_msg_suite()); srunner_add_suite(sr, make_log_suite()); srunner_add_suite(sr, make_limit_suite()); srunner_add_suite(sr, make_fork_suite()); srunner_add_suite(sr, make_fixture_suite()); srunner_add_suite(sr, make_pack_suite()); setup(); printf ("Ran %d tests in subordinate suite\n", sub_ntests); srunner_run_all (sr, CK_VERBOSE); cleanup(); fork_teardown(); teardown_fixture(); n = srunner_ntests_failed(sr); srunner_free(sr); return (n == 0) ? EXIT_SUCCESS : EXIT_FAILURE; }
void test_xdg_misc() { setup_fixture(); // the really icon path is determined by theme void set_default_theme(const char* theme); // deal with the NotShowIn/OnlyShowIn filed. void set_desktop_env_name(const char* name); // change the desktop file 's current locale name to "name" gboolean change_desktop_entry_name(const char* path, const char* name); // convert the icon name to the really icon path, seea also "set_default_theme" char* icon_name_to_path(const char* name, int size); char* icon_name_to_path_with_check_xpm(const char* name, int size); char* lookup_icon_by_gicon(GIcon* icon); //--------templates--------// char * nautilus_get_xdg_dir (const char *type); gboolean nautilus_should_use_templates_directory (void); char * nautilus_get_templates_directory (void); char * nautilus_get_templates_directory_uri (void); void nautilus_create_templates_directory (void); ArrayContainer natilus_get_templates_files(void); #if 0 Test({ char* c = nautilus_get_templates_directory_uri(); g_message("%s",c); g_free(c); }, "nautilus_get_templates_directory_uri");
void test_desktop() { setup_fixture(); JSObjectRef desktop_get_desktop_entries(); Test({ JSObjectRef desktop_get_desktop_entries(); }, "desktop_get_desktop_entries");
void test_utils() { setup_fixture(); // typedef void Entry; void desktop_run_terminal(); Test({ desktop_run_terminal(); }, "desktop_run_terminal");
void test_inotify_item() { setup_fixture(); #if TEST_OK gboolean desktop_file_filter(const char *file_name); Test({ g_assert(FALSE == desktop_file_filter("snyh.txt")); g_assert(TRUE == desktop_file_filter(".snyh.txt")); g_assert(TRUE == desktop_file_filter("snyh.txt~")); }, "desktop_file_filter");
void test_entry() { setup_fixture(); #if 0 extern Entry* dentry_get_desktop(); Test({ Entry* e = dentry_get_desktop(); g_object_unref(e); },"dentry_get_desktop");
void test_lib_utils() { setup_fixture(); extern char* dcore_gen_id(const char* seed); const char* dcore_gettext(const char* c); const char* dcore_dgettext(char const* domain, char const* s); void dcore_bindtextdomain(char const* domain, char const* mo_file); Test({ char* c = dcore_gen_id("1000"); g_free(c); }, "dcore_gen_id");
void test_mime_actions() { setup_fixture(); extern void desktop_run_in_terminal(char* executable); extern char* dentry_get_uri(Entry* e); Test({ GFile* f = g_file_new_for_uri("file:///tmp/test_files/skype.desktop"); char* s = dentry_get_uri(f); // desktop_run_in_terminal(s);//Warning:!!!!! : don't test it , it will open terminal alltimes g_free(s); g_object_unref(f); },"desktop_run_in_terminal");
static void zeros_setup_fixture() { setup_fixture("Zeros"); }
static void simple_setup_fixture() { setup_fixture("Simple"); }
static void empty_setup_fixture() { setup_fixture("Empty"); }
static void hard_setup_fixture() { setup_fixture("Hard"); }
void test_background_util() { setup_fixture(); Test({ },"test_"); typedef struct _xfade_data { //all in seconds. gdouble start_time; gdouble total_duration; gdouble interval; cairo_surface_t* fading_surface; GdkPixbuf* end_pixbuf; gdouble alpha; Pixmap pixmap; } xfade_data_t; GdkScreen *screen = NULL; Display *display = NULL; screen = gdk_screen_get_default(); gint number = gdk_screen_get_number(screen); gint width = gdk_screen_get_width(screen); gint height = gdk_screen_get_height(screen); display = XOpenDisplay(gdk_display_get_name(gdk_screen_get_display(screen))); Pixmap pixmap = XCreatePixmap (display, RootWindow(display, number), width, height, DefaultDepth(display, number)); cairo_surface_t *get_surface(Pixmap); xfade_data_t *data = g_slice_new(xfade_data_t); data->pixmap = pixmap; data->fading_surface = get_surface(pixmap); data->end_pixbuf = gdk_pixbuf_new_from_file(file1, NULL); // _update_rootpmap Successful. /* extern void _update_rootpmap(); */ /* Test({ */ /* _update_rootpmap(pixmap); */ /* }, "_update_rootpmap"); */ // on_tick Successful. /* extern void on_tick(xfade_data_t *data); */ /* Test({ */ /* on_tick(data); */ /* }, "on_tick"); */ // draw_background Successful. /* extern void draw_background(xfade_data_t *data); */ /* Test({ */ /* draw_background(data); */ /* }, "draw_background"); */ g_object_unref(data->end_pixbuf); cairo_surface_destroy(data->fading_surface); g_free(data); // remove_timers Successful. /* extern void remove_timers(); */ /* Test({ */ /* remove_timers(); */ /* }, "remove_timers"); */ // get_current_picture_path Successful. /* extern const char *get_current_picture_path(); */ /* Test({ */ /* get_current_picture_path(); */ /* }, "get_current_picture_path"); */ // get_next_picture_index Successful. /* extern guint get_next_picture_index(); */ /* Test({ */ /* get_next_picture_index(); */ /* }, "get_next_picture_index"); */ // get_next_picture_path Successful. /* extern const char *get_next_picture_path(); */ /* Test({ */ /* get_next_picture_path(); */ /* }, "get_next_picture_path"); */ // get_xformed_gdk_pixbuf Succcessful. extern GdkPixbuf *get_xformed_gdk_pixbuf(const char *path); /* Test({ */ /* const gchar *path = get_current_picture_path(); */ /* GdkPixbuf *pixbuf = get_xformed_gdk_pixbuf(path); */ /* g_object_unref(pixbuf); */ /* }, "get_xformed_gdk_pixbuf"); */ // on_bg_duration_tick Successful. extern gboolean on_bg_duration_tick(gpointer data); Test({ on_bg_duration_tick(NULL); }, "on_bg_duration_tick");