mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-04 01:43:24 +00:00
libgimp: also add a unit test of gimp_text_layer_new() with pixel unit.
This would help preventing any future regression.
This commit is contained in:
parent
518052a105
commit
31cf749f31
2 changed files with 14 additions and 2 deletions
|
@ -27,7 +27,7 @@ gimp_c_test_run (GimpProcedure *procedure,
|
||||||
GIMP_TEST_END(n_images == 1 && images[0] == new_image);
|
GIMP_TEST_END(n_images == 1 && images[0] == new_image);
|
||||||
g_free (images);
|
g_free (images);
|
||||||
|
|
||||||
GIMP_TEST_START("gimp_text_layer_new()");
|
GIMP_TEST_START("gimp_text_layer_new() with point unit");
|
||||||
text_layer = gimp_text_layer_new (new_image, "hello world", gimp_context_get_font (),
|
text_layer = gimp_text_layer_new (new_image, "hello world", gimp_context_get_font (),
|
||||||
20, gimp_unit_point ());
|
20, gimp_unit_point ());
|
||||||
GIMP_TEST_END(GIMP_IS_TEXT_LAYER (text_layer));
|
GIMP_TEST_END(GIMP_IS_TEXT_LAYER (text_layer));
|
||||||
|
@ -35,5 +35,13 @@ gimp_c_test_run (GimpProcedure *procedure,
|
||||||
GIMP_TEST_START("gimp_image_insert_layer()");
|
GIMP_TEST_START("gimp_image_insert_layer()");
|
||||||
GIMP_TEST_END(gimp_image_insert_layer (new_image, GIMP_LAYER (text_layer), NULL, 0));
|
GIMP_TEST_END(gimp_image_insert_layer (new_image, GIMP_LAYER (text_layer), NULL, 0));
|
||||||
|
|
||||||
|
GIMP_TEST_START("gimp_text_layer_new() with pixel unit");
|
||||||
|
text_layer = gimp_text_layer_new (new_image, "hello world", gimp_context_get_font (),
|
||||||
|
20, gimp_unit_pixel ());
|
||||||
|
GIMP_TEST_END(GIMP_IS_TEXT_LAYER (text_layer));
|
||||||
|
|
||||||
|
GIMP_TEST_START("gimp_image_insert_layer()");
|
||||||
|
GIMP_TEST_END(gimp_image_insert_layer (new_image, GIMP_LAYER (text_layer), NULL, 0));
|
||||||
|
|
||||||
GIMP_TEST_RETURN
|
GIMP_TEST_RETURN
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,10 @@ images = Gimp.get_images()
|
||||||
gimp_assert('Gimp.get_images()', len(images) == 1 and images[0] == image)
|
gimp_assert('Gimp.get_images()', len(images) == 1 and images[0] == image)
|
||||||
|
|
||||||
text_layer = Gimp.TextLayer.new(image, "hello world", Gimp.context_get_font(), 20, Gimp.Unit.point())
|
text_layer = Gimp.TextLayer.new(image, "hello world", Gimp.context_get_font(), 20, Gimp.Unit.point())
|
||||||
gimp_assert('Gimp.TextLayer.new()', type(text_layer) == Gimp.TextLayer)
|
gimp_assert('Gimp.TextLayer.new() with point unit', type(text_layer) == Gimp.TextLayer)
|
||||||
|
|
||||||
gimp_assert('Gimp.Image.InsertLayer()', image.insert_layer(text_layer, None, 0))
|
gimp_assert('Gimp.Image.InsertLayer()', image.insert_layer(text_layer, None, 0))
|
||||||
|
|
||||||
|
text_layer = Gimp.TextLayer.new(image, "hello world", Gimp.context_get_font(), 20, Gimp.Unit.pixel())
|
||||||
|
gimp_assert('Gimp.TextLayer.new() with pixel unit', type(text_layer) == Gimp.TextLayer)
|
||||||
|
gimp_assert('Gimp.Image.InsertLayer()', image.insert_layer(text_layer, None, 0))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue