Import css/css-text/tab-size/tab-size.html wpt test
authorjh718.park@samsung.com <jh718.park@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Aug 2019 10:28:54 +0000 (10:28 +0000)
committerjh718.park@samsung.com <jh718.park@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Aug 2019 10:28:54 +0000 (10:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=201328

Unreviewed. No behavioral changes.

The css/css-text/tab-size/tab-size.html wpt test was ported from
the original test LayoutTests/css3/tab-size.html.

So we import that wpt test and remove the original test from LayoutTests.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-text/tab-size/tab-size-expected.txt: Renamed from LayoutTests/css3/tab-size-expected.txt.
* web-platform-tests/css/css-text/tab-size/tab-size.html: Added.

LayoutTests:

* css3/tab-size.html: Removed.

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

LayoutTests/ChangeLog
LayoutTests/css3/tab-size.html [deleted file]
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/css/css-text/tab-size/tab-size-expected.txt [moved from LayoutTests/css3/tab-size-expected.txt with 50% similarity]
LayoutTests/imported/w3c/web-platform-tests/css/css-text/tab-size/tab-size.html [new file with mode: 0644]

index 52f7bb2..8ed696c 100644 (file)
@@ -1,3 +1,17 @@
+2019-08-30  Joonghun Park  <jh718.park@samsung.com>
+
+        Import css/css-text/tab-size/tab-size.html wpt test
+        https://bugs.webkit.org/show_bug.cgi?id=201328
+
+        Unreviewed. No behavioral changes.
+
+        The css/css-text/tab-size/tab-size.html wpt test was ported from
+        the original test LayoutTests/css3/tab-size.html.
+
+        So we import that wpt test and remove the original test from LayoutTests.
+
+        * css3/tab-size.html: Removed.
+
 2019-08-30  Sihui Liu  <sihui_liu@apple.com>
 
         [wk2] LayoutTest imported/w3c/web-platform-tests/IndexedDB/fire-error-event-exception.html is a flaky failure
diff --git a/LayoutTests/css3/tab-size.html b/LayoutTests/css3/tab-size.html
deleted file mode 100644 (file)
index a57c598..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <style>
-body {
-  font-size: 13px;
-}
-.px-tab-size {
-  tab-size: 60px;
-}
-.em-tab-size {
-  tab-size: 7em;
-}
-.int-tab-size {
-  tab-size: 9;
-}
-.fractional-tab-size {
-  tab-size: 2.5;
-}
-    </style>
-    <script src="../resources/js-test.js"></script>
-  </head>
-  <body>
-    <div style="background-repeat: repeat-x;">
-    <div><pre id="leading-px" class="px-tab-size">&Tab;<span>leading text, tab-size in px.</span></pre></div>
-    <div><pre id="leading-em" class="em-tab-size">&Tab;<span>leading text, tab-size in em.</span></pre></div>
-    <div><pre id="leading-int" class="int-tab-size">&Tab;<span>leading text, tab-size in spaces.</span></pre></div>
-    <div><pre id="leading-fraction" class="fractional-tab-size">&Tab;<span>leading text, tab-size in fraction.</span></pre></div>
-    <div><pre id="trailing-px" class="px-tab-size"><span>leading text</span>&Tab;<span>trailing text, tab-size in px.</span></pre></div>
-    <div><pre id="trailing-em" class="em-tab-size"><span>leading text</span>&Tab;<span>trailing text, tab-size in em.</span></pre></div>
-    <div><pre id="trailing-int" class="int-tab-size"><span>leading text</span>&Tab;<span>trailing text, tab-size in spaces.</span></pre></div>
-    <div><pre id="trailing-fraction" class="fractional-tab-size"><span>leading text</span>&Tab;<span>trailing text, tab-size in fraction.</span></pre></div>
-    <div><pre>Some spaces... '<span id="space-size-reference">         </span>' ... for size reference.</pre></div>
-    <div><pre>A space... '<span id="one-space-size-reference"> </span>' ... for size reference.</pre></div>
-    <div><pre>'<span id="leading-text-size-reference">leading text</span>', for size reference.</pre></div>
-    <script>
-
-description('Test tab-size measurements.');
-
-// Tests with a tab character at the beginning of the line.
-
-var pxPre = document.getElementById('leading-px');
-var emPre = document.getElementById('leading-em');
-var intPre = document.getElementById('leading-int');
-var fractionPre = document.getElementById("leading-fraction");
-
-var pxLeadingSpan = pxPre.firstElementChild;
-var emLeadingSpan = emPre.firstElementChild;
-var intLeadingSpan = intPre.firstElementChild;
-var fractionLeadingspan = fractionPre.firstElementChild;
-
-var pxExpected = 60;  // tab size in px.
-var emExpected = 13 * 7;  // (font size) * (tab size in em)
-var intExpected = document.getElementById('space-size-reference').getBoundingClientRect().width;
-var fractionExpected = 2.5 * document.getElementById('one-space-size-reference').getBoundingClientRect().width;
-
-var pxTabLength = pxLeadingSpan.getBoundingClientRect().left - pxPre.getBoundingClientRect().left;
-var emTabLength = emLeadingSpan.getBoundingClientRect().left - emPre.getBoundingClientRect().left;
-var intTabLength = intLeadingSpan.getBoundingClientRect().left - intPre.getBoundingClientRect().left;
-var fractionTabLength = fractionLeadingspan.getBoundingClientRect().left - fractionPre.getBoundingClientRect().left;
-
-shouldBe("pxTabLength", "pxExpected", false, 0.02);
-shouldBe("emTabLength", "emExpected", false, 0.02);
-shouldBe("intTabLength", "intExpected", false, 0.02);
-shouldBe("fractionTabLength", "fractionExpected", false, 0.02);
-
-// Tests with a tab character after leading text.
-
-var leadingTextSize = document.getElementById('leading-text-size-reference').getBoundingClientRect().width;
-pxExpected = pxExpected - (leadingTextSize % pxExpected);
-emExpected = emExpected - (leadingTextSize % emExpected);
-intExpected = intExpected - (leadingTextSize % intExpected);
-fractionExpected = fractionExpected - (leadingTextSize % fractionExpected);
-
-pxPre = document.getElementById('trailing-px');
-emPre = document.getElementById('trailing-em');
-intPre = document.getElementById('trailing-int');
-fractionPre = document.getElementById("trailing-fraction");
-
-pxLeadingSpan = pxPre.firstElementChild;
-emLeadingSpan = emPre.firstElementChild;
-intLeadingSpan = intPre.firstElementChild;
-fractionLeadingspan = fractionPre.firstElementChild;
-
-pxTrailingSpan = pxPre.lastElementChild;
-emTrailingSpan = emPre.lastElementChild;
-intTrailingSpan = intPre.lastElementChild;
-fractionTrailingSpan = fractionPre.lastElementChild;
-
-pxTabLength = pxTrailingSpan.getBoundingClientRect().left - pxLeadingSpan.getBoundingClientRect().right;
-emTabLength = emTrailingSpan.getBoundingClientRect().left - emLeadingSpan.getBoundingClientRect().right;
-intTabLength = intTrailingSpan.getBoundingClientRect().left - intLeadingSpan.getBoundingClientRect().right;
-fractionTabLength = fractionTrailingSpan.getBoundingClientRect().left - fractionLeadingspan.getBoundingClientRect().right;
-
-shouldBe("pxTabLength", "pxExpected", false, 0.02);
-shouldBe("emTabLength", "emExpected", false, 0.02);
-shouldBe("intTabLength", "intExpected", false, 0.02);
-shouldBe("fractionTabLength", "fractionExpected", false, 0.02);
-    </script>
-  </body>
-</html>
index 7200511..0185159 100644 (file)
@@ -1,3 +1,18 @@
+2019-08-30  Joonghun Park  <jh718.park@samsung.com>
+
+        Import css/css-text/tab-size/tab-size.html wpt test
+        https://bugs.webkit.org/show_bug.cgi?id=201328
+
+        Unreviewed. No behavioral changes.
+
+        The css/css-text/tab-size/tab-size.html wpt test was ported from
+        the original test LayoutTests/css3/tab-size.html.
+
+        So we import that wpt test and remove the original test from LayoutTests.
+
+        * web-platform-tests/css/css-text/tab-size/tab-size-expected.txt: Renamed from LayoutTests/css3/tab-size-expected.txt.
+        * web-platform-tests/css/css-text/tab-size/tab-size.html: Added.
+
 2019-08-29  Youenn Fablet  <youenn@apple.com>
 
         document.fonts.ready is resolved too quickly
@@ -1,19 +1,3 @@
-Test tab-size measurements.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS pxTabLength is pxExpected
-PASS emTabLength is emExpected
-PASS intTabLength is intExpected
-PASS fractionTabLength is fractionExpected
-PASS pxTabLength is pxExpected
-PASS emTabLength is emExpected
-PASS intTabLength is intExpected
-PASS fractionTabLength is fractionExpected
-PASS successfullyParsed is true
-
-TEST COMPLETE
        leading text, tab-size in px.
        leading text, tab-size in em.
        leading text, tab-size in spaces.
@@ -25,3 +9,6 @@ leading text   trailing text, tab-size in fraction.
 Some spaces... '         ' ... for size reference.
 A space... ' ' ... for size reference.
 'leading text', for size reference.
+
+PASS Test tab-size measurements 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-text/tab-size/tab-size.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-text/tab-size/tab-size.html
new file mode 100644 (file)
index 0000000..80ddcef
--- /dev/null
@@ -0,0 +1,97 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Test: CSS value type of the CSS property 'tab-size'</title>
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#tab-size-property">
+<style>
+body {
+  font-family: Ahem;
+  font-size: 13px;
+}
+.px-tab-size {
+  tab-size: 60px;
+}
+.em-tab-size {
+  tab-size: 7em;
+}
+.int-tab-size {
+  tab-size: 9;
+}
+.fractional-tab-size {
+  tab-size: 2.5;
+}
+</style>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div style="background-repeat: repeat-x;">
+<div><pre id="leading-px" class="px-tab-size">&Tab;<span>leading text, tab-size in px.</span></pre></div>
+<div><pre id="leading-em" class="em-tab-size">&Tab;<span>leading text, tab-size in em.</span></pre></div>
+<div><pre id="leading-int" class="int-tab-size">&Tab;<span>leading text, tab-size in spaces.</span></pre></div>
+<div><pre id="leading-fraction" class="fractional-tab-size">&Tab;<span>leading text, tab-size in fraction.</span></pre></div>
+<div><pre id="trailing-px" class="px-tab-size"><span>leading text</span>&Tab;<span>trailing text, tab-size in px.</span></pre></div>
+<div><pre id="trailing-em" class="em-tab-size"><span>leading text</span>&Tab;<span>trailing text, tab-size in em.</span></pre></div>
+<div><pre id="trailing-int" class="int-tab-size"><span>leading text</span>&Tab;<span>trailing text, tab-size in spaces.</span></pre></div>
+<div><pre id="trailing-fraction" class="fractional-tab-size"><span>leading text</span>&Tab;<span>trailing text, tab-size in fraction.</span></pre></div>
+<div><pre>Some spaces... '<span id="space-size-reference">         </span>' ... for size reference.</pre></div>
+<div><pre>A space... '<span id="one-space-size-reference"> </span>' ... for size reference.</pre></div>
+<div><pre>'<span id="leading-text-size-reference">leading text</span>', for size reference.</pre></div>
+<script>
+test(function() {
+  // Tests with a tab character at the beginning of the line.
+  var pxPre = document.getElementById('leading-px');
+  var emPre = document.getElementById('leading-em');
+  var intPre = document.getElementById('leading-int');
+  var fractionPre = document.getElementById("leading-fraction");
+
+  var pxLeadingSpan = pxPre.firstElementChild;
+  var emLeadingSpan = emPre.firstElementChild;
+  var intLeadingSpan = intPre.firstElementChild;
+  var fractionLeadingspan = fractionPre.firstElementChild;
+
+  var pxExpected = 60;  // tab size in px.
+  var emExpected = 13 * 7;  // (font size) * (tab size in em)
+  var intExpected = document.getElementById('space-size-reference').getBoundingClientRect().width;
+  var fractionExpected = 2.5 * document.getElementById('one-space-size-reference').getBoundingClientRect().width;
+
+  var pxTabLength = pxLeadingSpan.getBoundingClientRect().left - pxPre.getBoundingClientRect().left;
+  var emTabLength = emLeadingSpan.getBoundingClientRect().left - emPre.getBoundingClientRect().left;
+  var intTabLength = intLeadingSpan.getBoundingClientRect().left - intPre.getBoundingClientRect().left;
+  var fractionTabLength = fractionLeadingspan.getBoundingClientRect().left - fractionPre.getBoundingClientRect().left;
+
+  assert_approx_equals(pxTabLength, pxExpected, 0.02);
+  assert_approx_equals(emTabLength, emExpected, 0.02);
+  assert_approx_equals(intTabLength, intExpected, 0.02);
+  assert_approx_equals(fractionTabLength, fractionExpected, 0.02);
+
+  // Tests with a tab character after leading text.
+  var leadingTextSize = document.getElementById('leading-text-size-reference').getBoundingClientRect().width;
+  pxExpected = pxExpected - (leadingTextSize % pxExpected);
+  emExpected = emExpected - (leadingTextSize % emExpected);
+  intExpected = intExpected - (leadingTextSize % intExpected);
+  fractionExpected = fractionExpected - (leadingTextSize % fractionExpected);
+
+  pxPre = document.getElementById('trailing-px');
+  emPre = document.getElementById('trailing-em');
+  intPre = document.getElementById('trailing-int');
+  fractionPre = document.getElementById("trailing-fraction");
+
+  pxLeadingSpan = pxPre.firstElementChild;
+  emLeadingSpan = emPre.firstElementChild;
+  intLeadingSpan = intPre.firstElementChild;
+  fractionLeadingspan = fractionPre.firstElementChild;
+
+  pxTrailingSpan = pxPre.lastElementChild;
+  emTrailingSpan = emPre.lastElementChild;
+  intTrailingSpan = intPre.lastElementChild;
+  fractionTrailingSpan = fractionPre.lastElementChild;
+
+  pxTabLength = pxTrailingSpan.getBoundingClientRect().left - pxLeadingSpan.getBoundingClientRect().right;
+  emTabLength = emTrailingSpan.getBoundingClientRect().left - emLeadingSpan.getBoundingClientRect().right;
+  intTabLength = intTrailingSpan.getBoundingClientRect().left - intLeadingSpan.getBoundingClientRect().right;
+  fractionTabLength = fractionTrailingSpan.getBoundingClientRect().left - fractionLeadingspan.getBoundingClientRect().right;
+
+  assert_approx_equals(pxTabLength, pxExpected, 0.02);
+  assert_approx_equals(emTabLength, emExpected, 0.02);
+  assert_approx_equals(intTabLength, intExpected, 0.02);
+  assert_approx_equals(fractionTabLength, fractionExpected, 0.02);
+}, "Test tab-size measurements");
+</script>