示例#1
0
gint
main (gint    argc,
      gchar **argv)
{
  GeglBuffer *buffer, *buffer2;
  GeglNode   *gegl, *sink;
  gint i;

  gegl_init (&argc, &argv);

  buffer = test_buffer (1024, 1024, babl_format ("RGBA float"));

#define ITERATIONS 8
  test_start ();
  for (i=0;i< ITERATIONS;i++)
  gegl = gegl_graph (sink = gegl_node ("gegl:buffer-sink", "buffer", &buffer2, NULL,
                            gegl_node ("gegl:brightness-contrast", "contrast", 0.2, NULL,
                            gegl_node ("gegl:brightness-contrast", "contrast", 0.2, NULL,
                            gegl_node ("gegl:brightness-contrast", "contrast", 0.2, NULL,
                            gegl_node ("gegl:brightness-contrast", "contrast", 1.2, NULL,
                            gegl_node ("gegl:buffer-source", "buffer", buffer, NULL)))))));

  gegl_node_process (sink);
  test_end ("passthrough", gegl_buffer_get_pixel_count (buffer2) * 16);
  g_object_unref (gegl);
  g_object_unref (buffer2);

  return 0;
}
示例#2
0
文件: test-blur.c 项目: jonnor/gegl
gint
main (gint    argc,
      gchar **argv)
{
  GeglBuffer *buffer;

  gegl_init(&argc, &argv);

  buffer = test_buffer(1024, 1024, babl_format("RGB float"));
  bench("gaussian-blur (RGB)", buffer, &blur);
  g_object_unref (buffer);

  buffer = test_buffer(1024, 1024, babl_format("RaGaBaA float"));
  bench("gaussian-blur (RaGaBaA)", buffer, &blur);
  g_object_unref (buffer);

  buffer = test_buffer(1024, 1024, babl_format("RGBA float"));
  bench("gaussian-blur (RGBA)", buffer, &blur);
  g_object_unref (buffer);

  buffer = test_buffer(1024, 1024, babl_format("Y float"));
  bench("gaussian-blur (Y)", buffer, &blur);
  g_object_unref (buffer);

  buffer = test_buffer(1024, 1024, babl_format("YaA float"));
  bench("gaussian-blur (YaA)", buffer, &blur);
  g_object_unref (buffer);

  buffer = test_buffer(1024, 1024, babl_format("YA float"));
  bench("gaussian-blur (YA)", buffer, &blur);
  g_object_unref (buffer);

  gegl_exit ();
  return 0;
}
示例#3
0
gint
main (gint    argc,
      gchar **argv)
{
  GeglBuffer *buffer, *buffer2;
  GeglNode   *gegl, *sink;
  gint i;

  g_thread_init (NULL);
  gegl_init (&argc, &argv);

  g_object_set (gegl_config (), "chunk-size", 128 * 128, NULL);

  buffer = test_buffer (1024, 1024, babl_format ("RGBA float"));

#define ITERATIONS 6
  test_start ();
  for (i=0;i< ITERATIONS;i++)
    {
      gegl = gegl_graph (sink = gegl_node ("gegl:buffer-sink", "buffer", &buffer2, NULL,
                                gegl_node ("gegl:brightness-contrast", "contrast", 0.2, NULL,
                                gegl_node ("gegl:buffer-source", "buffer", buffer, NULL))));

      gegl_node_process (sink);
      g_object_unref (gegl);
      g_object_unref (buffer2);
    }
  test_end ("bcontrast-minichunk", gegl_buffer_get_pixel_count (buffer) * 16 * ITERATIONS);


  return 0;
}
示例#4
0
gint
main (gint    argc,
      gchar **argv)
{
  GeglBuffer *buffer, *buffer2;
  GeglNode   *gegl, *source, *node1, *node2, *node3, *node4, *sink;
  gint i;

  gegl_init (&argc, &argv);

  buffer = test_buffer (2048, 1024, babl_format ("RGBA float"));

#define ITERATIONS 16
  test_start ();
  for (i=0;i< ITERATIONS;i++)
    {
      gegl = gegl_node_new ();
      source = gegl_node_new_child (gegl, "operation", "gegl:buffer-source", "buffer", buffer, NULL);
      node1 = gegl_node_new_child (gegl, "operation", "gegl:brightness-contrast", "contrast", 0.2, NULL);
      node2 = gegl_node_new_child (gegl, "operation", "gegl:brightness-contrast", "contrast", 0.2, NULL);
      node3 = gegl_node_new_child (gegl, "operation", "gegl:brightness-contrast", "contrast", 0.2, NULL);
      node4 = gegl_node_new_child (gegl, "operation", "gegl:brightness-contrast", "contrast", 0.2, NULL);
      sink = gegl_node_new_child (gegl, "operation", "gegl:buffer-sink", "buffer", &buffer2, NULL);

      gegl_node_link_many (source, node1, node2, node3, node4, sink, NULL);
      gegl_node_process (sink);
      g_object_unref (gegl);
      g_object_unref (buffer2);
    }
  test_end ("bcontrast_4x", gegl_buffer_get_pixel_count (buffer) * 16 * ITERATIONS);

  return 0;
}
示例#5
0
int main(int argc, char **argv)
{
  gint tests_run    = 0;
  gint tests_passed = 0;
  gint tests_failed = 0;

  gegl_init(0, NULL);
  g_object_set(G_OBJECT(gegl_config()),
               "swap", "RAM",
               "use-opencl", FALSE,
               NULL);

  RUN_TEST (test_buffer_path)
  RUN_TEST (test_buffer_path_from_backend)
  RUN_TEST (test_buffer_load)
  RUN_TEST (test_buffer_same_path)
  RUN_TEST (test_buffer_open)
  RUN_TEST (test_buffer_change_extent)

  gegl_exit();

  if (tests_passed == tests_run)
    return 0;
  return -1;

  return 0;
}
示例#6
0
gint
main (gint    argc,
      gchar **argv)
{
  GeglBuffer *buffer;

  gegl_init (&argc, &argv);

  buffer = test_buffer (1024, 1024, babl_format ("RGB float"));
  bench ("saturation (RGB)", buffer, &saturation);
  g_object_unref (buffer);

  buffer = test_buffer (1024, 1024, babl_format ("RGBA float"));
  bench ("saturation (RGBA)", buffer, &saturation);
  g_object_unref (buffer);

  buffer = test_buffer (1024, 1024, babl_format ("CIE Lab float"));
  bench ("saturation (CIE Lab)", buffer, &saturation);
  g_object_unref (buffer);

  buffer = test_buffer (1024, 1024, babl_format ("CIE Lab alpha float"));
  bench ("saturation (CIE Lab alpha)", buffer, &saturation);
  g_object_unref (buffer);

  buffer = test_buffer (1024, 1024, babl_format ("CIE LCH(ab) float"));
  bench ("saturation (CIE LCH(ab))", buffer, &saturation);
  g_object_unref (buffer);

  buffer = test_buffer (1024, 1024, babl_format ("CIE LCH(ab) alpha float"));
  bench ("saturation (CIE LCH(ab) alpha)", buffer, &saturation);
  g_object_unref (buffer);

  gegl_exit ();
  return 0;
}
示例#7
0
文件: tests.c 项目: AnonPower/picman
static Gimp *
gimp_init_for_gui_testing_internal (gboolean     show_gui,
                                    const gchar *gimprc)
{
  GimpSessionInfoClass *klass;
  Gimp                 *gimp;

  /* from main() */
  g_type_init();
  gimp_log_init ();
  gegl_init (NULL, NULL);

  /* Introduce an error margin for positions written to sessionrc */
  klass = g_type_class_ref (GIMP_TYPE_SESSION_INFO);
  gimp_session_info_class_set_position_accuracy (klass, 5);

  /* from app_run() */
  gimp = gimp_new ("Unit Tested GIMP", NULL, NULL, FALSE, TRUE, TRUE, !show_gui,
                   FALSE, TRUE, TRUE, FALSE);
  gimp_set_show_gui (gimp, show_gui);
  units_init (gimp);
  gimp_load_config (gimp, gimprc, NULL);
  gimp_gegl_init (gimp);
  gui_init (gimp, TRUE);
  gimp_initialize (gimp, gimp_status_func_dummy);
  gimp_restore (gimp, gimp_status_func_dummy);

  g_type_class_unref (klass);

  return gimp;
}
示例#8
0
static void
run (const gchar      *name,
     gint              nparams,
     const GimpParam  *param,
     gint             *nreturn_vals,
     GimpParam       **return_vals)
{
  static GimpParam   values[2];
  GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
  GimpParasite      *parasite;
  gint32             image;
  gint32             drawable;
  gint32             orig_image;
  GimpExportReturn   export = GIMP_EXPORT_CANCEL;
  GError            *error  = NULL;

  run_mode = param[0].data.d_int32;

  INIT_I18N ();
  gegl_init (NULL, NULL);

  *nreturn_vals = 1;
  *return_vals  = values;

  values[0].type          = GIMP_PDB_STATUS;
  values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;

  TIFFSetWarningHandler (tiff_warning);
  TIFFSetErrorHandler (tiff_error);

  if ((strcmp (name, SAVE_PROC) == 0) ||
      (strcmp (name, SAVE2_PROC) == 0))
    {
      /* Plug-in is either file_tiff_save or file_tiff_save2 */
      image = orig_image = param[1].data.d_int32;
      drawable = param[2].data.d_int32;

      /* Do this right this time, if POSSIBLE query for parasites, otherwise
         or if there isn't one, choose the default comment from the gimprc. */

      /*  eventually export the image */
      switch (run_mode)
        {
        case GIMP_RUN_INTERACTIVE:
        case GIMP_RUN_WITH_LAST_VALS:
          gimp_ui_init (PLUG_IN_BINARY, FALSE);
          export = gimp_export_image (&image, &drawable, NULL,
                                      (GIMP_EXPORT_CAN_HANDLE_RGB |
                                       GIMP_EXPORT_CAN_HANDLE_GRAY |
                                       GIMP_EXPORT_CAN_HANDLE_INDEXED |
                                       GIMP_EXPORT_CAN_HANDLE_ALPHA ));
          if (export == GIMP_EXPORT_CANCEL)
            {
              values[0].data.d_status = GIMP_PDB_CANCEL;
              return;
            }
          break;
        default:
          break;
        }
示例#9
0
static void
run (const gchar      *name,
     gint              n_params,
     const GimpParam  *param,
     gint             *nreturn_vals,
     GimpParam       **return_vals)
{
  static GimpParam   values[1];
  GimpRunMode        run_mode;
  GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
  gint32             drawable_id;
  gint32             image_id;

  INIT_I18N ();
  gegl_init (NULL, NULL);

  *nreturn_vals = 1;
  *return_vals  = values;

  run_mode = param[0].data.d_int32;

  if (run_mode == GIMP_RUN_NONINTERACTIVE)
    {
      if (n_params != 3)
        {
          status = GIMP_PDB_CALLING_ERROR;
        }
    }

  if (status == GIMP_PDB_SUCCESS)
    {
      /*  Get the specified drawable  */
      image_id    = param[1].data.d_int32;
      drawable_id = param[2].data.d_int32;

      /*  Make sure that the drawable is gray or RGB or indexed  */
      if (gimp_drawable_is_rgb (drawable_id) ||
          gimp_drawable_is_gray (drawable_id) ||
          gimp_drawable_is_indexed (drawable_id))
        {
          gimp_progress_init (_("Zealous cropping"));

          do_zcrop (drawable_id, image_id);

          if (run_mode != GIMP_RUN_NONINTERACTIVE)
            gimp_displays_flush ();
        }
      else
        {
          status = GIMP_PDB_EXECUTION_ERROR;
        }
    }

  values[0].type          = GIMP_PDB_STATUS;
  values[0].data.d_status = status;

  gegl_exit ();
}
示例#10
0
int main(int argc, char **argv)
{
  gint tests_run    = 0;
  gint tests_passed = 0;
  gint tests_failed = 0;

  gint i;

  const char *operation_names[] = {
    "svg:src",
    "svg:dst",

    "svg:src-over",
    "svg:dst-over",

    "svg:src-in",
    "svg:dst-in",

    "svg:src-out",
    "svg:dst-out",

    "svg:src-atop",
    "svg:dst-atop",

    "svg:clear",
    "svg:xor",
  };

  gegl_init(0, NULL);
  g_object_set(G_OBJECT(gegl_config()),
               "swap", "RAM",
               "use-opencl", FALSE,
               NULL);

  printf ("testing abyss handling of svg blends\n");

  for (i = 0; i < G_N_ELEMENTS(operation_names); ++i)
    {
      if (test_operation (operation_names[i]))
        tests_passed++;
      else
        tests_failed++;
      tests_run++;
    }

  gegl_exit();

  printf ("\n");

  if (tests_passed == tests_run)
    return 0;
  return -1;

  return 0;
}
示例#11
0
static void
run (const gchar      *name,
     gint              nparams,
     const GimpParam  *param,
     gint             *nreturn_vals,
     GimpParam       **return_vals)
{
  static GimpParam  values[2];
  GimpRunMode       run_mode;
  GimpPDBStatusType status = GIMP_PDB_SUCCESS;
  gint32            image_ID;
  GError           *error  = NULL;

  INIT_I18N ();
  gegl_init (NULL, NULL);

  *nreturn_vals = 1;
  *return_vals  = values;

  values[0].type          = GIMP_PDB_STATUS;
  values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;

  if (strcmp (name, LOAD_PROC) == 0)
    {
      run_mode = param[0].data.d_int32;

      image_ID = load_image (param[1].data.d_string,
                             run_mode == GIMP_RUN_INTERACTIVE, &error);

      if (image_ID != -1)
        {
          *nreturn_vals = 2;
          values[1].type = GIMP_PDB_IMAGE;
          values[1].data.d_image = image_ID;
        }
      else
        {
          status = GIMP_PDB_EXECUTION_ERROR;
        }
    }
  else
    {
      status = GIMP_PDB_CALLING_ERROR;
    }

  if (status != GIMP_PDB_SUCCESS && error)
    {
      *nreturn_vals = 2;
      values[1].type          = GIMP_PDB_STRING;
      values[1].data.d_string = error->message;
    }

  values[0].data.d_status = status;
}
示例#12
0
int main(int argc, char **argv)
{
  GeglTile *tile;
  GeglBuffer *buf_a, *buf_b, *buf_small_lin, *buf_big_lin;
  gpointer shared_data = NULL;
  gboolean result = TRUE;
  gpointer scratch_data;
  GeglRectangle buffer_rect = *GEGL_RECTANGLE(0, 0, 128, 128);

  gegl_init (&argc, &argv);

  buf_a = gegl_buffer_new (&buffer_rect, babl_format("RGBA u8"));
  buf_b = gegl_buffer_new (&buffer_rect, babl_format("RGBA u8"));
  buf_small_lin = gegl_buffer_linear_new (&buffer_rect, babl_format("RGBA float"));
  buf_big_lin = gegl_buffer_linear_new (GEGL_RECTANGLE(0, 0, 1024, 1024), babl_format("RGBA float"));

  tile = gegl_tile_source_get_tile (GEGL_TILE_SOURCE (buf_a), 0, 0, 0);
  shared_data = gegl_tile_get_data(tile);
  gegl_tile_unref (tile);

  if (!assert_is_empty (buf_a, 0, 0, shared_data))
    result = FALSE;
  if (!assert_is_empty (buf_b, 0, 1, shared_data))
    result = FALSE;

  if (!assert_is_empty (buf_a, 0, 0, shared_data))
    result = FALSE;
  if (!assert_is_empty (buf_b, 0, 1, shared_data))
    result = FALSE;

  if (!assert_is_empty (buf_small_lin, 0, 0, shared_data))
    result = FALSE;

  if (!assert_is_unshared (buf_big_lin, 0, 0, shared_data))
    result = FALSE;

  scratch_data = gegl_malloc(4 * buffer_rect.width * buffer_rect.height);
  gegl_buffer_get (buf_a, &buffer_rect, 1.0, babl_format("RGBA u8"), scratch_data, 0, GEGL_ABYSS_NONE);
  gegl_buffer_get (buf_b, &buffer_rect, 1.0, babl_format("RGBA u8"), scratch_data, 0, GEGL_ABYSS_NONE);
  gegl_buffer_get (buf_small_lin, &buffer_rect, 1.0, babl_format("RGBA u8"), scratch_data, 0, GEGL_ABYSS_NONE);
  gegl_buffer_get (buf_big_lin, &buffer_rect, 1.0, babl_format("RGBA u8"), scratch_data, 0, GEGL_ABYSS_NONE);
  gegl_free (scratch_data);

  g_object_unref(buf_a);
  g_object_unref(buf_b);
  g_object_unref(buf_small_lin);
  g_object_unref(buf_big_lin);

  gegl_exit();

  if (result)
    return SUCCESS;
  return FAILURE;
}
int
main(int argc, char **argv)
{
    babl_init();
    gegl_init(0, NULL);

    int retval = mypaint_test_surface_run(argc, argv, gegl_surface_factory, "MyPaintGeglSurface", NULL);

    gegl_exit();
    return retval;
}
示例#14
0
static void
run (const gchar      *name,
     gint              nparams,
     const GimpParam  *param,
     gint             *nreturn_vals,
     GimpParam       **return_vals)
{
  static GimpParam   values[2];
  GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
  GError            *error  = NULL;

  INIT_I18N ();
  gegl_init (NULL, NULL);

  *nreturn_vals = 1;
  *return_vals  = values;

  values[0].type          = GIMP_PDB_STATUS;
  values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;

  gimp_get_data (SAVE_PROC, &gtmvals);

  if (save_dialog (param[1].data.d_int32))
    {
      GeglBuffer *buffer;

      buffer = gimp_drawable_get_buffer (param[2].data.d_int32);

      if (save_image (param[3].data.d_string, buffer, &error))
        {
          gimp_set_data (SAVE_PROC, &gtmvals, sizeof (GTMValues));
        }
      else
        {
          status = GIMP_PDB_EXECUTION_ERROR;
        }

      g_object_unref (buffer);
    }
  else
    {
      status = GIMP_PDB_CANCEL;
    }

  if (status != GIMP_PDB_SUCCESS && error)
    {
      *nreturn_vals = 2;
      values[1].type          = GIMP_PDB_STRING;
      values[1].data.d_string = error->message;
    }

  values[0].data.d_status = status;
}
示例#15
0
gint
main (gint argc,
      gchar **argv)
{
  GeglNode *gegl, *sink;

  if (argc != 4)
    {
      g_print ("Usage: %s <input image> \"string\" <output image>\n\n", argv[0]);
      return -1;
    }

  g_thread_init (NULL);
  gegl_init (&argc, &argv);

  gegl =
    gegl_graph (
    sink = gegl_node ("gegl:png-save", "path", argv[3], NULL,
    gegl_node   ("gegl:over", NULL,
      gegl_node ("gegl:scale",
                 "x", 0.4,
                 "y", 0.4,
                 NULL,
      gegl_node ("gegl:invert",
                 NULL,
      gegl_node ("gegl:load",
                 "path", argv[1],
                 NULL
    ))),
      gegl_node ("gegl:translate",
                 "x", 50.0,
                 "y", 50.0,
                 NULL,
      gegl_node ("gegl:dropshadow",
                 "opacity", 1.0,
                 "radius", 3.0,
                 "x", 3.0,
                 "y", 3.0,
                 NULL,
      gegl_node ("gegl:text",
                 "size", 40.0,
                 "font", "sans bold",
                 "string", argv[2],
                 "color", gegl_color_new("green"),
                 NULL
    ))))));

  gegl_node_process (sink);
  g_object_unref (gegl);
  gegl_exit ();
  return 0;
}
示例#16
0
gint
main (gint    argc,
      gchar **argv)
{
  long ticks;

  test_start ();
  gegl_init (&argc, &argv);
  gegl_exit ();
  ticks = babl_ticks ()-ticks_start;
  g_print ("@ %s: %.2f seconds\n", "init", (ticks / 1000000.0));
  return 0;
}
示例#17
0
int main(int argc, char *argv[])
{
  gint result = SUCCESS;

  gegl_init (&argc, &argv);

  if (result == SUCCESS)
    result = test_buffer_cast ();

  gegl_exit ();

  return result;
}
示例#18
0
static void
run (const gchar      *name,
     gint              nparams,
     const GimpParam  *param,
     gint             *nreturn_vals,
     GimpParam       **return_vals)
{
  static GimpParam   values[2];
  GimpRunMode        run_mode;
  GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
  GimpExportReturn   export = GIMP_EXPORT_CANCEL;
  GError            *error  = NULL;

  INIT_I18N ();
  gegl_init (NULL, NULL);

  run_mode = param[0].data.d_int32;

  *nreturn_vals = 1;
  *return_vals  = values;

  values[0].type          = GIMP_PDB_STATUS;
  values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;

  if (run_mode == GIMP_RUN_INTERACTIVE &&
      strcmp (name, SAVE_PROC) == 0)
    {
      gint32         image_ID    = param[1].data.d_int32;
      gint32         drawable_ID = param[2].data.d_int32;
      GimpParasite  *parasite;
      gchar         *x;

      gimp_get_data (SAVE_PROC, &config);

      config.prefixed_name = "gimp_image";
      config.comment       = NULL;
      config.alpha         = gimp_drawable_has_alpha (drawable_ID);

      parasite = gimp_image_get_parasite (image_ID, "gimp-comment");
      if (parasite)
        {
          config.comment = g_strndup (gimp_parasite_data (parasite),
                                      gimp_parasite_data_size (parasite));
          gimp_parasite_free (parasite);
        }
      x = config.comment;

      gimp_ui_init (PLUG_IN_BINARY, FALSE);

      export = gimp_export_image (&image_ID, &drawable_ID, "C Source",
示例#19
0
gint
main (gint    argc,
      gchar **argv)
{
  GeglBuffer *buffer;

  gegl_init (&argc, &argv);

  buffer = test_buffer (2048, 1024, babl_format ("RGBA float"));

  bench("bcontrast", buffer, &blur);

  return 0;
}
示例#20
0
static void
run (const gchar      *name,
     gint              nparams,
     const GimpParam  *param,
     gint             *nreturn_vals,
     GimpParam       **return_vals)
{
  static GimpParam  values[2];
  GimpRunMode       run_mode;
  GimpPDBStatusType status = GIMP_PDB_SUCCESS;

  INIT_I18N ();
  gegl_init (NULL, NULL);

  run_mode = param[0].data.d_int32;

  *nreturn_vals = 1;
  *return_vals  = values;
  values[0].type          = GIMP_PDB_STATUS;
  values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;

  if (strcmp (name, SAVE_PROC) == 0)
    {
      gint32           image_ID;
      gint32           drawable_ID;
      GimpExportReturn export = GIMP_EXPORT_CANCEL;

      image_ID    = param[1].data.d_int32;
      drawable_ID = param[2].data.d_int32;

      /*  eventually export the image */
      switch (run_mode)
        {
        case GIMP_RUN_INTERACTIVE:
        case GIMP_RUN_WITH_LAST_VALS:
          gimp_ui_init (PLUG_IN_BINARY, FALSE);
          export = gimp_export_image (&image_ID, &drawable_ID, NULL,
                                      GIMP_EXPORT_CAN_HANDLE_RGB |
                                      GIMP_EXPORT_CAN_HANDLE_INDEXED);
          if (export == GIMP_EXPORT_CANCEL)
            {
              values[0].data.d_status = GIMP_PDB_CANCEL;
              return;
            }
          break;

        default:
          break;
        }
示例#21
0
int main(int argc, char **argv)
{
  gint tests_run    = 0;
  gint tests_passed = 0;
  gint tests_failed = 0;

  gdouble scale_list[] = {5.0, 2.5, 2.0, 1.5, 1.0, 0.9, 0.5, 0.3, 0.1, 0.09, 0.05, 0.03};
  gint x_list[] = {-16, 0, 15};
  gint i, j, k;

  gegl_init(0, NULL);
  g_object_set(G_OBJECT(gegl_config()),
               "swap", "RAM",
               "use-opencl", FALSE,
               NULL);

  printf ("testing scaled blit\n");

  for (i = 0; i < sizeof(x_list) / sizeof(x_list[0]); ++i)
    {
      for (j = 0; j < sizeof(scale_list) / sizeof(scale_list[0]); ++j)
        {
          const Babl *format_list[] = {babl_format ("RGBA u8"), babl_format ("RGBA u16")};

          for (k = 0; k < sizeof(format_list) / sizeof(format_list[0]); ++k)
            {
              if (test_scale (scale_list[j], x_list[i], 0, format_list[k]))
                tests_passed++;
              else
                tests_failed++;
              tests_run++;
            }
        }
    }

  gegl_exit();

  printf ("\n");

  if (tests_passed == tests_run)
    return 0;
  return -1;

  return 0;
}
示例#22
0
static void
run (const gchar      *name,
     gint              nparams,
     const GimpParam  *param,
     gint             *nreturn_vals,
     GimpParam       **return_vals)
{
  static GimpParam   values[1];
  GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
  gint32             drawable_id;
  gint               x, y, width, height;

  *nreturn_vals = 1;
  *return_vals = values;

  gegl_init (NULL, NULL);

  values[0].type          = GIMP_PDB_STATUS;
  values[0].data.d_status = status;

  INIT_I18N();

  drawable_id = param[2].data.d_drawable;

  if (gimp_drawable_mask_intersect (drawable_id, &x, &y, &width, &height))
    {
      GeglBuffer *buffer;
      GeglBuffer *shadow_buffer;

      buffer        = gimp_drawable_get_buffer (drawable_id);
      shadow_buffer = gimp_drawable_get_shadow_buffer (drawable_id);

      gegl_render_op (buffer, shadow_buffer, "gegl:invert", NULL);

      g_object_unref (shadow_buffer); /* flushes the shadow tiles */
      g_object_unref (buffer);

      gimp_drawable_merge_shadow (drawable_id, TRUE);
      gimp_drawable_update (drawable_id, x, y, width, height);
      gimp_displays_flush ();
    }

  values[0].data.d_status = status;
  gegl_exit ();
}
示例#23
0
int main(int argc, char *argv[])
{
  gint tests_run    = 0;
  gint tests_passed = 0;
  gint tests_failed = 0;

  gegl_init (&argc, &argv);

  RUN_TEST (test_convert_001)
  RUN_TEST (test_convert_002)
  RUN_TEST (test_same_001)

  gegl_exit ();

  if (tests_passed == tests_run)
    return SUCCESS;
  return FAILURE;
}
示例#24
0
int
main(int argc, char **argv)
{

    int retval = -1;

    gegl_init(&argc, &argv);
    g_test_init(&argc, &argv, NULL);

    g_test_add_func("/widgets/view/helper/processing", test_processing);
    g_test_add_func("/widgets/view/redraw-basic", test_redraw_basic);
    g_test_add_func("/widgets/view/redraw-scaled", test_redraw_scaled);
    g_test_add_func("/widgets/view/redraw-translated", test_redraw_translated);
    g_test_add_func("/widgets/view/redraw-combined", test_redraw_combined);

    retval = g_test_run();
    gegl_exit();
    return retval;
}
示例#25
0
int
main (int argc, char *argv[])
{
    int result = -1;

    gegl_init(&argc, &argv);

    g_test_init(&argc, &argv, NULL);

    g_test_add_func("/xml/load/empty_graph", test_load_empty_graph);
    g_test_add_func("/xml/load/multiple_nodes", test_load_multiple_nodes);

    /* Expected failure: not implemented
    g_test_add_func("/xml/load/subgraph", test_load_subgraph);
    */

    result = g_test_run();
    gegl_exit();
    return result;
}
示例#26
0
文件: tests.c 项目: kernc/gimp
/**
 * gimp_init_for_testing:
 *
 * Initialize the GIMP object system for unit testing. This is a
 * selected subset of the initialization happning in app_run().
 **/
Gimp *
gimp_init_for_testing (void)
{
    Gimp *gimp;

    gimp_log_init ();
    gegl_init (NULL, NULL);

    gimp = gimp_new ("Unit Tested GIMP", NULL, NULL, FALSE, TRUE, TRUE, TRUE,
                     FALSE, FALSE, TRUE, TRUE, FALSE);

    units_init (gimp);

    gimp_load_config (gimp, NULL, NULL);

    gimp_gegl_init (gimp);
    gimp_initialize (gimp, gimp_status_func_dummy);
    gimp_restore (gimp, gimp_status_func_dummy);

    return gimp;
}
示例#27
0
int
main (int argc, char *argv[])
{
    int result = -1;

    gegl_init(&argc, &argv);

    g_test_init(&argc, &argv, NULL);

    g_test_add_func("/xml/save/empty_graph", test_save_empty_graph);
    g_test_add_func("/xml/save/empty_graph_twice", test_save_empty_graph_twice);
    g_test_add_func("/xml/save/only_nop_nodes", test_save_nop_nodes);
    g_test_add_func("/xml/save/multiple_nodes", test_save_multiple_nodes);
    g_test_add_func("/xml/save/toplevel_graph", test_save_toplevel_graph);
    g_test_add_func("/xml/save/segment", test_save_segment);
    g_test_add_func("/xml/save/segment_subgraph", test_save_segment_subgraph);

    result = g_test_run();
    gegl_exit();
    return result;
}
示例#28
0
gint main (gint argc, gchar **argv)
{
  gint i;
  gegl_init (&argc, &argv);

  for (i=0; i < G_N_ELEMENTS (tests); i++)
    {
      gchar *ret;

      if (argc > 1)
        {
          /* handle any extra commandline options as a list of tests to
           * run and output to standard output
           */
          gint j;
          for (j=1;j<argc;j++)
            {
              if (g_str_equal (argv[j], test_names[i]))
                {
                  ret=tests[i]();
                  printf ("%s", ret);
                  g_free (ret);
                }
            }
        }
      else
        {
          gchar output_file[1024];
          printf ("%s ", test_names[i]);
          ret=tests[i]();
          sprintf (output_file, "output/%s.buf", test_names[i]);
          g_file_set_contents (output_file, ret, -1, NULL);
          g_free (ret);
        }
    }

  gegl_exit ();
  return 0;
}
示例#29
0
gint
main (gint    argc,
      gchar **argv)
{
  GeglBuffer *buffer, *buffer2;
  GeglNode   *gegl, *sink;

  gegl_init (&argc, &argv);

  buffer = test_buffer (1024, 1024, babl_format ("RGBA float"));

  gegl = gegl_graph (sink = gegl_node ("gegl:buffer-sink", "buffer", &buffer2, NULL,
                            gegl_node ("gegl:rotate", "degrees", 4.0, NULL,
                            gegl_node ("gegl:buffer-source", "buffer", buffer, NULL))));

  test_start ();
  gegl_node_process (sink);
  test_end ("rotate",  gegl_buffer_get_pixel_count (buffer) * 16);

  g_object_unref (gegl);

  return 0;
}
示例#30
0
int main(int argc, char *argv[])
{
  gint tests_run    = 0;
  gint tests_passed = 0;
  gint tests_failed = 0;

  gegl_init (&argc, &argv);

  RUN_TEST (test_buffer_sink_001)
  RUN_TEST (test_opacity_linear_001)
  RUN_TEST (test_opacity_linear_002)
  RUN_TEST (test_opacity_linear_003)
  RUN_TEST (test_opacity_linear_004)
  RUN_TEST (test_opacity_gamma_001)
  RUN_TEST (test_opacity_gamma_002)
  RUN_TEST (test_opacity_gamma_003)
  RUN_TEST (test_opacity_gamma_004)

  gegl_exit ();

  if (tests_passed == tests_run)
    return SUCCESS;
  return FAILURE;
}