Title: [282134] trunk/LayoutTests
Revision
282134
Author
commit-qu...@webkit.org
Date
2021-09-08 01:29:27 -0700 (Wed, 08 Sep 2021)

Log Message

Testing for the fact that media elements are treated as replaced elements
https://bugs.webkit.org/show_bug.cgi?id=229857

Patch by Frédéric Wang <fw...@igalia.com> on 2021-09-08
Reviewed by Darin Adler.

This is a follow-up of r281979. backwards-text-iterator-basic.html is extended to check that
SimplifiedBackwardsTextIterator emits a comma for a media element. The a11y test from r274810
which verified audio/video elements emit an object replacement character is restored, as it
seems it was removed by mistake and so this case was no longer checked explicitly.
text-marker-previous-next.html is also extended to cover the case of media element.

* accessibility/text-marker/media-emits-object-replacement-expected.txt: Added.
* accessibility/text-marker/media-emits-object-replacement.html: Added.
* accessibility/text-marker/text-marker-previous-next-expected.txt:
* accessibility/text-marker/text-marker-previous-next.html:
* editing/text-iterator/backwards-text-iterator-basic-expected.txt:
* editing/text-iterator/backwards-text-iterator-basic.html:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (282133 => 282134)


--- trunk/LayoutTests/ChangeLog	2021-09-08 07:48:29 UTC (rev 282133)
+++ trunk/LayoutTests/ChangeLog	2021-09-08 08:29:27 UTC (rev 282134)
@@ -1,3 +1,23 @@
+2021-09-08  Frédéric Wang  <fw...@igalia.com>
+
+        Testing for the fact that media elements are treated as replaced elements
+        https://bugs.webkit.org/show_bug.cgi?id=229857
+
+        Reviewed by Darin Adler.
+
+        This is a follow-up of r281979. backwards-text-iterator-basic.html is extended to check that
+        SimplifiedBackwardsTextIterator emits a comma for a media element. The a11y test from r274810
+        which verified audio/video elements emit an object replacement character is restored, as it
+        seems it was removed by mistake and so this case was no longer checked explicitly.
+        text-marker-previous-next.html is also extended to cover the case of media element.
+
+        * accessibility/text-marker/media-emits-object-replacement-expected.txt: Added.
+        * accessibility/text-marker/media-emits-object-replacement.html: Added.
+        * accessibility/text-marker/text-marker-previous-next-expected.txt:
+        * accessibility/text-marker/text-marker-previous-next.html:
+        * editing/text-iterator/backwards-text-iterator-basic-expected.txt:
+        * editing/text-iterator/backwards-text-iterator-basic.html:
+
 2021-09-08  Tim Nguyen  <n...@apple.com>
 
         Support animations on ::backdrop

Added: trunk/LayoutTests/accessibility/text-marker/media-emits-object-replacement-expected.txt (0 => 282134)


--- trunk/LayoutTests/accessibility/text-marker/media-emits-object-replacement-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/text-marker/media-emits-object-replacement-expected.txt	2021-09-08 08:29:27 UTC (rev 282134)
@@ -0,0 +1,14 @@
+
+This tests ensures that if video or audio tags are used, they will emit an object replacement character in a range for string operation.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS text1.textMarkerRangeLength(textMarkerRange) is 5
+Video string for range: a  b
+PASS text1.textMarkerRangeLength(textMarkerRange) is 5
+Audio string for range: a  b
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/text-marker/media-emits-object-replacement.html (0 => 282134)


--- trunk/LayoutTests/accessibility/text-marker/media-emits-object-replacement.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/text-marker/media-emits-object-replacement.html	2021-09-08 08:29:27 UTC (rev 282134)
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<script src=""
+
+<div id="content" tabindex="0">
+
+<div id="text1">
+a <video width=100 height=100 controls></video> b
+ </div>
+
+ <br>
+
+ <div id="text2">
+ a <audio width=100 height=100 controls></audio> b
+ </div>
+
+ </div>
+
+ <div id="console"></div>
+ <script>
+
+ description("This tests ensures that if video or audio tags are used, they will emit an object replacement character in a range for string operation.")
+
+    if (window.accessibilityController) {
+        var text1 = accessibilityController.accessibleElementById("text1");
+        var textMarkerRange = text1.textMarkerRangeForElement(text1);
+        shouldBe("text1.textMarkerRangeLength(textMarkerRange)", "5");
+        debug("Video string for range: " + text1.stringForTextMarkerRange(textMarkerRange));
+
+        var text2 = accessibilityController.accessibleElementById("text2");
+        var textMarkerRange = text2.textMarkerRangeForElement(text2);
+        shouldBe("text1.textMarkerRangeLength(textMarkerRange)", "5");
+        debug("Audio string for range: " + text2.stringForTextMarkerRange(textMarkerRange));
+
+        document.getElementById("content").style.visibility = 'hidden';
+    }
+
+ </script>
+
+ <script src=""
+ </body>
+</html>

Modified: trunk/LayoutTests/accessibility/text-marker/text-marker-previous-next-expected.txt (282133 => 282134)


--- trunk/LayoutTests/accessibility/text-marker/text-marker-previous-next-expected.txt	2021-09-08 07:48:29 UTC (rev 282133)
+++ trunk/LayoutTests/accessibility/text-marker/text-marker-previous-next-expected.txt	2021-09-08 08:29:27 UTC (rev 282134)
@@ -9,6 +9,8 @@
 
 a b
 
+audiofile
+
 This tests the next/previous text marker functions are implemented correctly.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
@@ -41,6 +43,9 @@
 PASS text.stringForTextMarkerRange(text.textMarkerRangeForMarkers(result.previous, result.current)) is 'b'
 PASS text.stringForTextMarkerRange(text.textMarkerRangeForMarkers(result.previous, result.current)) is ' '
 PASS text.stringForTextMarkerRange(text.textMarkerRangeForMarkers(result.previous, result.current)) is 'a'
+PASS text.stringForTextMarkerRange(textMarkerRange) is 'audiofile'
+PASS text.stringForTextMarkerRange(markerRange) is ''
+PASS text.stringForTextMarkerRange(markerRange) is ''
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/accessibility/text-marker/text-marker-previous-next.html (282133 => 282134)


--- trunk/LayoutTests/accessibility/text-marker/text-marker-previous-next.html	2021-09-08 07:48:29 UTC (rev 282133)
+++ trunk/LayoutTests/accessibility/text-marker/text-marker-previous-next.html	2021-09-08 08:29:27 UTC (rev 282134)
@@ -31,6 +31,8 @@
 
 <p id="text6">a     b</p>
 
+<p id="text7">audio<audio controls></audio>file</p>
+
 <p id="description"></p>
 <div id="console"></div>
 
@@ -195,6 +197,25 @@
         result = backwards(1, result.previous, result.current, text);
         shouldBe("text.stringForTextMarkerRange(text.textMarkerRangeForMarkers(result.previous, result.current))", "'a'");
         
+        // Test case with replaced elements (should use object replacement character).
+        text = accessibilityController.accessibleElementById("text7");
+        textMarkerRange = text.textMarkerRangeForElement(text);
+        shouldBe("text.stringForTextMarkerRange(textMarkerRange)", "'audio\uFFFCfile'");
+        currentMarker = text.startTextMarkerForTextMarkerRange(textMarkerRange);
+        for (var i = 0; i < 6; i++) {
+            previousMarker = currentMarker;
+            currentMarker = text.nextTextMarker(currentMarker);
+        }
+        markerRange = text.textMarkerRangeForMarkers(previousMarker, currentMarker)
+        shouldBe("text.stringForTextMarkerRange(markerRange)", "'\uFFFC'");
+        currentMarker = text.endTextMarkerForTextMarkerRange(textMarkerRange);
+        for (var i = 0; i < 5; i++) {
+            previousMarker = currentMarker;
+            currentMarker = text.previousTextMarker(currentMarker);
+        }
+        markerRange = text.textMarkerRangeForMarkers(previousMarker, currentMarker)
+        shouldBe("text.stringForTextMarkerRange(markerRange)", "'\uFFFC'");
+
         function forward(count, previousMarker, currentMarker, obj) {
             for (var i = 0; i < count; i++) {
                 previousMarker = currentMarker;

Modified: trunk/LayoutTests/editing/text-iterator/backwards-text-iterator-basic-expected.txt (282133 => 282134)


--- trunk/LayoutTests/editing/text-iterator/backwards-text-iterator-basic-expected.txt	2021-09-08 07:48:29 UTC (rev 282133)
+++ trunk/LayoutTests/editing/text-iterator/backwards-text-iterator-basic-expected.txt	2021-09-08 08:29:27 UTC (rev 282134)
@@ -22,6 +22,7 @@
 PASS plainTextWithBackwardsTextIterator("<table><tr><td>hello</td><td>world</td></table>") is "\n\nhello\nworld"
 
 PASS plainTextWithBackwardsTextIterator("img<img>iframe<iframe></iframe>meter<meter></meter>progress<progress></progress><legend>legend</legend>imgrole<span role='img'></span><button>button</button>") is "img,iframe,meter,progress,\nlegend,imgrole,button,"
+PASS plainTextWithBackwardsTextIterator("audio<audio controls><source src='' type='audio/mpeg'></audio>file") is "audio,file"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/editing/text-iterator/backwards-text-iterator-basic.html (282133 => 282134)


--- trunk/LayoutTests/editing/text-iterator/backwards-text-iterator-basic.html	2021-09-08 07:48:29 UTC (rev 282133)
+++ trunk/LayoutTests/editing/text-iterator/backwards-text-iterator-basic.html	2021-09-08 08:29:27 UTC (rev 282134)
@@ -54,6 +54,7 @@
 
 // Verify that replaced elements emit a comma.
 shouldBe(`plainTextWithBackwardsTextIterator("img<img>iframe<iframe></iframe>meter<meter></meter>progress<progress></progress><legend>legend</legend>imgrole<span role='img'></span><button>button</button>")`, '"img,iframe,meter,progress,\\nlegend,imgrole,button,"');
+shouldBe(`plainTextWithBackwardsTextIterator("audio<audio controls><source src='' type='audio/mpeg'></audio>file")`, '"audio,file"');
 
 container.innerHTML = '';
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to