summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2014-03-08 11:32:14 +0000
committertavmjong-free <tavmjong@free.fr>2014-03-08 11:32:14 +0000
commit74ca8ed7b0fd0fd629231d6fa01db0e87bd0a546 (patch)
treec05aa9fea926904727f5181849cdf554ce85133f /src
parentReconnect correctly as documents are replaced. (diff)
downloadinkscape-74ca8ed7b0fd0fd629231d6fa01db0e87bd0a546.tar.gz
inkscape-74ca8ed7b0fd0fd629231d6fa01db0e87bd0a546.zip
Update attributes unit test, expand style unit test and fix bug found.
(bzr r13128)
Diffstat (limited to 'src')
-rw-r--r--src/attributes-test.h9
-rw-r--r--src/style-test.h55
-rw-r--r--src/style.cpp2
3 files changed, 62 insertions, 4 deletions
diff --git a/src/attributes-test.h b/src/attributes-test.h
index eee12d3c1..ba34717ea 100644
--- a/src/attributes-test.h
+++ b/src/attributes-test.h
@@ -150,6 +150,7 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
{"in", true},
{"in2", true},
{"intercept", true},
+ {"isolation", true},
{"k", true},
{"k1", true},
{"k2", true},
@@ -181,6 +182,7 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
{"media", false},
{"method", false},
{"min", true},
+ {"mix-blend-mode", true},
{"mode", true},
{"name", true},
{"numOctaves", true},
@@ -213,6 +215,7 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
{"overflow", true},
{"overline-position", true},
{"overline-thickness", true},
+ {"paint-order", true},
{"panose-1", true},
{"path", true},
{"pathLength", false},
@@ -276,9 +279,9 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
{"text-align", true},
{"text-anchor", true},
{"text-decoration", true},
- {"text-decoration-line", false},
- {"text-decoration-style", false},
- {"text-decoration-color", false},
+ {"text-decoration-line", true},
+ {"text-decoration-style", true},
+ {"text-decoration-color", true},
{"text-indent", true},
{"text-rendering", true},
{"text-transform", true},
diff --git a/src/style-test.h b/src/style-test.h
index 064773d1d..8a4055cc1 100644
--- a/src/style-test.h
+++ b/src/style-test.h
@@ -86,6 +86,59 @@ public:
// TestCase("fill:url(#painter) inherit", 0, "#painter"),
TestCase("fill:inherit"),
+
+// General tests (in order of appearance in sp_style_read), SPIPaint tested above
+ TestCase("visibility:hidden"), // SPIEnum
+ TestCase("visibility:collapse"),
+ TestCase("visibility:visible"),
+ TestCase("display:none"), // SPIEnum
+ TestCase("overflow:visible"), // SPIEnum
+ TestCase("overflow:auto"), // SPIEnum
+ TestCase("font-size:12", "font-size:12px"), // SPIFontSize
+ TestCase("font-size:12px"),
+ TestCase("font-size:12pt", "font-size:15px"),
+ TestCase("font-size:medium"),
+ TestCase("font-style:italic"), // SPIEnum
+ TestCase("font-variant:small-caps"), // SPIEnum
+ TestCase("font-weight:100"), // SPIEnum
+ TestCase("font-weight:normal"),
+ TestCase("font-weight:bolder"),
+ TestCase("font-stretch:condensed"), // SPIEnum
+ TestCase("text-indent:12em"), // SPILength?
+ TestCase("text-align:center"), // SPIEnum
+ TestCase("text-decoration: underline"), // SPITextDecoration
+ TestCase("line-height:24px"), // SPILengthOrNormal
+ TestCase("letter-spacing:2px"), // SPILengthOrNormal
+ TestCase("word-spacing:2px"), // SPILengthOrNormal
+ TestCase("text-transform:lowercase"), // SPIEnum
+ // ...
+ TestCase("baseline-shift:baseline"), // SPIBaselineShift
+ TestCase("baseline-shift:sub"),
+ TestCase("baseline-shift:12.5%"),
+ TestCase("baseline-shift:2px"),
+ TestCase("opacity:0.1"), // SPIScale24
+ // ...
+ TestCase("stroke-width:2px"), // SPILength
+ TestCase("stroke-linecap:round"), // SPIEnum
+ TestCase("stroke-linejoin:round"), // SPIEnum
+ TestCase("stroke-miterlimit:4"), // SPIFloat
+ TestCase("marker:url(#Arrow)"), // SPIString
+ TestCase("marker-start:url(#Arrow)"),
+ TestCase("marker-mid:url(#Arrow)"),
+ TestCase("marker-end:url(#Arrow)"),
+ TestCase("stroke-opacity:0.5"), // SPIScale24
+ TestCase("stroke-dasharray:0, 1, 0, 1"), // NRVpathDash
+ TestCase("stroke-dasharray:0 1 0 1","stroke-dasharray:0, 1, 0, 1"),
+ TestCase("stroke-dashoffset:13"), // NRVpathDash
+ // ...
+ TestCase("font-family:sans-serif"), // SPIString, text_private
+ //TestCase("filter:url(#myfilter)"), // filter
+
+ TestCase("opacity:0.1;fill:#ff0000;stroke:#0000ff;stroke-width:2px"),
+
+#ifdef WITH_SVG2
+ TestCase("paint-order:stroke"), // SPIPaintOrder
+#endif
TestCase(0)
};
@@ -107,8 +160,10 @@ public:
gchar *str0_set = sp_style_write_string( style, SP_STYLE_FLAG_IFSET );
//printf("<<%s>>\n", str0_set);
if ( cases[i].dst ) {
+ //std::cout << " " << std::string(str0_set) << " " << std::string(cases[i].dst) << std::endl;
TS_ASSERT_EQUALS( std::string(str0_set), std::string(cases[i].dst) );
} else {
+ //std::cout << " " << std::string(str0_set) << " " << std::string(cases[i].src) << std::endl;
TS_ASSERT_EQUALS( std::string(str0_set), std::string(cases[i].src) );
}
diff --git a/src/style.cpp b/src/style.cpp
index ad5aa17ae..f3a12db86 100644
--- a/src/style.cpp
+++ b/src/style.cpp
@@ -4785,7 +4785,7 @@ sp_style_write_ifontsize(gchar *p, gint const len, gchar const *key,
return g_snprintf(p, len, "%s:inherit;", key);
} else if (val->type == SP_FONT_SIZE_LITERAL) {
for (unsigned i = 0; enum_font_size[i].key; i++) {
- if (enum_font_size[i].value == static_cast< gint > (val->value) ) {
+ if (enum_font_size[i].value == static_cast< gint > (val->literal) ) {
return g_snprintf(p, len, "%s:%s;", key, enum_font_size[i].key);
}
}