[Webkit-unassigned] [Bug 32937] LayoutTests/fast/encoding/invalid-UTF-8.html

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Feb 17 11:01:41 PST 2010


https://bugs.webkit.org/show_bug.cgi?id=32937





--- Comment #7 from Robert Hogan <robert at roberthogan.net>  2010-02-17 11:01:40 PST ---
(In reply to comment #5)
> We actually want to test two things here. First, it's that U+FFFD substitution
> characters are actually displayed. Second, compliance with Unicode spec
> recommended handling shouldn't regress on platforms that are compliant now.
> 
> Only the former subtest needs pixel results. One way to make it text-only would
> be to have a separate container with text "тт ", and compare its rendered width
> to actual one.
> 

Do you mean something like:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
/* Force font fallback on Windows to match Mac OS X */
@font-face {
    font-family: 'times';
    src: local('Lucida Grande');
    unicode-range: U+FFFD;
}
</style>
</head>
<body>
<p>This tests the rendering of invalid UTF-8 sequences.</p>
The following should be: "т??т ???" or "т??т ????????" (with black diamonds in
place of question marks):<br>
<div id="target" style="font-size: 12px;">т��т ��������</div>
<br>It should be wider than this:<br>
<div id="reference" style="font-size: 12px;">тт </div>
<p id="result">Test did not run</p>
<script>
    if (window.layoutTestController)
        layoutTestController.dumpAsText();

    var target = document.getElementById("target");
    var textNode = target.firstChild;
    var range = document.createRange();
    range.setStart(textNode, 0);
    range.setEnd(textNode, 8); // Minimum valid length of decoded output is 8
characters.
    var width = range.getClientRects()[0].width;

    var reference = document.getElementById("reference");
    textNode = reference.firstChild;
    range.setStart(textNode, 0);
    range.setEnd(textNode, 3); 
    var referenceWidth = range.getClientRects()[0].width;

    document.getElementById("result").innerText = width > referenceWidth ?
"PASS " : "FAIL: width (" + width + ") was less than or equal to " +
referenceWidth;

</script>
</body>
</html>

Which will have expected results (in Qt) of:

This tests the rendering of invalid UTF-8 sequences.

The following should be: "Ñ‚??Ñ‚ ???" or "Ñ‚??Ñ‚ ????????" (with black diamonds
in place of question marks):
т��т ��������

It should be wider than this:
Ñ‚Ñ‚
PASS

and in other platforms of:

This tests the rendering of invalid UTF-8 sequences.

The following should be: "Ñ‚??Ñ‚ ???" or "Ñ‚??Ñ‚ ????????" (with black diamonds
in place of question marks):
т��т ��ï

It should be wider than this:
Ñ‚Ñ‚
PASS

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list