[librsvg: 28/29] Test rsvg_handle_get_dimensions_sub() / rsvg_handle_get_position_sub()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 28/29] Test rsvg_handle_get_dimensions_sub() / rsvg_handle_get_position_sub()
- Date: Tue, 6 Feb 2018 21:06:26 +0000 (UTC)
commit 2d8d5c6fae789bc7809c7d92a0aaf5200d559587
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Feb 6 14:12:54 2018 -0600
Test rsvg_handle_get_dimensions_sub() / rsvg_handle_get_position_sub()
tests/api.c | 30 +++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/tests/api.c b/tests/api.c
index 19323a4..35ff499 100644
--- a/tests/api.c
+++ b/tests/api.c
@@ -11,9 +11,6 @@
#include "test-utils.h"
/*
-rsvg_handle_get_dimensions
-rsvg_handle_get_dimensions_sub
-rsvg_handle_get_position_sub
rsvg_handle_get_base_uri
rsvg_handle_set_base_uri
rsvg_handle_set_size_callback
@@ -417,6 +414,32 @@ handle_get_pixbuf_sub (void)
g_object_unref (handle);
}
+static void
+dimensions_and_position (void)
+{
+ char *filename = get_test_filename ("example.svg");
+ GError *error = NULL;
+
+ RsvgHandle *handle = rsvg_handle_new_from_file (filename, &error);
+ g_free (filename);
+
+ g_assert (handle != NULL);
+ g_assert (error == NULL);
+
+ RsvgDimensionData dim;
+
+ g_assert (rsvg_handle_get_dimensions_sub (handle, &dim, EXAMPLE_TWO_ID));
+ g_assert_cmpint (dim.width, ==, EXAMPLE_TWO_W);
+ g_assert_cmpint (dim.height, ==, EXAMPLE_TWO_H);
+
+ RsvgPositionData pos;
+ g_assert (rsvg_handle_get_position_sub (handle, &pos, EXAMPLE_TWO_ID));
+ g_assert_cmpint (pos.x, ==, EXAMPLE_TWO_X);
+ g_assert_cmpint (pos.y, ==, EXAMPLE_TWO_Y);
+
+ g_object_unref (handle);
+}
+
int
main (int argc, char **argv)
{
@@ -441,6 +464,7 @@ main (int argc, char **argv)
g_test_add_func ("/api/handle_has_sub", handle_has_sub);
g_test_add_func ("/api/handle_get_pixbuf", handle_get_pixbuf);
g_test_add_func ("/api/handle_get_pixbuf_sub", handle_get_pixbuf_sub);
+ g_test_add_func ("/api/dimensions_and_position", dimensions_and_position);
return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]