Skip to content

Commit

Permalink
feat: allow 1s tolerance for media overlays duration sum check
Browse files Browse the repository at this point in the history
Fix #1328
  • Loading branch information
rdeltour committed Nov 27, 2022
1 parent a42b070 commit e64c7c5
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/adobe/epubcheck/opf/OPFChecker30.java
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ private void checkMediaOverlaysDuration()
}
}
// report if the sum and total don't match
if (!totalDuration.equals(sumDuration))
if (!totalDuration.eqWithinTolerance(sumDuration, 1000))
{
report.message(MessageId.MED_016, EPUBLocation.of(context));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<!-- Media Overlays Duration Properties -->
<meta property="media:duration">10min</meta>
<meta refines="#mo001" property="media:duration">5min</meta>
<meta refines="#mo002" property="media:duration">0:05:00.200</meta>
<meta refines="#mo002" property="media:duration">0:05:01.100</meta>
</metadata>
<manifest>
<item id="t001" href="contents.xhtml" properties="nav" media-type="application/xhtml+xml"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" unique-identifier="uid"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<metadata>
<dc:title>Title</dc:title>
<dc:language>en</dc:language>
<dc:identifier id="uid">NOID</dc:identifier>
<meta property="dcterms:modified">2019-01-01T12:00:00Z</meta>
<!-- Media Overlays Duration Properties -->
<meta property="media:duration">10min</meta>
<meta refines="#mo001" property="media:duration">5min</meta>
<meta refines="#mo002" property="media:duration">0:05:00.500</meta>
</metadata>
<manifest>
<item id="t001" href="contents.xhtml" properties="nav" media-type="application/xhtml+xml"/>
<item id="mo001" href="mediaoverlay_001.smil" media-type="application/smil+xml"/>
<item id="mo002" href="mediaoverlay_002.smil" media-type="application/smil+xml"/>
</manifest>
<spine>
<itemref idref="t001"/>
</spine>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,13 @@ Feature: EPUB 3 — Media Overlays
And the message contains "item media:duration meta element not set"
And no other errors or warnings are reported

@spec @xref:sec-mo-package-metadata
Scenario: the total duration should be the sum of all Media Overlay durations
When checking file 'mediaoverlays-duration-total-not-sum-warning.opf'
Then warning MED-016 is reported
And no other errors or warnings are reported

@spec @xref:sec-mo-package-metadata
Scenario: the total duration has a 1s tolerance
When checking file 'mediaoverlays-duration-total-within-tolerance-valid.opf'
Then no errors or warnings are reported

0 comments on commit e64c7c5

Please sign in to comment.