Пример #1
0
int
main (int argc, char **argv)
{
  const GType *otypes;
  guint i;
  gchar *schema_dir;
  GTestDBus *bus;
  GMainLoop *loop;
  gint result;

  /* These must be set before before gtk_test_init */
  g_setenv ("GIO_USE_VFS", "local", TRUE);
  g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
  g_setenv ("G_ENABLE_DIAGNOSTIC", "0", TRUE);

  gtk_test_init (&argc, &argv);
  gtk_test_register_all_types();

  /* g_test_build_filename must be called after gtk_test_init */
  schema_dir = g_test_build_filename (G_TEST_BUILT, "", NULL);
  g_setenv ("GSETTINGS_SCHEMA_DIR", schema_dir, TRUE);

  /* Create one test bus for all tests, as we have a lot of very small
   * and quick tests.
   */
  bus = g_test_dbus_new (G_TEST_DBUS_NONE);
  g_test_dbus_up (bus);

  otypes = gtk_test_list_all_types (NULL);
  for (i = 0; otypes[i]; i++)
    {
      gchar *testname;

      if (otypes[i] == GTK_TYPE_FILE_CHOOSER_NATIVE)
        continue;

      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);
    }

  result = g_test_run();

  /* Work around the annoying issue that g_test_dbus_down is giving
   * us an "Error while sending AddMatch" that comes out of an idle
   */
  loop = g_main_loop_new (NULL, FALSE);
  g_timeout_add (1000, (GSourceFunc)g_main_loop_quit, loop);
  g_main_loop_run (loop);
  g_main_loop_unref (loop);

  g_test_dbus_down (bus);
  g_object_unref (bus);
  g_free (schema_dir);

  return result;
}
Пример #2
0
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();
}
Пример #3
0
int
main (int   argc,
      char *argv[])
{
  gtk_test_init (&argc, &argv);
  gtk_test_register_all_types();
  g_test_add_func ("/ui-tests/text-access", test_text_access);
  g_test_add_func ("/ui-tests/button-clicks", test_button_clicks);
  g_test_add_func ("/ui-tests/keys-events", test_button_keys);
  g_test_add_func ("/ui-tests/slider-ranges", test_slider_ranges);
  g_test_add_func ("/ui-tests/xserver-sync", test_xserver_sync);
  g_test_add_func ("/ui-tests/spin-button-arrows", test_spin_button_arrows);
  return g_test_run();
}
Пример #4
0
int
main (int argc, char *argv[])
{
    gtk_test_init (&argc, &argv);
    g_test_bug_base ("http://bugzilla.gnome.org/");
    gtk_test_register_all_types();

    g_test_add_func ("/tests/iconview-new", test_iconview_new);
    g_test_add_func ("/tests/iconview-new-with-area", test_iconview_new_with_area);
    g_test_add_func ("/tests/iconview-object-new", test_iconview_object_new);
    g_test_add_func ("/tests/iconview-subclass0", test_iconview_subclass0);
    g_test_add_func ("/tests/iconview-subclass1", test_iconview_subclass1);
    g_test_add_func ("/tests/iconview-subclass2", test_iconview_subclass2);
    g_test_add_func ("/tests/iconview-subclass3", test_iconview_subclass3);

    g_test_add_func ("/tests/combobox-new", test_combobox_new);
    g_test_add_func ("/tests/combobox-new-with-area", test_combobox_new_with_area);
    g_test_add_func ("/tests/combobox-object-new", test_combobox_object_new);
    g_test_add_func ("/tests/combobox-subclass0", test_combobox_subclass0);
    g_test_add_func ("/tests/combobox-subclass1", test_combobox_subclass1);
    g_test_add_func ("/tests/combobox-subclass2", test_combobox_subclass2);
    g_test_add_func ("/tests/combobox-subclass3", test_combobox_subclass3);

    g_test_add_func ("/tests/cellview-new", test_cellview_new);
    g_test_add_func ("/tests/cellview-new-with-context", test_cellview_new_with_context);
    g_test_add_func ("/tests/cellview-object-new", test_cellview_object_new);
    g_test_add_func ("/tests/cellview-subclass0", test_cellview_subclass0);
    g_test_add_func ("/tests/cellview-subclass1", test_cellview_subclass1);
    g_test_add_func ("/tests/cellview-subclass2", test_cellview_subclass2);
    g_test_add_func ("/tests/cellview-subclass3", test_cellview_subclass3);

    g_test_add_func ("/tests/column-new", test_column_new);
    g_test_add_func ("/tests/column-new-with-area", test_column_new_with_area);
    g_test_add_func ("/tests/column-object-new", test_column_object_new);
    g_test_add_func ("/tests/column-subclass0", test_column_subclass0);
    g_test_add_func ("/tests/column-subclass1", test_column_subclass1);
    g_test_add_func ("/tests/column-subclass2", test_column_subclass2);
    g_test_add_func ("/tests/column-subclass3", test_column_subclass3);

    g_test_add_func ("/tests/completion-new", test_completion_new);
    g_test_add_func ("/tests/completion-new-with-area", test_completion_new_with_area);
    g_test_add_func ("/tests/completion-object-new", test_completion_object_new);
    g_test_add_func ("/tests/completion-subclass0", test_completion_subclass0);
    g_test_add_func ("/tests/completion-subclass1", test_completion_subclass1);
    g_test_add_func ("/tests/completion-subclass2", test_completion_subclass2);
    g_test_add_func ("/tests/completion-subclass3", test_completion_subclass3);

    return g_test_run();
}
Пример #5
0
/* --- main test program --- */
int
main (int   argc,
      char *argv[])
{
  const GType *otypes;
  guint i;
  /* initialize test program */
  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 ();
}
Пример #6
0
int
main (int argc, char **argv)
{
  const GType *all_types;
  guint n_types = 0, i;
  gchar *schema_dir;
  GTestDBus *bus;
  gint result;

  /* These must be set before before gtk_test_init */
  g_setenv ("GIO_USE_VFS", "local", TRUE);
  g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);

  /* initialize test program */
  gtk_test_init (&argc, &argv);
  gtk_test_register_all_types ();

  /* g_test_build_filename must be called after gtk_test_init */
  schema_dir = g_test_build_filename (G_TEST_BUILT, "", NULL);
  g_setenv ("GSETTINGS_SCHEMA_DIR", schema_dir, TRUE);

  /* Create one test bus for all tests, as we have a lot of very small
   * and quick tests.
   */
  bus = g_test_dbus_new (G_TEST_DBUS_NONE);
  g_test_dbus_up (bus);

  all_types = gtk_test_list_all_types (&n_types);

  for (i = 0; i < n_types; i++)
    {
      if (g_type_is_a (all_types[i], G_TYPE_OBJECT) &&
	  G_TYPE_IS_INSTANTIATABLE (all_types[i]) &&
	  !G_TYPE_IS_ABSTRACT (all_types[i]) &&
#ifdef GDK_WINDOWING_X11
	  all_types[i] != GDK_TYPE_X11_WINDOW &&
	  all_types[i] != GDK_TYPE_X11_CURSOR &&
	  all_types[i] != GDK_TYPE_X11_SCREEN &&
	  all_types[i] != GDK_TYPE_X11_DISPLAY &&
	  all_types[i] != GDK_TYPE_X11_DEVICE_MANAGER_XI2 &&
	  all_types[i] != GDK_TYPE_X11_DISPLAY_MANAGER &&
	  all_types[i] != GDK_TYPE_X11_GL_CONTEXT &&
#endif
	  /* Not allowed to finalize a GdkPixbufLoader without calling gdk_pixbuf_loader_close() */
	  all_types[i] != GDK_TYPE_PIXBUF_LOADER &&
	  all_types[i] != gdk_pixbuf_simple_anim_iter_get_type())
	{
	  gchar *test_path = g_strdup_printf ("/FinalizeObject/%s", g_type_name (all_types[i]));

	  g_test_add_data_func (test_path, GSIZE_TO_POINTER (all_types[i]), test_finalize_object);

	  g_free (test_path);
	}
    }

  result = g_test_run();

  g_test_dbus_down (bus);
  g_object_unref (bus);
  g_free (schema_dir);

  return result;
}