int main (int argc, char **argv) { const GType *otypes; guint i; gtk_test_init (&argc, &argv); pixbuf_init (); gtk_test_register_all_types(); otypes = gtk_test_list_all_types (NULL); for (i = 0; otypes[i]; i++) { gchar *testname; testname = g_strdup_printf ("/Default Values/%s", g_type_name (otypes[i])); g_test_add_data_func (testname, &otypes[i], test_type); g_free (testname); } return g_test_run(); }
int main (int argc, char **argv) { GdkWindow *root; GtkWidget *window; GtkWidget *vbox; GtkWidget *drawing_area; GdkPixbuf *pixbuf; pixbuf_init (); gtk_init (&argc, &argv); gdk_rgb_set_verbose (TRUE); gtk_widget_set_default_colormap (gdk_rgb_get_colormap ()); root = gdk_get_default_root_window (); pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL, 0, 0, 0, 0, 150, 160); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (window, "delete_event", G_CALLBACK (close_app), NULL); g_signal_connect (window, "destroy", G_CALLBACK (close_app), NULL); vbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (window), vbox); drawing_area = gtk_drawing_area_new (); gtk_widget_set_size_request (GTK_WIDGET (drawing_area), gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf)); g_signal_connect (drawing_area, "expose_event", G_CALLBACK (expose_cb), NULL); g_signal_connect (drawing_area, "configure_event", G_CALLBACK (configure_cb), NULL); g_object_set_data (G_OBJECT (drawing_area), "pixbuf", pixbuf); gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0); gtk_widget_show_all (window); gtk_main (); return 0; }
int main (int argc, char **argv) { pixbuf_init (); /* initialize test program */ gtk_test_init (&argc, &argv); /* register tests */ g_test_add_func ("/GtkFileChooser/black_box", test_black_box); g_test_add_func ("/GtkFileChooser/confirm_overwrite", test_confirm_overwrite); g_test_add_func ("/GtkFileChooser/action_widgets", test_action_widgets); g_test_add_func ("/GtkFileChooser/reload", test_reload); g_test_add_func ("/GtkFileChooser/button_folder_states", test_button_folder_states); g_test_add_func ("/GtkFileChooser/folder_switch_and_filters", test_folder_switch_and_filters); /* run and check selected tests */ return g_test_run(); }
/* --- main test program --- */ int main (int argc, char *argv[]) { const GType *otypes; guint i; /* initialize test program */ pixbuf_init (); gtk_test_init (&argc, &argv); gtk_test_register_all_types (); /* install a property test for each widget type */ otypes = gtk_test_list_all_types (NULL); for (i = 0; otypes[i]; i++) if (g_type_is_a (otypes[i], GTK_TYPE_WIDGET) && G_TYPE_IS_OBJECT (otypes[i]) && !G_TYPE_IS_ABSTRACT (otypes[i])) { gchar *testpath = g_strdup_printf ("/properties/%s", g_type_name (otypes[i])); g_test_add_data_func (testpath, (void*) otypes[i], widget_property_tests); g_free (testpath); } return g_test_run (); }
int main (int argc, char **argv) { int i; int found_valid = FALSE; GdkPixbuf *pixbuf; GdkPixbufLoader *pixbuf_loader; pixbuf_init (); gtk_init (&argc, &argv); /* gdk_rgb_set_verbose (TRUE);*/ gtk_widget_set_default_colormap (gdk_rgb_get_colormap ()); { char *tbf_readlen = getenv ("TBF_READLEN"); if (tbf_readlen) readlen = atoi (tbf_readlen); } { char *tbf_bps = getenv ("TBF_KBPS"); guint bps; if (tbf_bps) { bps = atoi (tbf_bps); g_print ("Simulating %d kBytes/sec\n", bps); readlen = (bps*1024)/10; } } i = 1; if (argc == 1) { const gchar*** xpmp; GError *error = NULL; pixbuf = gdk_pixbuf_new_from_data (default_image, GDK_COLORSPACE_RGB, FALSE, 8, DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_WIDTH * 3, NULL, NULL); new_testrgb_window (pixbuf, NULL); xpmp = xpms; while (*xpmp) { pixbuf = gdk_pixbuf_new_from_xpm_data (*xpmp); new_testrgb_window (pixbuf, NULL); ++xpmp; } /* Test loading from inline data. */ pixbuf = gdk_pixbuf_new_from_inline (-1, apple_red, FALSE, &error); if (!pixbuf) { fprintf (stderr, "failed to construct \"red apple\" pixbuf: %s\n", error->message); g_error_free (error); } else new_testrgb_window (pixbuf, "Red apple from inlined RLE data"); pixbuf = gdk_pixbuf_new_from_inline (sizeof (gnome_foot), gnome_foot, TRUE, NULL); new_testrgb_window (pixbuf, "GNOME Foot from inlined RLE data"); found_valid = TRUE; } else { for (i = 1; i < argc; i++) { GError *error; error = NULL; pixbuf = gdk_pixbuf_new_from_file (argv[i], &error); if (pixbuf == NULL) { g_warning ("Error loading image: %s", error->message); g_error_free (error); } #if 0 pixbuf = gdk_pixbuf_rotate (pixbuf, 10.0); #endif if (pixbuf) { new_testrgb_window (pixbuf, "File"); found_valid = TRUE; } } #if 1 { GtkWidget* rgb_window = NULL; ProgressFileStatus status; pixbuf_loader = gdk_pixbuf_loader_new (); status.loader = pixbuf_loader; status.rgbwin = &rgb_window; status.buf = g_malloc (readlen); #if 0 g_signal_connect (pixbuf_loader, "size_prepared", G_CALLBACK (size_func), NULL); #endif g_signal_connect (pixbuf_loader, "area_prepared", G_CALLBACK (progressive_prepared_callback), &rgb_window); g_signal_connect (pixbuf_loader, "area_updated", G_CALLBACK (progressive_updated_callback), &rgb_window); status.imagefile = fopen (argv[1], "r"); g_assert (status.imagefile != NULL); status.readlen = readlen; status.timeout = gdk_threads_add_timeout (100, update_timeout, &status); } #endif } if (found_valid) gtk_main (); return 0; }