Initialize some more stuff so real tests are possible

* tests.[ch]: initialize base so we have a tile cache and add
  parameter "gboolean use_cpu_accel" so we can test stuff both with
  and without using CPU features.

* tests/test-layer-grouping.c: changed accordingly. Call g_thread_init()
  so the tile cache works (and to be on the safe side in general).
This commit is contained in:
Michael Natterer 2009-09-07 19:06:57 +02:00
parent 2e2c7aaf34
commit 6542617751
3 changed files with 15 additions and 5 deletions

View File

@ -21,6 +21,10 @@
#include "core/core-types.h"
#include "base/base.h"
#include "config/gimpbaseconfig.h"
#include "core/gimp.h"
#include "tests.h"
@ -34,14 +38,16 @@
* selected subset of the initialization happning in app_run().
**/
Gimp *
gimp_init_for_testing (void)
gimp_init_for_testing (gboolean use_cpu_accel)
{
Gimp *gimp = gimp_new ("Unit Tested GIMP", NULL, FALSE, TRUE, TRUE, TRUE,
FALSE, TRUE, TRUE, FALSE);
Gimp *gimp = gimp_new ("Unit Tested GIMP", NULL, FALSE, TRUE, TRUE, TRUE,
FALSE, TRUE, TRUE, FALSE);
units_init (gimp);
gimp_load_config (gimp, NULL, NULL);
base_init (GIMP_BASE_CONFIG (gimp->config), FALSE, use_cpu_accel);
return gimp;
}

View File

@ -18,6 +18,8 @@
#ifndef __TESTS_H__
#define __TESTS_H__
Gimp * gimp_init_for_testing (void);
Gimp * gimp_init_for_testing (gboolean use_cpu_accel);
#endif /* __TESTS_H__ */

View File

@ -50,11 +50,13 @@ int
main (int argc,
char **argv)
{
g_thread_init (NULL);
g_type_init ();
g_test_init (&argc, &argv, NULL);
/* We share the same application instance across all tests */
gimp = gimp_init_for_testing ();
gimp = gimp_init_for_testing (TRUE);
/* Setup the tests */
g_test_add ("/gimp-layer-grouping/add-layer",