1
/* vim: set ts=4 nowrap ai expandtab sw=4: */
5
#include "test-utils.h"
7
typedef struct _FixtureData
9
const gchar *test_name;
10
const gchar *file_path;
17
test_dimensions (FixtureData *fixture)
20
RsvgDimensionData dimension;
24
target_file = g_build_filename (test_utils_get_test_data_path (),
25
fixture->file_path, NULL);
26
handle = rsvg_handle_new_from_file (target_file, &error);
28
g_assert_no_error (error);
31
rsvg_handle_get_dimensions_sub (handle, &dimension, fixture->id);
33
rsvg_handle_get_dimensions (handle, &dimension);
34
g_assert_cmpint (fixture->width, ==, dimension.width);
35
g_assert_cmpint (fixture->height, ==, dimension.height);
37
g_object_unref (handle);
40
static FixtureData fixtures[] =
42
{"/dimensions/no viewbox, width and height", "dimensions/bug608102.svg", NULL, 16, 16},
43
{"/dimensions/100% width and height", "dimensions/bug612951.svg", NULL, 45, 45},
44
{"/dimensions/viewbox only", "dimensions/bug614018.svg", NULL, 3, 2},
45
{"/dimensions/sub/rect no unit", "dimensions/sub-rect-no-unit.svg", "#rect-no-unit", 44, 45},
46
{"/dimensions/sub/rect with transform", "dimensions/bug564527.svg", "#back", 144, 203}
49
static const gint n_fixtures = G_N_ELEMENTS (fixtures);
52
main (int argc, char *argv[])
58
g_test_init (&argc, &argv, NULL);
60
for (i = 0; i < n_fixtures; i++)
61
g_test_add_data_func (fixtures[i].test_name, &fixtures[i], (void*)test_dimensions);
63
result = g_test_run ();