Commit 2056042e authored by Martin Nordholts's avatar Martin Nordholts

app/tests: Add gimp_test_utils_create_image()

parent 9e6f5000
......@@ -15,7 +15,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <glib.h>
#include "config.h"
#include <gegl.h>
#include "core/core-types.h"
#include "core/gimp.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "gimp-app-test-utils.h"
......@@ -77,3 +85,49 @@ gimp_test_utils_setup_menus_dir (void)
"menus" /*subdir*/,
"GIMP_TESTING_MENUS_DIR" /*target_env_var*/);
}
/**
* gimp_test_utils_create_image:
* @gimp: A #Gimp instance.
* @width: Width of image (and layer)
* @height: Height of image (and layer)
*
* Creates a new image of a given size with one layer of same size and
* a display.
*
* Returns: The new #GimpImage.
**/
GimpImage *
gimp_test_utils_create_image (Gimp *gimp,
gint width,
gint height)
{
GimpImage *image;
GimpLayer *layer;
image = gimp_image_new (gimp,
width,
height,
GIMP_RGB);
layer = gimp_layer_new (image,
width,
height,
GIMP_RGBA_IMAGE,
"layer1",
1.0,
GIMP_NORMAL_MODE);
gimp_image_add_layer (image,
layer,
NULL /*parent*/,
0 /*position*/,
FALSE /*push_undo*/);
gimp_create_display (gimp,
image,
GIMP_UNIT_PIXEL,
1.0 /*scale*/);
return image;
}
......@@ -19,9 +19,12 @@
#define __GIMP_RECTANGLE_SELECT_TOOL_H__
void gimp_test_utils_set_gimp2_directory (const gchar *root_env_var,
const gchar *subdir);
void gimp_test_utils_setup_menus_dir (void);
void gimp_test_utils_set_gimp2_directory (const gchar *root_env_var,
const gchar *subdir);
void gimp_test_utils_setup_menus_dir (void);
GimpImage * gimp_test_utils_create_image (Gimp *gimp,
gint width,
gint height);
#endif /* __GIMP_RECTANGLE_SELECT_TOOL_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment