Bug 719286 - Test for basic OpenType SVG functionality r=roc

This commit is contained in:
Edwin Flores 2012-09-06 16:58:47 +12:00
parent 2446d8504c
commit d7f94d2e0e
12 changed files with 167 additions and 0 deletions

View File

@ -0,0 +1,5 @@
pref(gfx.font_rendering.opentype_svg.enabled,false) != svg-glyph-basic.svg svg-glyph-basic-ref.svg
pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-basic.svg svg-glyph-basic-ref.svg
pref(gfx.font_rendering.opentype_svg.enabled,false) != svg-glyph-positioning.svg svg-glyph-positioning-ref.svg
pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-positioning.svg svg-glyph-positioning-ref.svg
pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-invalid.html svg-glyph-invalid-ref.html

Binary file not shown.

View File

@ -0,0 +1 @@
This is the text contained in the rubbish.ttf 'SVG ' table. It is obviously not XML, and should thus be ignored.

Binary file not shown.

View File

@ -0,0 +1,37 @@
<svg xmlns="http://www.w3.org/2000/svg">
<!-- This is the XML document contained in the 'SVG ' table of svg.woff -->
<!-- char = L -->
<g glyphid="46">
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
stroke="black" fill="red"/>
<rect x="100" y="-1000" width="100" height="100" stroke="none"
fill="turquoise" />
</g>
<!-- L with a UVS selector -->
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
stroke="black" fill="green" glyphchar="L&#xfe01;"/>
<!-- M -->
<rect x="50" y="-950" width="900" height="900" stroke-width="100"
fill="pink" stroke="hotpink" glyphchar="M"/>
<!-- -moz-objectfill, no stroke -->
<!-- N -->
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
stroke="none" fill="-moz-objectFill" glyphchar="N"/>
<!-- O -->
<rect x="50" y="-950" width="900" height="900" stroke-width="100"
fill="-moz-objectFill" stroke="none" glyphchar="O"/>
<!-- -moz-objectstroke -->
<!-- P -->
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
stroke="-moz-objectStroke" fill="burlywood" glyphchar="P"/>
<!-- both -moz-objectstroke and -moz-objectfill -->
<!-- Q -->
<rect x="50" y="-950" width="900" height="900" stroke-width="100"
fill="-moz-objectStroke" stroke="-moz-objectFill" glyphchar="Q"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

View File

@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg">
<g>
<rect x="20" y="20" width="160" height="160" stroke-width="10"
stroke="black" fill="red" />
<rect x="20" y="0" width="20" height="20" stroke="none"
fill="turquoise" />
</g>
<rect x="10" y="210" width="180" height="180" stroke-width="20"
fill="pink" stroke="hotpink" />
<rect x="20" y="420" width="160" height="160" stroke-width="10"
stroke="black" fill="green" />
</svg>

After

Width:  |  Height:  |  Size: 452 B

View File

@ -0,0 +1,33 @@
<svg xmlns="http://www.w3.org/2000/svg">
<style type="text/css">
<![CDATA[
@font-face {
font-family: "Liberation";
src:url(resources/svg.woff);
}
text
{
font-family: Liberation;
font-size: 200px;
stroke: black;
}
]]>
</style>
<!--
Test that SVG glyphs are being drawn instead of TrueType glyphs
Also testing that this does not happen if the
gfx.font_rendering.opentype_svg.enabled preference is set to true.
-->
<!-- glyphid -->
<text x="0" y="200">
L
</text>
<!-- glyphchar -->
<text x="0" y="400">
M
</text>
<!-- glyphchar with UVS selector -->
<text x="0" y="600">
L&#xfe01;
</text>
</svg>

After

Width:  |  Height:  |  Size: 723 B

View File

@ -0,0 +1,18 @@
<html>
<head>
<title>Reference for test that invalid XML in the 'SVG ' table is rejected</title>
<style>
@font-face {
font-family : 'Liberation';
src : url(resources/nosvg.woff);
}
body {
font-family : 'Liberation';
font-size : 200px;
}
</style>
</head>
<body>
LML&#xfe01;
</body>
</html>

View File

@ -0,0 +1,23 @@
<html>
<head>
<title>Test that invalid XML in the 'SVG ' table is rejected</title>
<style>
@font-face {
font-family : 'Liberation';
src : url(resources/rubbish.woff);
}
body {
font-family : 'Liberation';
font-size : 200px;
}
</style>
</head>
<!--
The font file resources/rubbish.woff contains an SVG table which
does not contain valid XML. This test makes sure it falls back
on rendering the text using the truetype outlines.
-->
<body>
LML&#xfe01;
</body>
</html>

View File

@ -0,0 +1,15 @@
<svg xmlns="http://www.w3.org/2000/svg">
<!-- M -->
<rect x="10" y="10" width="180" height="180" stroke-width="20"
fill="pink" stroke="hotpink" />
<!-- L -->
<rect x="220" y="20" width="160" height="160" stroke-width="10"
stroke="black" fill="red" />
<rect x="220" y="0" width="20" height="20" stroke="none"
fill="turquoise" />
<!-- L with UVS -->
<rect x="370" y="20" width="160" height="160" stroke-width="10"
stroke="black" fill="green" />
</svg>

After

Width:  |  Height:  |  Size: 482 B

View File

@ -0,0 +1,23 @@
<svg xmlns="http://www.w3.org/2000/svg">
<style type="text/css">
<![CDATA[
@font-face {
font-family: "Liberation";
src:url(resources/svg.woff);
}
text
{
font-family: Liberation;
font-size: 200px;
stroke: black;
}
]]>
</style>
<!--
Test that we're rendering in the right place in the middle of a
text run
-->
<text x="0" y="200">
MLL&#xfe01;
</text>
</svg>

After

Width:  |  Height:  |  Size: 462 B