From 5ae1aa9bf971c6fba22131309d513cac226089e0 Mon Sep 17 00:00:00 2001 From: MattGarrish Date: Fri, 7 Aug 2020 11:27:08 -0300 Subject: [PATCH] feat: check that Media Overlays are only defined for XHTML and SVG content documents Add a schema rule to check the media type of items declaring a `media-overlay` attribute See #1176 --- .../adobe/epubcheck/schema/30/package-30.sch | 7 +++++-- .../mediaoverlays-non-contentdoc-error.opf | 21 +++++++++++++++++++ .../mediaoverlays-package-document.feature | 8 +++++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 src/test/resources/epub3/files/package-document/mediaoverlays-non-contentdoc-error.opf diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/package-30.sch b/src/main/resources/com/adobe/epubcheck/schema/30/package-30.sch index 07507cea1..02a5d1859 100644 --- a/src/main/resources/com/adobe/epubcheck/schema/30/package-30.sch +++ b/src/main/resources/com/adobe/epubcheck/schema/30/package-30.sch @@ -287,9 +287,12 @@ + media overlay items must be of the "application/smil+xml" type (given type was "") + The media-overlay attribute is only allowed on XHTML and SVG content documents. @@ -322,8 +325,8 @@ @refines must not be used with the media:playback-active-class property - - + + diff --git a/src/test/resources/epub3/files/package-document/mediaoverlays-non-contentdoc-error.opf b/src/test/resources/epub3/files/package-document/mediaoverlays-non-contentdoc-error.opf new file mode 100644 index 000000000..3343aebc3 --- /dev/null +++ b/src/test/resources/epub3/files/package-document/mediaoverlays-non-contentdoc-error.opf @@ -0,0 +1,21 @@ + + + + Title + en + NOID + 2019-01-01T12:00:00Z + + 0:01:30.200 + 0:01:30.200 + + + + + + + + + + diff --git a/src/test/resources/epub3/mediaoverlays-package-document.feature b/src/test/resources/epub3/mediaoverlays-package-document.feature index d71eddcaa..ffa9c6f62 100644 --- a/src/test/resources/epub3/mediaoverlays-package-document.feature +++ b/src/test/resources/epub3/mediaoverlays-package-document.feature @@ -23,6 +23,12 @@ Feature: EPUB 3 ▸ Media Overlays ▸ Package Document Checks And the message contains 'must be of the "application/smil+xml" type' And no other errors or warnings are reported + Scenario: Report use of the media-overlay attribute on non-EPUB Content Documents + When checking file 'mediaoverlays-non-contentdoc-error.opf' + Then error RSC-005 is reported + And the message contains 'media-overlay attribute is only allowed' + And no other errors or warnings are reported + ## 3.5.2 Package Metadata Scenario: the entire publication duration must be defined @@ -36,6 +42,8 @@ Feature: EPUB 3 ▸ Media Overlays ▸ Package Document Checks Then error RSC-005 is reported And the message contains "item media:duration meta element not set" And no other errors or warnings are reported + + # C. Media Overlays Metadata Vocabulary # see https://www.w3.org/publishing/epub32/epub-mediaoverlays.html#app-overlays-vocab