Add layout tests for font selection based on lang/xml:lang
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2012 03:39:18 +0000 (03:39 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2012 03:39:18 +0000 (03:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=81203

Patch by Matt Falkenhagen <falken@chromium.org> on 2012-03-15
Reviewed by Hajime Morita.

* fast/text/international/lang-sensitive-fonts-expected.html: Added.
* fast/text/international/lang-sensitive-fonts-xml-expected.html: Added.
* fast/text/international/lang-sensitive-fonts-xml.xhtml: Added.
* fast/text/international/lang-sensitive-fonts.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110936 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/text/international/lang-sensitive-fonts-expected.html [new file with mode: 0644]
LayoutTests/fast/text/international/lang-sensitive-fonts-xml-expected.html [new file with mode: 0644]
LayoutTests/fast/text/international/lang-sensitive-fonts-xml.xhtml [new file with mode: 0644]
LayoutTests/fast/text/international/lang-sensitive-fonts.html [new file with mode: 0644]

index 32ad8c7..5b0a3fa 100644 (file)
@@ -1,3 +1,15 @@
+2012-03-15  Matt Falkenhagen  <falken@chromium.org>
+
+        Add layout tests for font selection based on lang/xml:lang
+        https://bugs.webkit.org/show_bug.cgi?id=81203
+
+        Reviewed by Hajime Morita.
+
+        * fast/text/international/lang-sensitive-fonts-expected.html: Added.
+        * fast/text/international/lang-sensitive-fonts-xml-expected.html: Added.
+        * fast/text/international/lang-sensitive-fonts-xml.xhtml: Added.
+        * fast/text/international/lang-sensitive-fonts.html: Added.
+
 2012-03-15  Shinya Kawanaka  <shinyak@chromium.org>
 
         [Crash] Adding <content> into a ShadowRoot causes crash.
diff --git a/LayoutTests/fast/text/international/lang-sensitive-fonts-expected.html b/LayoutTests/fast/text/international/lang-sensitive-fonts-expected.html
new file mode 100644 (file)
index 0000000..0060d23
--- /dev/null
@@ -0,0 +1,11 @@
+<html>
+<body>
+<div style="font-size: 20px">
+<div style="font-family: 'Ahem'">this is ahem font</div>
+<div style="font-family: 'Ahem'">this is ahem font</div>
+<div style="font-family: 'Ahem'">this is ahem font</div>
+<div style="font-family: 'Ahem'">this is ahem font</div>
+<div>this is not ahem font</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/international/lang-sensitive-fonts-xml-expected.html b/LayoutTests/fast/text/international/lang-sensitive-fonts-xml-expected.html
new file mode 100644 (file)
index 0000000..66159b4
--- /dev/null
@@ -0,0 +1,11 @@
+<html>
+<body>
+<div style="font-family: 'Ahem'; font-size: 20px">
+<div>this is ahem font</div>
+<div>this is ahem font</div>
+<div>this is ahem font</div>
+<div>this is ahem font</div>
+<div>this is ahem font</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/international/lang-sensitive-fonts-xml.xhtml b/LayoutTests/fast/text/international/lang-sensitive-fonts-xml.xhtml
new file mode 100644 (file)
index 0000000..8c7e328
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<script>
+if (window.internals) {
+    window.internals.settings.setStandardFontFamily("Ahem", "Hans");
+    window.internals.settings.setFantasyFontFamily("Ahem", "Hans");
+}
+</script>
+</head>
+<body>
+<!-- Test for language-sensitive font selection (bug 10874). Some fonts for
+Simplified Han script is set to Ahem and the divs are set to language zh_CN
+which corresponds to that script. The test passes if all divs are in Ahem
+font.
+-->
+<div style="font-size: 20px">
+<div style="font-family: 'Ahem'">this is ahem font</div>
+<div lang="zh-CN">this is ahem font</div>
+<div id="target1" lang="ar">this is ahem font</div>
+<div id="target2" lang="ar" style="font-family: sans-serif">this is ahem font</div>
+<div xml:lang="zh-CN">this is ahem font</div>
+</div>
+<script>
+document.getElementById("target1").lang = "zh-CN";
+
+document.getElementById("target2").lang = "zh-CN";
+document.getElementById("target2").style.fontFamily = "fantasy";
+</script>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/international/lang-sensitive-fonts.html b/LayoutTests/fast/text/international/lang-sensitive-fonts.html
new file mode 100644 (file)
index 0000000..1212358
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.internals) {
+    window.internals.settings.setStandardFontFamily("Ahem", "Hans");
+    window.internals.settings.setFantasyFontFamily("Ahem", "Hans");
+}
+</script>
+</head>
+<body>
+<!-- Test for language-sensitive font selection (bug 10874). Some fonts for
+Simplified Han script is set to Ahem and the divs are set to language zh_CN
+which corresponds to that script. The test passes if all divs are in Ahem
+font, except for the final div as xml:lang should be ignored in HTML.
+-->
+<div style="font-size: 20px">
+<div style="font-family: 'Ahem'">this is ahem font</div>
+<div lang="zh-CN">this is ahem font</div>
+<div id="target1" lang="ar">this is ahem font</div>
+<div id="target2" lang="ar" style="font-family: sans-serif">this is ahem font</div>
+<div xml:lang="zh-CN">this is not ahem font</div>
+</div>
+<script>
+document.getElementById("target1").lang = "zh-CN";
+
+document.getElementById("target2").lang = "zh-CN";
+document.getElementById("target2").style.fontFamily = "fantasy";
+</script>
+</body>
+</html>