diff --git a/app/tests/gimp-app-test-utils.c b/app/tests/gimp-app-test-utils.c
index b8eda879f1d2d89ac21b2d94cbda382068f5bbd9..6a9af0ff6bdcdefdac769cc1e7a527eb15938aa4 100644
--- a/app/tests/gimp-app-test-utils.c
+++ b/app/tests/gimp-app-test-utils.c
@@ -15,7 +15,15 @@
* along with this program. If not, see .
*/
-#include
+#include "config.h"
+
+#include
+
+#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;
+}
diff --git a/app/tests/gimp-app-test-utils.h b/app/tests/gimp-app-test-utils.h
index af3feb1f8da8e88ef788aa3fadb7194c6de9be63..3224cf4cc49da54956fc97518222bc23c53eaaac 100644
--- a/app/tests/gimp-app-test-utils.h
+++ b/app/tests/gimp-app-test-utils.h
@@ -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__ */