summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2007-12-30 00:33:31 -0800
committerKeith Packard <keithp@keithp.com>2007-12-30 00:34:30 -0800
commitfe12373a6d64f8043f5e3f144ff987b8c9af73ea (patch)
tree413c56185a9dc766235dbafe4a97a8f48cdf6b5a /test
parent332cead41967fcc251d6c1fe4c4a0118cffd4725 (diff)
Add text-extents test
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am1
-rw-r--r--test/test.5c23
-rw-r--r--test/text-extents-ref.pngbin0 -> 1016 bytes
3 files changed, 24 insertions, 0 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 0506aea..4146dc1 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -29,6 +29,7 @@ REFPNG=\
show-text-ref.png \
stroke-extents-ref.png \
stroke-preserve-ref.png \
+ text-extents-ref.png \
text-path-ref.png
TESTS_ENVIRONMENT=SRCDIR="$(srcdir)" NICKLEPATH="$(top_srcdir):@NICKLE_PATH@" LD_LIBRARY_PATH=../src/.libs nickle
diff --git a/test/test.5c b/test/test.5c
index 05e0033..350b319 100644
--- a/test/test.5c
+++ b/test/test.5c
@@ -588,6 +588,29 @@ image_test_t[] image_tests = {
}
},
{
+ name = "text-extents",
+ format = format_t.ARGB,
+ paint = void func (cairo_t cr) {
+ set_font (cr, font_name);
+ real x = 10;
+ real y = 40;
+ string text = "Hello, world.";
+ text_extents_t e = text_extents (cr, text);
+ set_source_rgba (cr, 1, 1, 1, 1);
+ rectangle (cr, x + e.x_bearing, y + e.y_bearing,
+ e.width, e.height);
+ fill (cr);
+ move_to (cr, x, y);
+ set_source_rgba (cr, 0, 0, 0, 1);
+ show_text (cr, text);
+ move_to (cr, x, y);
+ line_to (cr, x + e.x_advance, y + e.y_advance);
+ set_line_width (cr, 1);
+ set_source_rgba (cr, 1, 0, 0, 0.5);
+ stroke (cr);
+ }
+ },
+ {
name = "create-rgba",
format = format_t.ARGB,
paint = void func (cairo_t cr) {
diff --git a/test/text-extents-ref.png b/test/text-extents-ref.png
new file mode 100644
index 0000000..385a73f
--- /dev/null
+++ b/test/text-extents-ref.png
Binary files differ