Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: switch item property doesn't apply to svg:switch #944

Merged
merged 1 commit into from
Jan 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/com/adobe/epubcheck/ops/OPSHandler30.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ else if (name.equals("script"))
{
requiredProperties.add(ITEM_PROPERTIES.SCRIPTED);
}
else if (!context.mimeType.equals("image/svg+xml") && name.equals("switch"))
else if (EpubConstants.EpubTypeNamespaceUri.equals(e.getNamespace()) && name.equals("switch"))
{
requiredProperties.add(ITEM_PROPERTIES.SWITCH);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,13 @@ public void testValidateEPUB30_svgReferenced()
testValidateDocument("valid/svg-referenced/");
}

@Test
public void testValidateEPUB30_svgSwitch()
{
// tests that svg:switch doesn't trigger the OPF 'switch' property check
testValidateDocument("valid/svg-switch/");
}

@Test
public void testValidateEPUB30_videoAudioTrigger()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
<rootfiles>
<rootfile full-path="OPS/package.opf" media-type="application/oebps-package+xml"/>
</rootfiles>
</container>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"
xmlns:svg="http://www.w3.org/2000/svg" xml:lang="en" lang="en">
<head>
<title>Minimal EPUB</title>
</head>
<body epub:type="bodymatter">
<h1>Loomings</h1>
<p>Call me Ishmael.</p>
<svg:svg width="400px" height="300px" viewBox="0 0 400 300">
<svg:switch>
<svg:foreignObject width="100" height="50" requiredExtensions="http://www.idpf.org/2007/ops">
<p xmlns="http://www.w3.org/1999/xhtml">foo</p>
</svg:foreignObject>
<svg:text font-size="10" font-family="Verdana">
<svg:tspan x="10" y="10">bar</svg:tspan>
</svg:text>
</svg:switch>
</svg:svg>
</body>
</html>
19 changes: 19 additions & 0 deletions src/test/resources/30/expanded/valid/svg-switch/OPS/nav.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en" lang="en">
<head>
<title>Minimal Nav</title>
</head>
<body>
<nav epub:type="toc">
<ol>
<li><a href="content_001.xhtml">content 001</a></li>
</ol>
</nav>
<nav epub:type="landmarks">
<ol>
<li><a href="content_001.xhtml" epub:type="bodymatter">Start Reading</a></li>
</ol>
</nav>
</body>
</html>
16 changes: 16 additions & 0 deletions src/test/resources/30/expanded/valid/svg-switch/OPS/package.opf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" xml:lang="en" unique-identifier="q">
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:title id="title">Minimal EPUB 3.0</dc:title>
<dc:language>en</dc:language>
<dc:identifier id="q">NOID</dc:identifier>
<meta property="dcterms:modified">2017-06-14T00:00:01Z</meta>
</metadata>
<manifest>
<item id="content_001" href="content_001.xhtml" media-type="application/xhtml+xml" properties="svg"/>
<item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/>
</manifest>
<spine>
<itemref idref="content_001" />
</spine>
</package>
1 change: 1 addition & 0 deletions src/test/resources/30/expanded/valid/svg-switch/mimetype
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
application/epub+zip