mathematical 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/mathematical/extconf.rb +6 -1
- data/ext/mathematical/lasem/src/lsmdomcharacterdata.c +17 -0
- data/ext/mathematical/lasem/src/lsmdomdocument.c +17 -0
- data/ext/mathematical/lasem/src/lsmmathmlfencedelement.c +8 -6
- data/ext/mathematical/lasem/src/lsmmathmloperatorelement.c +8 -6
- data/ext/mathematical/lasem/src/lsmmathmlview.c +12 -7
- data/ext/mathematical/lasem/src/lsmmathmlview.h +2 -0
- data/ext/mathematical/lasem/src/lsmsvgsymbolelement.c +74 -0
- data/ext/mathematical/lasem/src/lsmsvgsymbolelement.h +3 -0
- data/ext/mathematical/lasem/src/lsmsvguseelement.c +10 -9
- data/ext/mathematical/lasem/src/lsmsvgview.c +12 -0
- data/ext/mathematical/lasem/src/lsmsvgview.h +1 -0
- data/ext/mathematical/lasem/tests/lsmtest.c +1 -1
- data/ext/mathematical/lasem/tests/suite.c +18 -1
- data/ext/mathematical/mtex2MML/src/lex.yy.c +4454 -4090
- data/ext/mathematical/mtex2MML/src/mtex2MML.h +1 -0
- data/ext/mathematical/mtex2MML/src/parse_extras.c +176 -41
- data/ext/mathematical/mtex2MML/src/parse_extras.h +30 -8
- data/ext/mathematical/mtex2MML/src/string_extras.c +5 -26
- data/ext/mathematical/mtex2MML/src/string_extras.h +1 -6
- data/ext/mathematical/mtex2MML/src/y.tab.c +6600 -5492
- data/ext/mathematical/mtex2MML/src/y.tab.h +572 -525
- data/lib/mathematical/version.rb +1 -1
- data/mathematical.gemspec +1 -1
- data/test/mathematical/basic_test.rb +1 -1
- data/test/mathematical/corrections_test.rb +1 -1
- data/test/mathematical/fixtures_test.rb +1 -1
- data/test/mathematical/maliciousness_test.rb +17 -17
- data/test/mathematical/mathjax_test.rb +2 -3
- data/test/mathematical/mathml_test.rb +1 -1
- data/test/mathematical/multiples_test.rb +1 -1
- data/test/mathematical/performance_test.rb +6 -8
- data/test/mathematical/png_test.rb +1 -1
- data/test/test_helper.rb +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 950af06de24ca977728f01092c6ded39e96f39fc
|
4
|
+
data.tar.gz: 29148c1fd98932067e1c81c54d30bbb982501817
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c9be59980546ff2fa68bed0dc4b4206cc4b9a4ec3b793189fa95355c912c51c0845787934c558004546136384e42c8d50957a4c75f13f66d4b6d0383319a5e4
|
7
|
+
data.tar.gz: 7d76ab7e62ea37b69f50cefb2f4c31767331ecd635850113ce1550acc19737755cda5cca95caf03f98121723d2a2a43c4f61f909f1539e87844b5b8a8971cd76
|
data/ext/mathematical/extconf.rb
CHANGED
@@ -20,12 +20,17 @@ find_header('libxml/xpathInternals.h', '/include/libxml2', '/usr/include/libxml2
|
|
20
20
|
FileUtils.cp_r(Dir.glob("#{LASEM_DIR}/*"), File.dirname(__FILE__))
|
21
21
|
File.delete(File.join(File.dirname(__FILE__), 'lasemrender.c'))
|
22
22
|
|
23
|
+
debug_file = File.join(File.dirname(__FILE__), 'mtex2MML_debug.cc')
|
24
|
+
if File.exists?(debug_file)
|
25
|
+
File.delete(File.join(File.dirname(__FILE__), 'mtex2MML_debug.cc'))
|
26
|
+
end
|
27
|
+
|
23
28
|
# build mtex2MML Bison files
|
24
29
|
Dir.chdir(MTEX_DIR) do
|
25
30
|
system 'make'
|
26
31
|
end
|
27
32
|
|
28
|
-
FileUtils.cp_r(Dir.glob("#{MTEX_DIR}/*.{c,h
|
33
|
+
FileUtils.cp_r(Dir.glob("#{MTEX_DIR}/*.{c,h}"), File.dirname(__FILE__))
|
29
34
|
FileUtils.cp_r("#{MTEX_DIR}/deps/.", File.dirname(__FILE__))
|
30
35
|
FileUtils.cp_r(Dir.glob("#{MTEX_DIR}/deps/**/*"), File.dirname(__FILE__))
|
31
36
|
|
@@ -57,6 +57,15 @@ lsm_dom_character_data_set_node_value (LsmDomNode* self, const char *value)
|
|
57
57
|
|
58
58
|
/* LsmDomCharacterData implementation */
|
59
59
|
|
60
|
+
/**
|
61
|
+
* lsm_dom_character_data_get_data:
|
62
|
+
* @self: a #LsmDomCharacterData
|
63
|
+
*
|
64
|
+
* Get the character node data.
|
65
|
+
*
|
66
|
+
* Return value: character node data.
|
67
|
+
*/
|
68
|
+
|
60
69
|
const char *
|
61
70
|
lsm_dom_character_data_get_data (LsmDomCharacterData* self)
|
62
71
|
{
|
@@ -65,6 +74,14 @@ lsm_dom_character_data_get_data (LsmDomCharacterData* self)
|
|
65
74
|
return self->data;
|
66
75
|
}
|
67
76
|
|
77
|
+
/**
|
78
|
+
* lsm_dom_character_data_set_data:
|
79
|
+
* @self: a #LsmDomCharacterData
|
80
|
+
* @value: new node data
|
81
|
+
*
|
82
|
+
* Set the character node data.
|
83
|
+
*/
|
84
|
+
|
68
85
|
void
|
69
86
|
lsm_dom_character_data_set_data (LsmDomCharacterData* self, const char * value)
|
70
87
|
{
|
@@ -57,6 +57,8 @@ lsm_dom_document_get_node_type (LsmDomNode *node)
|
|
57
57
|
* lsm_dom_document_get_document_element:
|
58
58
|
* @self: a #LsmDomElement
|
59
59
|
*
|
60
|
+
* Get the child node that is the root element of the document.
|
61
|
+
*
|
60
62
|
* Returns: (transfer none): document element
|
61
63
|
*/
|
62
64
|
|
@@ -73,6 +75,8 @@ lsm_dom_document_get_document_element (LsmDomDocument *self)
|
|
73
75
|
* @self: a #LsmDomDocument
|
74
76
|
* @tag_name: name of the element to create
|
75
77
|
*
|
78
|
+
* Create a new element node with a type corresponding to @tag_name.
|
79
|
+
*
|
76
80
|
* Returns: (transfer full): a newly created #LsmDomElement
|
77
81
|
*/
|
78
82
|
|
@@ -113,6 +117,8 @@ lsm_dom_document_create_text_node_base (LsmDomDocument *document, const char *da
|
|
113
117
|
* @self: a #LsmDomDocument
|
114
118
|
* @data: content of the text node
|
115
119
|
*
|
120
|
+
* Create a text node with @data as its initial content.
|
121
|
+
*
|
116
122
|
* Returns: (transfer full): a newly created #LsmDomText
|
117
123
|
*/
|
118
124
|
|
@@ -128,6 +134,8 @@ lsm_dom_document_create_text_node (LsmDomDocument *document, const char *data)
|
|
128
134
|
* lsm_dom_document_create_view:
|
129
135
|
* @self: a #LsmDomDocument
|
130
136
|
*
|
137
|
+
* Create a #LsmDomView for document rendering.
|
138
|
+
*
|
131
139
|
* Returns: (transfer full): a new #LsmDomView
|
132
140
|
*/
|
133
141
|
|
@@ -139,6 +147,15 @@ lsm_dom_document_create_view (LsmDomDocument *self)
|
|
139
147
|
return LSM_DOM_DOCUMENT_GET_CLASS (self)->create_view (self);
|
140
148
|
}
|
141
149
|
|
150
|
+
/**
|
151
|
+
* lsm_dom_document_get_url:
|
152
|
+
* @self: a #LsmDomDocument
|
153
|
+
*
|
154
|
+
* Get document URL.
|
155
|
+
*
|
156
|
+
* Return value: document URL.
|
157
|
+
*/
|
158
|
+
|
142
159
|
const char *
|
143
160
|
lsm_dom_document_get_url (LsmDomDocument *self)
|
144
161
|
{
|
@@ -55,18 +55,20 @@ lsm_mathml_fenced_element_measure (LsmMathmlElement *self, LsmMathmlView *view,
|
|
55
55
|
|
56
56
|
if (open != NULL && open[0] != '\0') {
|
57
57
|
lsm_mathml_view_measure_operator (view, &self->style,
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
open, FALSE, TRUE,
|
59
|
+
axis_offset,
|
60
|
+
0, G_MAXDOUBLE,
|
61
|
+
&stretch_bbox, &fenced->open_bbox);
|
61
62
|
spacing += self->style.math_size * LSM_MATHML_SPACE_EM_THIN;
|
62
63
|
} else
|
63
64
|
fenced->open_bbox = lsm_mathml_bbox_null;
|
64
65
|
|
65
66
|
if (close != NULL && close[0] != '\0') {
|
66
67
|
lsm_mathml_view_measure_operator (view, &self->style,
|
67
|
-
|
68
|
-
|
69
|
-
|
68
|
+
close, FALSE, TRUE,
|
69
|
+
axis_offset,
|
70
|
+
0, G_MAXDOUBLE,
|
71
|
+
&stretch_bbox, &fenced->close_bbox);
|
70
72
|
spacing += self->style.math_size * LSM_MATHML_SPACE_EM_THIN;
|
71
73
|
} else
|
72
74
|
fenced->close_bbox = lsm_mathml_bbox_null;
|
@@ -152,12 +152,14 @@ lsm_mathml_operator_element_measure (LsmMathmlElement *self, LsmMathmlView *view
|
|
152
152
|
self->bbox = lsm_mathml_bbox_null;
|
153
153
|
|
154
154
|
lsm_mathml_view_measure_operator (view, &self->style,
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
155
|
+
text,
|
156
|
+
operator_element->is_large_op,
|
157
|
+
operator_element->symmetric.value,
|
158
|
+
lsm_mathml_view_measure_axis_offset (view, self->style.math_size),
|
159
|
+
operator_element->min_size.value,
|
160
|
+
operator_element->max_size.value,
|
161
|
+
operator_element->stretchy.value ? stretch_bbox : &lsm_mathml_bbox_null,
|
162
|
+
&self->bbox);
|
161
163
|
|
162
164
|
g_free (text);
|
163
165
|
|
@@ -361,12 +361,15 @@ lsm_mathml_view_update_layout_for_operator (LsmMathmlView *view,
|
|
361
361
|
|
362
362
|
void
|
363
363
|
lsm_mathml_view_measure_operator (LsmMathmlView *view,
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
364
|
+
const LsmMathmlElementStyle *style,
|
365
|
+
char const *text,
|
366
|
+
gboolean large,
|
367
|
+
gboolean symmetric,
|
368
|
+
double axis_offset,
|
369
|
+
double min_size, /* TODO actually use this parameter */
|
370
|
+
double max_size, /* TODO actually use this parameter */
|
371
|
+
LsmMathmlBbox const *stretch_bbox,
|
372
|
+
LsmMathmlBbox *bbox)
|
370
373
|
{
|
371
374
|
PangoFontDescription *font_description;
|
372
375
|
PangoLayout *pango_layout;
|
@@ -658,7 +661,9 @@ lsm_mathml_view_measure_radical (LsmMathmlView *view,
|
|
658
661
|
radical_stretch_bbox.depth += LSM_MATHML_SPACE_EM_THICK * style->math_size;
|
659
662
|
|
660
663
|
lsm_mathml_view_measure_operator (view, style, LSM_MATHML_RADICAL_UTF8,
|
661
|
-
FALSE, FALSE, 0.0,
|
664
|
+
FALSE, FALSE, 0.0,
|
665
|
+
0, G_MAXDOUBLE,
|
666
|
+
&radical_stretch_bbox, bbox);
|
662
667
|
|
663
668
|
if (x_offset != NULL) {
|
664
669
|
*x_offset = bbox->width * LSM_MATHML_RADICAL_ORDER_X_OFFSET;
|
@@ -111,6 +111,8 @@ void lsm_mathml_view_measure_operator (LsmMathmlView *view,
|
|
111
111
|
char const *text,
|
112
112
|
gboolean large, gboolean symmetric,
|
113
113
|
double axis_offset,
|
114
|
+
double min_size,
|
115
|
+
double max_size,
|
114
116
|
const LsmMathmlBbox *stretch_bbox,
|
115
117
|
LsmMathmlBbox *bbox);
|
116
118
|
void lsm_mathml_view_show_operator (LsmMathmlView *view,
|
@@ -22,7 +22,9 @@
|
|
22
22
|
*/
|
23
23
|
|
24
24
|
#include <lsmsvgsymbolelement.h>
|
25
|
+
#include <lsmsvguseelement.h>
|
25
26
|
#include <lsmsvgview.h>
|
27
|
+
#include <lsmsvgtraits.h>
|
26
28
|
#include <lsmdebug.h>
|
27
29
|
#include <lsmdomdocument.h>
|
28
30
|
#include <stdio.h>
|
@@ -41,6 +43,49 @@ lsm_svg_symbol_element_get_node_name (LsmDomNode *node)
|
|
41
43
|
|
42
44
|
/* LsmSvgGraphic implementation */
|
43
45
|
|
46
|
+
static void
|
47
|
+
_symbol_element_render (LsmSvgElement *self, LsmSvgView *view)
|
48
|
+
{
|
49
|
+
LsmSvgSymbolElement *symbol = LSM_SVG_SYMBOL_ELEMENT (self);
|
50
|
+
LsmSvgUseElement *use_element;
|
51
|
+
LsmSvgElement *element;
|
52
|
+
LsmSvgStyle *style;
|
53
|
+
LsmBox viewport;
|
54
|
+
gboolean is_viewbox_defined;
|
55
|
+
|
56
|
+
element = lsm_svg_view_get_referencing_element (view);
|
57
|
+
if (!LSM_IS_SVG_USE_ELEMENT (element))
|
58
|
+
return;
|
59
|
+
|
60
|
+
use_element = LSM_SVG_USE_ELEMENT (element);
|
61
|
+
|
62
|
+
style = lsm_svg_view_get_current_style (view);
|
63
|
+
|
64
|
+
viewport.x = 0;
|
65
|
+
viewport.y = 0;
|
66
|
+
viewport.width = lsm_svg_view_normalize_length (view, &use_element->width.length, LSM_SVG_LENGTH_DIRECTION_HORIZONTAL);
|
67
|
+
viewport.height = lsm_svg_view_normalize_length (view, &use_element->height.length, LSM_SVG_LENGTH_DIRECTION_VERTICAL);
|
68
|
+
|
69
|
+
is_viewbox_defined = lsm_attribute_is_defined ((LsmAttribute *) &symbol->viewbox);
|
70
|
+
|
71
|
+
if (is_viewbox_defined && (symbol->viewbox.value.width == 0.0 ||
|
72
|
+
symbol->viewbox.value.height == 0.0))
|
73
|
+
return;
|
74
|
+
|
75
|
+
if (viewport.width <= 0.0 || viewport.height <= 0.0)
|
76
|
+
return;
|
77
|
+
|
78
|
+
lsm_debug_render ("[LsmSvgSymbolElement::render] viewport %g, %g, %g, %g",
|
79
|
+
viewport.x, viewport.y, viewport.width, viewport.height);
|
80
|
+
|
81
|
+
lsm_svg_view_push_viewport (view, &viewport, is_viewbox_defined ? &symbol->viewbox.value : NULL,
|
82
|
+
&symbol->preserve_aspect_ratio.value, style->overflow->value);
|
83
|
+
|
84
|
+
LSM_SVG_ELEMENT_CLASS (parent_class)->render (self, view);
|
85
|
+
|
86
|
+
lsm_svg_view_pop_viewport (view);
|
87
|
+
}
|
88
|
+
|
44
89
|
/* LsmSvgSymbolElement implementation */
|
45
90
|
|
46
91
|
LsmDomNode *
|
@@ -49,6 +94,13 @@ lsm_svg_symbol_element_new (void)
|
|
49
94
|
return g_object_new (LSM_TYPE_SVG_SYMBOL_ELEMENT, NULL);
|
50
95
|
}
|
51
96
|
|
97
|
+
static const LsmBox viewbox_default = {0.0, 0.0, 0.0, 0.0};
|
98
|
+
static const LsmSvgPreserveAspectRatio preserve_aspect_ratio_default = {
|
99
|
+
.defer = FALSE,
|
100
|
+
.align = LSM_SVG_ALIGN_X_MID_Y_MID,
|
101
|
+
.meet_or_slice = LSM_SVG_MEET_OR_SLICE_MEET
|
102
|
+
};
|
103
|
+
|
52
104
|
static void
|
53
105
|
lsm_svg_symbol_element_init (LsmSvgSymbolElement *self)
|
54
106
|
{
|
@@ -56,6 +108,21 @@ lsm_svg_symbol_element_init (LsmSvgSymbolElement *self)
|
|
56
108
|
|
57
109
|
/* LsmSvgSymbolElement class */
|
58
110
|
|
111
|
+
static const LsmAttributeInfos lsm_svg_symbol_element_attribute_infos[] = {
|
112
|
+
{
|
113
|
+
.name = "viewBox",
|
114
|
+
.attribute_offset = offsetof (LsmSvgSymbolElement, viewbox),
|
115
|
+
.trait_class = &lsm_box_trait_class,
|
116
|
+
.trait_default = &viewbox_default
|
117
|
+
},
|
118
|
+
{
|
119
|
+
.name = "preserveAspectRatio",
|
120
|
+
.attribute_offset = offsetof (LsmSvgSymbolElement, preserve_aspect_ratio),
|
121
|
+
.trait_class = &lsm_svg_preserve_aspect_ratio_trait_class,
|
122
|
+
.trait_default = &preserve_aspect_ratio_default
|
123
|
+
}
|
124
|
+
};
|
125
|
+
|
59
126
|
static void
|
60
127
|
lsm_svg_symbol_element_class_init (LsmSvgSymbolElementClass *klass)
|
61
128
|
{
|
@@ -69,6 +136,13 @@ lsm_svg_symbol_element_class_init (LsmSvgSymbolElementClass *klass)
|
|
69
136
|
s_element_class->category =
|
70
137
|
LSM_SVG_ELEMENT_CATEGORY_CONTAINER |
|
71
138
|
LSM_SVG_ELEMENT_CATEGORY_STRUCTURAL;
|
139
|
+
|
140
|
+
s_element_class->render = _symbol_element_render;
|
141
|
+
s_element_class->attribute_manager = lsm_attribute_manager_duplicate (s_element_class->attribute_manager);
|
142
|
+
|
143
|
+
lsm_attribute_manager_add_attributes (s_element_class->attribute_manager,
|
144
|
+
G_N_ELEMENTS (lsm_svg_symbol_element_attribute_infos),
|
145
|
+
lsm_svg_symbol_element_attribute_infos);
|
72
146
|
}
|
73
147
|
|
74
148
|
G_DEFINE_TYPE (LsmSvgSymbolElement, lsm_svg_symbol_element, LSM_TYPE_SVG_ELEMENT)
|
@@ -40,6 +40,9 @@ typedef struct _LsmSvgSymbolElementClass LsmSvgSymbolElementClass;
|
|
40
40
|
|
41
41
|
struct _LsmSvgSymbolElement {
|
42
42
|
LsmSvgElement element;
|
43
|
+
|
44
|
+
LsmSvgViewboxAttribute viewbox;
|
45
|
+
LsmSvgPreserveAspectRatioAttribute preserve_aspect_ratio;
|
43
46
|
};
|
44
47
|
|
45
48
|
struct _LsmSvgSymbolElementClass {
|
@@ -164,15 +164,16 @@ lsm_svg_use_element_new (void)
|
|
164
164
|
return g_object_new (LSM_TYPE_SVG_USE_ELEMENT, NULL);
|
165
165
|
}
|
166
166
|
|
167
|
-
static const LsmSvgLength
|
167
|
+
static const LsmSvgLength position_default = { .value_unit = 0.0, .type = LSM_SVG_LENGTH_TYPE_PX};
|
168
|
+
static const LsmSvgLength size_default = { .value_unit = 100.0, .type = LSM_SVG_LENGTH_TYPE_PERCENTAGE};
|
168
169
|
|
169
170
|
static void
|
170
171
|
lsm_svg_use_element_init (LsmSvgUseElement *self)
|
171
172
|
{
|
172
|
-
self->x.length =
|
173
|
-
self->y.length =
|
174
|
-
self->width.length =
|
175
|
-
self->height.length =
|
173
|
+
self->x.length = position_default;
|
174
|
+
self->y.length = position_default;
|
175
|
+
self->width.length = size_default;
|
176
|
+
self->height.length = size_default;
|
176
177
|
}
|
177
178
|
|
178
179
|
/* LsmSvgUseElement class */
|
@@ -182,25 +183,25 @@ static const LsmAttributeInfos lsm_svg_use_element_attribute_infos[] = {
|
|
182
183
|
.name = "x",
|
183
184
|
.attribute_offset = offsetof (LsmSvgUseElement, x),
|
184
185
|
.trait_class = &lsm_svg_length_trait_class,
|
185
|
-
.trait_default = &
|
186
|
+
.trait_default = &position_default
|
186
187
|
},
|
187
188
|
{
|
188
189
|
.name = "y",
|
189
190
|
.attribute_offset = offsetof (LsmSvgUseElement, y),
|
190
191
|
.trait_class = &lsm_svg_length_trait_class,
|
191
|
-
.trait_default = &
|
192
|
+
.trait_default = &position_default
|
192
193
|
},
|
193
194
|
{
|
194
195
|
.name = "width",
|
195
196
|
.attribute_offset = offsetof (LsmSvgUseElement, width),
|
196
197
|
.trait_class = &lsm_svg_length_trait_class,
|
197
|
-
.trait_default = &
|
198
|
+
.trait_default = &size_default
|
198
199
|
},
|
199
200
|
{
|
200
201
|
.name = "height",
|
201
202
|
.attribute_offset = offsetof (LsmSvgUseElement, height),
|
202
203
|
.trait_class = &lsm_svg_length_trait_class,
|
203
|
-
.trait_default = &
|
204
|
+
.trait_default = &size_default
|
204
205
|
},
|
205
206
|
{
|
206
207
|
.name = "xlink:href",
|
@@ -2226,6 +2226,18 @@ lsm_svg_view_pop_element (LsmSvgView *view)
|
|
2226
2226
|
view->element_stack = g_slist_delete_link (view->element_stack, view->element_stack);
|
2227
2227
|
}
|
2228
2228
|
|
2229
|
+
LsmSvgElement *
|
2230
|
+
lsm_svg_view_get_referencing_element (LsmSvgView *view)
|
2231
|
+
{
|
2232
|
+
g_return_val_if_fail (LSM_IS_SVG_VIEW (view), NULL);
|
2233
|
+
|
2234
|
+
if (view->element_stack == NULL ||
|
2235
|
+
view->element_stack->next == NULL)
|
2236
|
+
return NULL;
|
2237
|
+
|
2238
|
+
return view->element_stack->next->data;
|
2239
|
+
}
|
2240
|
+
|
2229
2241
|
static gboolean
|
2230
2242
|
lsm_svg_view_circular_reference_check (LsmSvgView *view, LsmSvgElement *element)
|
2231
2243
|
{
|
@@ -155,6 +155,7 @@ void lsm_svg_view_pop_matrix (LsmSvgView *view);
|
|
155
155
|
|
156
156
|
void lsm_svg_view_push_element (LsmSvgView *view, const LsmSvgElement *element);
|
157
157
|
void lsm_svg_view_pop_element (LsmSvgView *view);
|
158
|
+
LsmSvgElement * lsm_svg_view_get_referencing_element (LsmSvgView *view);
|
158
159
|
|
159
160
|
void lsm_svg_view_push_style (LsmSvgView *view, LsmSvgStyle *style);
|
160
161
|
void lsm_svg_view_pop_style (LsmSvgView *view);
|
@@ -61,7 +61,7 @@ static gboolean option_debug_mask = FALSE;
|
|
61
61
|
static gboolean option_debug_group = FALSE;
|
62
62
|
static gboolean option_debug_text = FALSE;
|
63
63
|
static gboolean option_dry_run = FALSE;
|
64
|
-
static double option_compare_fuzz =
|
64
|
+
static double option_compare_fuzz = 15.0;
|
65
65
|
|
66
66
|
static const GOptionEntry entries[] =
|
67
67
|
{
|
@@ -2,6 +2,8 @@
|
|
2
2
|
#include <string.h>
|
3
3
|
#include <lsmdom.h>
|
4
4
|
|
5
|
+
GKeyFile *suite_options;
|
6
|
+
|
5
7
|
static GSList *
|
6
8
|
build_file_list (const char *path, GRegex *filename_regex)
|
7
9
|
{
|
@@ -47,6 +49,7 @@ static void
|
|
47
49
|
render_test (gconstpointer user_data)
|
48
50
|
{
|
49
51
|
const char *filename = user_data;
|
52
|
+
char *basename;
|
50
53
|
LsmDomDocument *document;
|
51
54
|
LsmDomView *view;
|
52
55
|
LsmBox viewport;
|
@@ -54,6 +57,8 @@ render_test (gconstpointer user_data)
|
|
54
57
|
cairo_t *cairo;
|
55
58
|
cairo_surface_t *surface;
|
56
59
|
|
60
|
+
basename = g_path_get_basename (filename);
|
61
|
+
|
57
62
|
document = lsm_dom_document_new_from_path (filename, NULL);
|
58
63
|
g_assert (LSM_IS_DOM_DOCUMENT (document));
|
59
64
|
|
@@ -76,13 +81,20 @@ render_test (gconstpointer user_data)
|
|
76
81
|
|
77
82
|
if (cairo_status (cairo) == CAIRO_STATUS_SUCCESS) {
|
78
83
|
lsm_dom_view_render (LSM_DOM_VIEW (view), cairo, 1, 1);
|
79
|
-
|
84
|
+
|
85
|
+
if (cairo_status (cairo) != CAIRO_STATUS_SUCCESS) {
|
86
|
+
g_test_message ("cairo_status = %s", cairo_status_to_string (cairo_status (cairo)));
|
87
|
+
if (!g_key_file_get_boolean (suite_options, basename, "ignore-cairo-status", NULL))
|
88
|
+
g_test_fail ();
|
89
|
+
}
|
80
90
|
}
|
81
91
|
|
82
92
|
cairo_destroy (cairo);
|
83
93
|
|
84
94
|
g_object_unref (view);
|
85
95
|
g_object_unref (document);
|
96
|
+
|
97
|
+
g_free (basename);
|
86
98
|
}
|
87
99
|
|
88
100
|
static void
|
@@ -107,6 +119,9 @@ main (int argc, char *argv[])
|
|
107
119
|
g_type_init ();
|
108
120
|
#endif
|
109
121
|
|
122
|
+
suite_options = g_key_file_new ();
|
123
|
+
g_assert (g_key_file_load_from_file (suite_options, SUITE_OPTION_FILE, G_KEY_FILE_NONE, NULL));
|
124
|
+
|
110
125
|
g_test_init (&argc, &argv, NULL);
|
111
126
|
|
112
127
|
filename_regex = g_regex_new ("\\.(svg|mml)$", 0, 0, NULL);
|
@@ -119,6 +134,8 @@ main (int argc, char *argv[])
|
|
119
134
|
g_slist_free (files);
|
120
135
|
g_regex_unref (filename_regex);
|
121
136
|
|
137
|
+
g_key_file_free (suite_options);
|
138
|
+
|
122
139
|
lsm_shutdown ();
|
123
140
|
|
124
141
|
return result;
|