Removed the styles tests; they have been unused for a long while

parent 5cabc8ee
......@@ -14,8 +14,6 @@ test_programs = \
errors \
infinite-loop
# Removed "styles" from the above; it is broken right now
test_utils_common_sources = \
test-utils.c \
test-utils.h
......@@ -44,10 +42,6 @@ render_crash_SOURCES = \
render-crash.c \
$(test_utils_common_sources)
# styles_SOURCES = \
# styles.c \
# $(test_utils_common_sources)
dimensions_SOURCES = \
dimensions.c \
$(test_utils_common_sources)
......@@ -88,8 +82,7 @@ dist_installed_test_data = \
$(wildcard $(srcdir)/fixtures/reftests/svg1.1/images/*) \
$(wildcard $(srcdir)/fixtures/reftests/svg1.1/resources/*) \
$(wildcard $(srcdir)/fixtures/render-crash/*.svg) \
$(wildcard $(srcdir)/fixtures/dimensions/*.svg) \
$(wildcard $(srcdir)/fixtures/styles/*.svg)
$(wildcard $(srcdir)/fixtures/dimensions/*.svg)
clean-local:
rm -rf output
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" width="128" height="128" id="etiquette-icon">
<style type="text/css">
<!--really this stuff should in a be external css file -->
<![CDATA[
/* PLEASE PLEASE PLEASE PLEASE FIX OH THIS RSVG GODS .... you're my only hope */
#computer-monitor path{stroke: #000; stroke-width: 2px; fill-opacity: 0.55;}
/* non contextural Styles that work well in rsvg*/
.skyblue3 {fill:#204a87;}
.black {fill:#000000;}
.white {fill:#ffffff;}
.aluminium1 {fill:#eeeeec;}
.low-shade {opacity:0.25;}
.specularity {opacity:0.5;}
.high-shade {opacity:0.75;}
.full-shade {opacity:1;}
.low-specularity {opacity:0.25;}
.specularity {opacity:0.5;}
.high-specularity {opacity:0.75;}
.full-specularity {opacity:1;}
.stroke-black {stroke:#000000;}
.stroke-white {stroke:#ffffff;}
.aluminium4 {fill:#888a85;}
]]>
</style>
<defs id="definitions">
<linearGradient id="WhiteTransparent"><stop style="stop-color:white;stop-opacity:1" offset="0" /><stop style="stop-color:white;stop-opacity:0" offset="1" /></linearGradient>
<linearGradient id="BlackTransparent"><stop style="stop-color:black;stop-opacity:1" offset="0" /><stop style="stop-color:black;stop-opacity:0" offset="1" /></linearGradient>
<radialGradient cx="40.31" cy="479.61" r="66.26" fx="40.31" fy="479.61" id="radialGradient6330" xlink:href="#BlackTransparent" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.97,0,0,0.23,24.91,-9.95e-2)" />
<linearGradient x1="57.70" y1="21.05" x2="57.70" y2="93.67" id="linearGradient6341" xlink:href="#WhiteTransparent" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.18,0,0,0.65,7.28,6.28)" />
<linearGradient x1="61" y1="103" x2="61" y2="16" id="linearGradient6344" xlink:href="#WhiteTransparent" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.15,0,0,0.79,2.02,2.17)" />
<linearGradient x1="75.97" y1="99.13" x2="75.97" y2="87.68" id="linearGradient6347" xlink:href="#WhiteTransparent" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.08,0,0,0.86,6.29,-7.90)" />
<linearGradient x1="64.00" y1="97.70" x2="64.00" y2="4.53" id="linearGradient6352" xlink:href="#BlackTransparent" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.95,0,0,0.95,3.23,3.22)" />
<linearGradient x1="36.93" y1="225.90" x2="36.93" y2="184.39" id="linearGradient6358" xlink:href="#WhiteTransparent" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.82,0,0,0.46,3.18,5.37)" />
</defs>
<g id="computer-monitor">
<path d="M 127.78,110.55 C 127.78,118.81 99.23,125.50 64.00,125.50 C 28.77,125.50 0.22,118.81 0.22,110.55 C 0.22,102.30 28.77,95.61 64.00,95.61 C 92.89,95.61 117.29,100.11 125.13,106.28 C 126.85,107.64 127.78,109.07 127.78,110.55 z " style="opacity:0.25;fill:url(#radialGradient6330)" id="base_shadow" />
<g id="monitor-stand" >
<path d="M 47.62,93.47 L 47.62,101.85 C 47.62,107.48 32.30,104.25 32.30,109.87 L 32.30,112.32 L 95.46,112.32 L 95.46,109.23 C 95.46,103.61 80.09,107.48 80.09,101.85 L 80.09,93.47 L 47.62,93.47 z " class="aluminium4" />
<path d="M 47.59,101.94 C 47.59,107.01 33.36102,104.6073 32.432943,109.2 L 95.594366,109.2 C 95.594366,103.73809 80.12,107.326 80.12,102 C 70,96.162436 57.357567,96.304 47.59,101.94375 z " class="high-specularity" style="fill:url(#linearGradient6358)" />
</g>
<g id="computer-screen" >
<path d="M 8.00,11.04 C 8.00,9.16 9.69,8.05 11.57,8.05 L 116.61,8.05 C 118.48,8.05 120.00,10.16 120.00,12.05 L 120.00,92.36 C 120.00,94.25 118.24,96.00 116.37,96.00 L 11.69,96.00 C 9.82,96.00 8.00,94.48 8.00,92.60 L 8.00,11.04 z " class="aluminium1" />
<path d="M 8.00,11.04 C 8.00,9.16 9.69,8.05 11.57,8.05 L 116.61,8.05 C 118.48,8.05 120.00,10.16 120.00,12.05 L 120.00,92.36 C 120.00,94.25 118.24,96.00 116.37,96.00 L 11.69,96.00 C 9.82,96.00 8.00,94.48 8.00,92.60 L 8.00,11.04 z " class="low-shade" style="fill:url(#linearGradient6352);" />
<path d="M 17.19,17.34 L 110.52,17.34 L 110.52,81.61 L 17.19,81.61 L 17.19,17.34 z " class="skyblue3" />
<path d="M 107.38,65.19 L 107.38,78.62 L 85.56,78.62 L 41.92,78.62 L 20.10,78.62 L 20.10,65.19 L 107.38,65.19 z " class="low-specularity" style="fill:url(#linearGradient6347)" />
<path d="M 15.70,16.08 L 111.67,16.08 L 111.67,82.69 L 15.70,82.69 L 15.70,16.08 z " class="high-specularity" style="fill:none;stroke:url(#linearGradient6344);" />
<path d="M 20.04,19.52 L 107.45,19.52 L 107.45,32.73 C 67.64,33.66 37.09,50.64 20.04,67.62 L 20.04,19.52 z " class="specularity" style="fill:url(#linearGradient6341)" />
</g>
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" width="128" height="128" id="etiquette-icon">
<style type="text/css">
<!--really this stuff should in a be external css file -->
<![CDATA[
/* PLEASE PLEASE PLEASE PLEASE FIX OH THIS RSVG GODS .... you're my only hope */
/* non contextural Styles that work well in rsvg*/
path {stroke: white; stroke-width:1pt;}
path {stroke: pink !important;stroke-width:5pt !important;}
]]>
</style>
<defs id="definitions">
<linearGradient id="WhiteTransparent"><stop style="stop-color:white;stop-opacity:1" offset="0" /><stop style="stop-color:white;stop-opacity:0" offset="1" /></linearGradient>
<linearGradient id="BlackTransparent"><stop style="stop-color:black;stop-opacity:1" offset="0" /><stop style="stop-color:black;stop-opacity:0" offset="1" /></linearGradient>
<radialGradient cx="40.31" cy="479.61" r="66.26" fx="40.31" fy="479.61" id="radialGradient6330" xlink:href="#BlackTransparent" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.97,0,0,0.23,24.91,-9.95e-2)" />
<linearGradient x1="57.70" y1="21.05" x2="57.70" y2="93.67" id="linearGradient6341" xlink:href="#WhiteTransparent" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.18,0,0,0.65,7.28,6.28)" />
<linearGradient x1="61" y1="103" x2="61" y2="16" id="linearGradient6344" xlink:href="#WhiteTransparent" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.15,0,0,0.79,2.02,2.17)" />
<linearGradient x1="75.97" y1="99.13" x2="75.97" y2="87.68" id="linearGradient6347" xlink:href="#WhiteTransparent" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.08,0,0,0.86,6.29,-7.90)" />
<linearGradient x1="64.00" y1="97.70" x2="64.00" y2="4.53" id="linearGradient6352" xlink:href="#BlackTransparent" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.95,0,0,0.95,3.23,3.22)" />
<linearGradient x1="36.93" y1="225.90" x2="36.93" y2="184.39" id="linearGradient6358" xlink:href="#WhiteTransparent" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.82,0,0,0.46,3.18,5.37)" />
</defs>
<g id="computer-monitor">
<path d="M 127.78,110.55 C 127.78,118.81 99.23,125.50 64.00,125.50 C 28.77,125.50 0.22,118.81 0.22,110.55 C 0.22,102.30 28.77,95.61 64.00,95.61 C 92.89,95.61 117.29,100.11 125.13,106.28 C 126.85,107.64 127.78,109.07 127.78,110.55 z " style="opacity:0.25;fill:url(#radialGradient6330)" id="base_shadow" />
<g id="monitor-stand" >
<path d="M 47.62,93.47 L 47.62,101.85 C 47.62,107.48 32.30,104.25 32.30,109.87 L 32.30,112.32 L 95.46,112.32 L 95.46,109.23 C 95.46,103.61 80.09,107.48 80.09,101.85 L 80.09,93.47 L 47.62,93.47 z " class="aluminium4" />
<path d="M 47.59,101.94 C 47.59,107.01 33.36102,104.6073 32.432943,109.2 L 95.594366,109.2 C 95.594366,103.73809 80.12,107.326 80.12,102 C 70,96.162436 57.357567,96.304 47.59,101.94375 z " class="high-specularity" style="fill:url(#linearGradient6358)" />
</g>
<g id="computer-screen" >
<path d="M 8.00,11.04 C 8.00,9.16 9.69,8.05 11.57,8.05 L 116.61,8.05 C 118.48,8.05 120.00,10.16 120.00,12.05 L 120.00,92.36 C 120.00,94.25 118.24,96.00 116.37,96.00 L 11.69,96.00 C 9.82,96.00 8.00,94.48 8.00,92.60 L 8.00,11.04 z " class="aluminium1" />
<path d="M 8.00,11.04 C 8.00,9.16 9.69,8.05 11.57,8.05 L 116.61,8.05 C 118.48,8.05 120.00,10.16 120.00,12.05 L 120.00,92.36 C 120.00,94.25 118.24,96.00 116.37,96.00 L 11.69,96.00 C 9.82,96.00 8.00,94.48 8.00,92.60 L 8.00,11.04 z " class="low-shade" style="fill:url(#linearGradient6352);" />
<path d="M 17.19,17.34 L 110.52,17.34 L 110.52,81.61 L 17.19,81.61 L 17.19,17.34 z " class="skyblue3" />
<path d="M 107.38,65.19 L 107.38,78.62 L 85.56,78.62 L 41.92,78.62 L 20.10,78.62 L 20.10,65.19 L 107.38,65.19 z " class="low-specularity" style="fill:url(#linearGradient6347)" />
<path d="M 15.70,16.08 L 111.67,16.08 L 111.67,82.69 L 15.70,82.69 L 15.70,16.08 z " class="high-specularity" style="fill:none;stroke:url(#linearGradient6344);" />
<path d="M 20.04,19.52 L 107.45,19.52 L 107.45,32.73 C 67.64,33.66 37.09,50.64 20.04,67.62 L 20.04,19.52 z " class="specularity" style="fill:url(#linearGradient6341)" />
</g>
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="100" height="100" version="1.0">
<defs>
<style type="text/css">
path { fill: #ff0000 }
#bla { fill: #00ff00 }
</style>
</defs>
<path id="bla" d="M 50,20 L 20,80 L 80,80 z " />
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="100px" height="100px" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style type="text/css"><![CDATA[
rect { fill: #ff0000; }
.class1 { stroke: #0000ff; }
]]>
</style>
</defs>
<rect id="target" x="20" y="20" width="50" height="50" class="class1"/>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- <?xml-stylesheet type="text/css" href="inject.css" ?> -->
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
width="16"
height="16"
id="svg7384"
inkscape:version="0.47+devel r9222 custom"
sodipodi:docname="battery-critical-charging-symbolic.svg">
<style type="text/css">
<![CDATA[rect,path {
fill:#000000 !important;
/* fill-opacity:1 !important; */
}
.critical {
fill: red !important;
}]]>
</style>
<metadata
id="metadata84369">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="640"
inkscape:window-height="480"
id="namedview84367"
showgrid="false"
inkscape:zoom="21.125"
inkscape:cx="8"
inkscape:cy="8"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="svg7384" />
<title
id="title9167">Moblin Icon Theme</title>
<defs
id="defs7386" />
<g
transform="translate(-179.99975,-236.00025)"
id="layer3"
style="display:inline">
<path
d="m 182.99975,247 0,2 3.00025,0 0,-2 -3.00025,0 z"
id="path6306"
style="fill:#bebebe;fill-opacity:1;stroke:none"
class="critical"
inkscape:label="crit" />
<path
d="m 183.46875,236.03125 c -0.49033,0 -0.79607,0.22845 -1.03125,0.46875 -0.23518,0.2403 -0.4375,0.55851 -0.4375,1.03125 l 0,0.46875 -1,0 -1,0 0,1 0,12 0,1 1,0 7,0 0,-2 -6,0 0,-10 1,0 1,0 0,-1 0,-0.96875 3,0 0,0.96875 0,1 1,0 1,0 0,3 2,0 0,-4 0,-1 -1,0 -1,0 0,-0.34375 0,-0.0312 c -0.0239,-0.4306 -0.17024,-0.75229 -0.40625,-1.03125 -0.22373,-0.26444 -0.62669,-0.52931 -1.15625,-0.53125 l 0,-0.0312 -0.0625,0 -3.90625,0 z"
id="path6308"
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Abandoned Bitplane;-inkscape-font-specification:Abandoned Bitplane" />
<path
d="m 190.875,244 a 1.0001,1.0001 0 0 0 -0.59375,0.28125 l -3,3 A 1.0001,1.0001 0 0 0 188,249 l 2.5625,0 -1.28125,1.28125 a 1.016466,1.016466 0 1 0 1.4375,1.4375 l 3,-3 A 1.0001,1.0001 0 0 0 193,247 l -2.5625,0 1.28125,-1.28125 A 1.0001,1.0001 0 0 0 190.875,244 z"
id="path6312"
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Abandoned Bitplane;-inkscape-font-specification:Abandoned Bitplane" />
<rect
width="1"
height="1"
x="193"
y="247"
id="rect6314"
style="color:#000000;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
width="1"
height="1"
x="187"
y="248"
id="rect6316"
style="color:#000000;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
width="1"
height="1"
x="191"
y="244"
id="rect6318"
style="color:#000000;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
width="1"
height="1"
x="189"
y="251"
id="rect6320"
style="color:#000000;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<path
d="m 190.15625,244.4375 -2,3 1.6875,1.125 2,-3 -1.6875,-1.125 z"
id="path6322"
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Abandoned Bitplane;-inkscape-font-specification:Abandoned Bitplane" />
<path
d="m 191.15625,247.4375 -2,3 1.6875,1.125 2,-3 -1.6875,-1.125 z"
id="path6324"
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#000000;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Abandoned Bitplane;-inkscape-font-specification:Abandoned Bitplane" />
<path
d="m 189,244 2,-2 -2,0 0,2 z"
id="path6326"
style="color:#000000;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</g>
<g
transform="translate(-179.99975,-236.00025)"
id="layer2" />
<g
transform="translate(-179.99975,-236.00025)"
id="layer1">
</g>
</svg>
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="5cm" height="2.5cm" viewBox="0 0 1000 500"
xmlns="http://www.w3.org/2000/svg" version="1.1">
<style type="text/css">
rect, path {
fill: red;
stroke: red;
}
</style>
<rect id="red-rect" x="200" y="100" width="600" height="400"/>
<path id="red-path" d="M 50,20 L 20,80 L 80,80 z " />
</svg>
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="5cm" height="2.5cm" viewBox="0 0 1000 500"
xmlns="http://www.w3.org/2000/svg" version="1.1">
<style type="text/css">
.blue { fill: blue; }
</style>
<rect fill="red" class="blue" id="blue-rect" x="200" y="100" width="600" height="400"/>
</svg>
<?xml version="1.0" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" id="svg" viewBox="-5 -5 10 10" stroke="#f00" fill="none" stroke-width="2">
<circle r="4"/>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.0" width="128" height="128">
<style type="text/css">
<![CDATA[
rect {fill: white !important;}
.blue {fill: blue !important;}
#red {fill: red !important;}
]]>
</style>
<rect class="blue" id="red" x="0" y="0" width="10" height="10"/>
<rect class="blue" id="blue" x="20" y="20" width="10" height="10"/>
<rect id="white" fill="black !important" x="40" y="40" width="10" height="10"/>
<rect id="pink" style="fill: pink !important;" x="60" y="60" width="10" height="10"/>
</svg>
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="5cm" height="2.5cm" viewBox="0 0 1000 500"
xmlns="http://www.w3.org/2000/svg" version="1.1">
<style type="text/css">
rect { fill: black; }
.blue { fill: blue; }
#green { fill: green; }
rect#pink { fill: pink; }
.blue#yellow { fill: yellow; }
rect.blue#white { fill: white; }
#brown { fill: brown; }
</style>
<rect class="blue" id="red" style="fill:red;" x="100" y="100" width="100" height="100"/>
<rect class="blue" id="green" x="200" y="100" width="100" height="100"/>
<rect class="blue" id="pink" x="300" y="100" width="100" height="100"/>
<rect class="blue" id="yellow" x="400" y="100" width="100" height="100"/>
<rect class="blue" id="white" x="500" y="100" width="100" height="100"/>
<rect class="none" id="black" x="100" y="200" width="100" height="100"/>
<rect class="blue" id="blue" x="200" y="200" width="100" height="100"/>
<rect class="none" id="brown" x="300" y="200" width="100" height="100"/>
<rect class="none" id="gray" style="fill:gray;" x="400" y="200" width="100" height="100"/>
</svg>
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="200" height="200"
xmlns="http://www.w3.org/2000/svg" version="1.1" id="svg" class="svg">
<style type="text/css">
<![CDATA[
.svg {
fill:blue;
}
]]>
</style>
<rect id="target" x="100" y="100" width="100" height="100"/>
</svg>
/* vim: set ts=4 nowrap ai expandtab sw=4: */
#include <glib.h>
#include "librsvg/rsvg.h"
#include "librsvg/rsvg-private.h"
#include "librsvg/rsvg-defs.h"
#include "librsvg/rsvg-styles.h"
#include "test-utils.h"
union Expected {
guint color;
Length length;
};
typedef struct _FixtureData
{
const gchar *test_name;
const gchar *bug_id;
const gchar *file_path;
const gchar *id;
const gchar *target_name;
union Expected expected;
} FixtureData;
static void
assert_equal_color (guint expected, guint actual)
{
g_assert_cmphex (expected, ==, actual);
}
static void
assert_equal_length (Length *expected, Length *actual)
{
g_assert_cmpfloat (expected->length, ==, actual->length);
g_assert_cmpint (expected->unit, ==, actual->unit);
}
static void
assert_equal_value (FixtureData *fixture, RsvgNode *node)
{
if (g_str_equal (fixture->target_name, "stroke"))
assert_equal_color (fixture->expected.color, rsvg_node_get_state (node)->stroke->core.color->argb);
else if (g_str_equal (fixture->target_name, "fill"))
assert_equal_color (fixture->expected.color, rsvg_node_get_state (node)->fill->core.color->argb);
else if (g_str_equal (fixture->target_name, "stroke-width"))
assert_equal_length (&fixture->expected.length, &rsvg_node_get_state (node)->stroke_width);
else
g_assert_not_reached ();
}
static void
test_value (FixtureData *fixture)
{
RsvgHandle *handle;
RsvgNode *node;
gchar *target_file;
GError *error = NULL;
if (fixture->bug_id)
g_test_bug (fixture->bug_id);
target_file = g_build_filename (test_utils_get_test_data_path (),
fixture->file_path, NULL);
handle = rsvg_handle_new_from_file (target_file, &error);
g_free (target_file);
node = rsvg_defs_lookup (handle->priv->defs, fixture->id);
g_assert (node);
g_assert (rsvg_node_get_state (node));
assert_equal_value (fixture, node);
g_object_unref (handle);
}
#define POINTS_PER_INCH (72.0)
#define POINTS_LENGTH(x) ((x) / POINTS_PER_INCH)
static const FixtureData fixtures[] =
{
{"/styles/selectors/type", NULL, "styles/order.svg", "#black", "fill", .expected.color = 0xff000000},
{"/styles/selectors/class", NULL, "styles/order.svg", "#blue", "fill", .expected.color = 0xff0000ff},
{"/styles/selectors/#id", NULL, "styles/order.svg", "#brown", "fill", .expected.color = 0xffa52a2a},
{"/styles/selectors/style", NULL, "styles/order.svg", "#gray", "fill", .expected.color = 0xff808080},
{"/styles/selectors/style property prior than class", NULL, "styles/order.svg", "#red", "fill", .expected.color = 0xffff0000},
{"/styles/selectors/#id prior than class", NULL, "styles/order.svg", "#green", "fill", .expected.color = 0xff008000},
{"/styles/selectors/type#id prior than class", NULL, "styles/order.svg", "#pink", "fill", .expected.color = 0xffffc0cb},
{"/styles/selectors/class#id prior than class", NULL, "styles/order.svg", "#yellow", "fill", .expected.color = 0xffffff00},
{"/styles/selectors/type.class#id prior than class", NULL, "styles/order.svg", "#white", "fill", .expected.color = 0xffffffff},
{"/styles/selectors/#id prior than type", "418823", "styles/bug418823.svg", "#bla", "fill", .expected.color = 0xff00ff00},
{"/styles/selectors/comma-separate (fill)", "614643", "styles/bug614643.svg", "#red-rect", "fill", .expected.color = 0xffff0000},
{"/styles/selectors/comma-separete (stroke)", "614643", "styles/bug614643.svg", "#red-path", "stroke", .expected.color = 0xffff0000},
{"/styles/override presentation attribute", "614704", "styles/bug614704.svg", "#blue-rect", "fill", .expected.color = 0xff0000ff},
{"/styles/selectors/2 or more selectors (fill)", "592207", "styles/bug592207.svg", "#target", "fill", .expected.color = 0xffff0000},
{"/styles/selectors/2 or more selectors (stroke)", "592207", "styles/bug592207.svg", "#target", "stroke", .expected.color = 0xff0000ff},
{"/styles/svg-element-style", "615701", "styles/svg-class.svg", "#svg", "fill", .expected.color = 0xff0000ff},
{"/styles/presentation attribute in svg element", "620693", "styles/bug620693.svg", "#svg", "stroke", .expected.color = 0xffff0000},
{"/styles/!important/stroke", "379629", "styles/bug379629.svg", "#base_shadow", "stroke", .expected.color = 0xffffc0cb /* pink */},
{"/styles/!important/stroke-width", "379629", "styles/bug379629.svg", "#base_shadow", "stroke-width", .expected.length = {POINTS_LENGTH(5.), LENGTH_UNIT_INCH}},
{"/styles/!important/class", "614606", "styles/bug614606.svg", "#path6306", "fill", .expected.color = 0xffff0000 /* red */ },
{"/styles/!important/element", "614606", "styles/bug614606.svg", "#path6308", "fill", .expected.color = 0xff000000},
{"/styles/!important/#id prior than class", NULL, "styles/important.svg", "#red", "fill", .expected.color = 0xffff0000 },
{"/styles/!important/class prior than type", NULL, "styles/important.svg", "#blue", "fill", .expected.color = 0xff0000ff },
{"/styles/!important/presentation attribute is invalid", NULL, "styles/important.svg", "#white", "fill", .expected.color = 0xffffffff },
{"/styles/!important/style prior than class", NULL, "styles/important.svg", "#pink", "fill", .expected.color = 0xffffc0cb },
/* {"/styles/selectors/descendant", "338160", "styles/bug338160.svg", "#base_shadow", "stroke-width", .expected.length = {2., LENGTH_UNIT_DEFAULT}}, */
};
static const gint n_fixtures = G_N_ELEMENTS (fixtures);
int
main (int argc, char *argv[])
{
gint i;
int result;
g_test_init (&argc, &argv, NULL);
for (i = 0; i < n_fixtures; i++)
g_test_add_data_func (fixtures[i].test_name, &fixtures[i], (void*)test_value);
result = g_test_run ();
return result;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment