Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use assert_approx_equals in css/css-text/i18n #29346

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 5 additions & 7 deletions css/css-text/i18n/ja/css-text-line-break-ja-cj-loose.html
Expand Up @@ -89,10 +89,6 @@
'<div class="ref" id="ref'+i+'" lang="ja">文文文文文文<br/>&#x'+hex+';字<span id="refSpan'+i+'">字</span></div>' +
'</div>'
}
function spansNearEnough(counter) {
return Math.abs( document.getElementById('testSpan'+counter).getBoundingClientRect().left
- document.getElementById('refSpan'+counter).getBoundingClientRect().left ) < 1;
}

document.querySelector('body').innerHTML = out
setup({explicit_done: true});
Expand All @@ -102,10 +98,12 @@
function validate() {
for (i=0;i<lines.length;i++) {
test(function() {
assert_true(spansNearEnough(i));
assert_approx_equals(
document.getElementById('testSpan'+i).getBoundingClientRect().left,
document.getElementById('refSpan'+i).getBoundingClientRect().left, 1);
// Hide successful tests.
document.getElementById('test'+i).parentNode.style.display = 'none';
}, lines[i]+' may appear at line start if ja and loose');
// Hide successful tests.
if (spansNearEnough(i)) document.getElementById('test'+i).parentNode.style.display = 'none'
}
done();
}
Expand Down
12 changes: 5 additions & 7 deletions css/css-text/i18n/ja/css-text-line-break-ja-cj-normal.html
Expand Up @@ -89,10 +89,6 @@
'<div class="ref" id="ref'+i+'" lang="ja">文文文文文文<br/>&#x'+hex+';字<span id="refSpan'+i+'">字</span></div>' +
'</div>'
}
function spansNearEnough(counter) {
return Math.abs( document.getElementById('testSpan'+counter).getBoundingClientRect().left
- document.getElementById('refSpan'+counter).getBoundingClientRect().left ) < 1;
}

document.querySelector('body').innerHTML = out
setup({explicit_done: true});
Expand All @@ -102,10 +98,12 @@
function validate() {
for (i=0;i<lines.length;i++) {
test(function() {
assert_true(spansNearEnough(i));
assert_approx_equals(
document.getElementById('testSpan'+i).getBoundingClientRect().left,
document.getElementById('refSpan'+i).getBoundingClientRect().left, 1);
// Hide successful tests.
document.getElementById('test'+i).parentNode.style.display = 'none';
}, lines[i]+' may appear at line start if ja and normal');
// Hide successful tests.
if (spansNearEnough(i)) document.getElementById('test'+i).parentNode.style.display = 'none'
}
done();
}
Expand Down
12 changes: 5 additions & 7 deletions css/css-text/i18n/ja/css-text-line-break-ja-cj-strict.html
Expand Up @@ -89,10 +89,6 @@
'<div class="ref" id="ref'+i+'" lang="ja">文文文文文<br/>文&#x'+hex+';字<span id="refSpan'+i+'">字</span></div>' +
'</div>'
}
function spansNearEnough(counter) {
return Math.abs( document.getElementById('testSpan'+counter).getBoundingClientRect().left
- document.getElementById('refSpan'+counter).getBoundingClientRect().left ) < 1;
}

document.querySelector('body').innerHTML = out
setup({explicit_done: true});
Expand All @@ -102,10 +98,12 @@
function validate() {
for (i=0;i<lines.length;i++) {
test(function() {
assert_true(spansNearEnough(i));
assert_approx_equals(
document.getElementById('testSpan'+i).getBoundingClientRect().left,
document.getElementById('refSpan'+i).getBoundingClientRect().left, 1);
// Hide successful tests.
document.getElementById('test'+i).parentNode.style.display = 'none';
}, lines[i]+' may NOT appear at line start if ja and strict');
// Hide successful tests.
if (spansNearEnough(i)) document.getElementById('test'+i).parentNode.style.display = 'none'
}
done();
}
Expand Down
12 changes: 5 additions & 7 deletions css/css-text/i18n/ja/css-text-line-break-ja-cpm-loose.html
Expand Up @@ -48,10 +48,6 @@
'<div class="ref" id="ref'+i+'" lang="ja">文文文文文文<br/>&#x'+hex+';字<span id="refSpan'+i+'">字</span></div>' +
'</div>'
}
function spansNearEnough(counter) {
return Math.abs( document.getElementById('testSpan'+counter).getBoundingClientRect().left
- document.getElementById('refSpan'+counter).getBoundingClientRect().left ) < 1;
}

document.querySelector('body').innerHTML = out
setup({explicit_done: true});
Expand All @@ -61,10 +57,12 @@
function validate() {
for (i=0;i<lines.length;i++) {
test(function() {
assert_true(spansNearEnough(i));
assert_approx_equals(
document.getElementById('testSpan'+i).getBoundingClientRect().left,
document.getElementById('refSpan'+i).getBoundingClientRect().left, 1);
// Hide successful tests.
document.getElementById('test'+i).parentNode.style.display = 'none';
}, lines[i]+' may appear at line start if ja and loose');
// Hide successful tests.
if (spansNearEnough(i)) document.getElementById('test'+i).parentNode.style.display = 'none'
}
done();
}
Expand Down
12 changes: 5 additions & 7 deletions css/css-text/i18n/ja/css-text-line-break-ja-cpm-normal.html
Expand Up @@ -48,10 +48,6 @@
'<div class="ref" id="ref'+i+'" lang="ja">文文文文文<br/>文&#x'+hex+';字<span id="refSpan'+i+'">字</span></div>' +
'</div>'
}
function spansNearEnough(counter) {
return Math.abs( document.getElementById('testSpan'+counter).getBoundingClientRect().left
- document.getElementById('refSpan'+counter).getBoundingClientRect().left ) < 1;
}

document.querySelector('body').innerHTML = out
setup({explicit_done: true});
Expand All @@ -61,10 +57,12 @@
function validate() {
for (i=0;i<lines.length;i++) {
test(function() {
assert_true(spansNearEnough(i));
assert_approx_equals(
document.getElementById('testSpan'+i).getBoundingClientRect().left,
document.getElementById('refSpan'+i).getBoundingClientRect().left, 1);
// Hide successful tests.
document.getElementById('test'+i).parentNode.style.display = 'none';
}, lines[i]+' may NOT appear at line start if ja and normal');
// Hide successful tests.
if (spansNearEnough(i)) document.getElementById('test'+i).parentNode.style.display = 'none'
}
done();
}
Expand Down
12 changes: 5 additions & 7 deletions css/css-text/i18n/ja/css-text-line-break-ja-cpm-strict.html
Expand Up @@ -48,10 +48,6 @@
'<div class="ref" id="ref'+i+'" lang="ja">文文文文文<br/>文&#x'+hex+';字<span id="refSpan'+i+'">字</span></div>' +
'</div>'
}
function spansNearEnough(counter) {
return Math.abs( document.getElementById('testSpan'+counter).getBoundingClientRect().left
- document.getElementById('refSpan'+counter).getBoundingClientRect().left ) < 1;
}

document.querySelector('body').innerHTML = out
setup({explicit_done: true});
Expand All @@ -61,10 +57,12 @@
function validate() {
for (i=0;i<lines.length;i++) {
test(function() {
assert_true(spansNearEnough(i));
assert_approx_equals(
document.getElementById('testSpan'+i).getBoundingClientRect().left,
document.getElementById('refSpan'+i).getBoundingClientRect().left, 1);
// Hide successful tests.
document.getElementById('test'+i).parentNode.style.display = 'none';
}, lines[i]+' may NOT appear at line start if ja and strict');
// Hide successful tests.
if (spansNearEnough(i)) document.getElementById('test'+i).parentNode.style.display = 'none'
}
done();
}
Expand Down
12 changes: 5 additions & 7 deletions css/css-text/i18n/ja/css-text-line-break-ja-hyphens-loose.html
Expand Up @@ -40,10 +40,6 @@
'<div class="ref" id="ref'+i+'" lang="ja">文文文文文文<br/>&#x'+hex+';字<span id="refSpan'+i+'">字</span></div>' +
'</div>'
}
function spansNearEnough(counter) {
return Math.abs( document.getElementById('testSpan'+counter).getBoundingClientRect().left
- document.getElementById('refSpan'+counter).getBoundingClientRect().left ) < 1;
}

document.querySelector('body').innerHTML = out
setup({explicit_done: true});
Expand All @@ -53,10 +49,12 @@
function validate() {
for (i=0;i<lines.length;i++) {
test(function() {
assert_true(spansNearEnough(i));
assert_approx_equals(
document.getElementById('testSpan'+i).getBoundingClientRect().left,
document.getElementById('refSpan'+i).getBoundingClientRect().left, 1);
// Hide successful tests.
document.getElementById('test'+i).parentNode.style.display = 'none';
}, lines[i]+' may appear at line start if ja and loose');
// Hide successful tests.
if (spansNearEnough(i)) document.getElementById('test'+i).parentNode.style.display = 'none'
}
done();
}
Expand Down
12 changes: 5 additions & 7 deletions css/css-text/i18n/ja/css-text-line-break-ja-hyphens-normal.html
Expand Up @@ -40,10 +40,6 @@
'<div class="ref" id="ref'+i+'" lang="ja">文文文文文文<br/>&#x'+hex+';字<span id="refSpan'+i+'">字</span></div>' +
'</div>'
}
function spansNearEnough(counter) {
return Math.abs( document.getElementById('testSpan'+counter).getBoundingClientRect().left
- document.getElementById('refSpan'+counter).getBoundingClientRect().left ) < 1;
}

document.querySelector('body').innerHTML = out
setup({explicit_done: true});
Expand All @@ -53,10 +49,12 @@
function validate() {
for (i=0;i<lines.length;i++) {
test(function() {
assert_true(spansNearEnough(i));
assert_approx_equals(
document.getElementById('testSpan'+i).getBoundingClientRect().left,
document.getElementById('refSpan'+i).getBoundingClientRect().left, 1);
// Hide successful tests.
document.getElementById('test'+i).parentNode.style.display = 'none';
}, lines[i]+' may appear at line start if ja and normal');
// Hide successful tests.
if (spansNearEnough(i)) document.getElementById('test'+i).parentNode.style.display = 'none'
}
done();
}
Expand Down
12 changes: 5 additions & 7 deletions css/css-text/i18n/ja/css-text-line-break-ja-hyphens-strict.html
Expand Up @@ -40,10 +40,6 @@
'<div class="ref" id="ref'+i+'" lang="ja">文文文文文<br/>文&#x'+hex+';字<span id="refSpan'+i+'">字</span></div>' +
'</div>'
}
function spansNearEnough(counter) {
return Math.abs( document.getElementById('testSpan'+counter).getBoundingClientRect().left
- document.getElementById('refSpan'+counter).getBoundingClientRect().left ) < 1;
}

document.querySelector('body').innerHTML = out
setup({explicit_done: true});
Expand All @@ -53,10 +49,12 @@
function validate() {
for (i=0;i<lines.length;i++) {
test(function() {
assert_true(spansNearEnough(i));
assert_approx_equals(
document.getElementById('testSpan'+i).getBoundingClientRect().left,
document.getElementById('refSpan'+i).getBoundingClientRect().left, 1);
// Hide successful tests.
document.getElementById('test'+i).parentNode.style.display = 'none';
}, lines[i]+' may NOT appear at line start if ja and strict');
// Hide successful tests.
if (spansNearEnough(i)) document.getElementById('test'+i).parentNode.style.display = 'none'
}
done();
}
Expand Down
12 changes: 5 additions & 7 deletions css/css-text/i18n/ja/css-text-line-break-ja-in-loose.html
Expand Up @@ -43,10 +43,6 @@
'<div class="ref" id="ref'+i+'" lang="ja">文文文文文文<br/>&#x'+hex+';字<span id="refSpan'+i+'">字</span></div>' +
'</div>'
}
function spansNearEnough(counter) {
return Math.abs( document.getElementById('testSpan'+counter).getBoundingClientRect().left
- document.getElementById('refSpan'+counter).getBoundingClientRect().left ) < 1;
}

document.querySelector('body').innerHTML = out
setup({explicit_done: true});
Expand All @@ -56,10 +52,12 @@
function validate() {
for (i=0;i<lines.length;i++) {
test(function() {
assert_true(spansNearEnough(i));
assert_approx_equals(
document.getElementById('testSpan'+i).getBoundingClientRect().left,
document.getElementById('refSpan'+i).getBoundingClientRect().left, 1);
// Hide successful tests.
document.getElementById('test'+i).parentNode.style.display = 'none';
}, lines[i]+' may appear at line start if ja and loose');
// Hide successful tests.
if (spansNearEnough(i)) document.getElementById('test'+i).parentNode.style.display = 'none'
}
done();
}
Expand Down
12 changes: 5 additions & 7 deletions css/css-text/i18n/ja/css-text-line-break-ja-in-normal.html
Expand Up @@ -43,10 +43,6 @@
'<div class="ref" id="ref'+i+'" lang="ja">文文文文文<br/>文&#x'+hex+';字<span id="refSpan'+i+'">字</span></div>' +
'</div>'
}
function spansNearEnough(counter) {
return Math.abs( document.getElementById('testSpan'+counter).getBoundingClientRect().left
- document.getElementById('refSpan'+counter).getBoundingClientRect().left ) < 1;
}

document.querySelector('body').innerHTML = out
setup({explicit_done: true});
Expand All @@ -56,10 +52,12 @@
function validate() {
for (i=0;i<lines.length;i++) {
test(function() {
assert_true(spansNearEnough(i));
assert_approx_equals(
document.getElementById('testSpan'+i).getBoundingClientRect().left,
document.getElementById('refSpan'+i).getBoundingClientRect().left, 1);
// Hide successful tests.
document.getElementById('test'+i).parentNode.style.display = 'none';
}, lines[i]+' may NOT appear at line start if ja and normal');
// Hide successful tests.
if (spansNearEnough(i)) document.getElementById('test'+i).parentNode.style.display = 'none'
}
done();
}
Expand Down
12 changes: 5 additions & 7 deletions css/css-text/i18n/ja/css-text-line-break-ja-in-strict.html
Expand Up @@ -43,10 +43,6 @@
'<div class="ref" id="ref'+i+'" lang="ja">文文文文文<br/>文&#x'+hex+';字<span id="refSpan'+i+'">字</span></div>' +
'</div>'
}
function spansNearEnough(counter) {
return Math.abs( document.getElementById('testSpan'+counter).getBoundingClientRect().left
- document.getElementById('refSpan'+counter).getBoundingClientRect().left ) < 1;
}

document.querySelector('body').innerHTML = out
setup({explicit_done: true});
Expand All @@ -56,10 +52,12 @@
function validate() {
for (i=0;i<lines.length;i++) {
test(function() {
assert_true(spansNearEnough(i));
assert_approx_equals(
document.getElementById('testSpan'+i).getBoundingClientRect().left,
document.getElementById('refSpan'+i).getBoundingClientRect().left, 1);
// Hide successful tests.
document.getElementById('test'+i).parentNode.style.display = 'none';
}, lines[i]+' may NOT appear at line start if ja and strict');
// Hide successful tests.
if (spansNearEnough(i)) document.getElementById('test'+i).parentNode.style.display = 'none'
}
done();
}
Expand Down
14 changes: 5 additions & 9 deletions css/css-text/i18n/ja/css-text-line-break-ja-iteration-loose.html
Expand Up @@ -44,23 +44,19 @@
'<div class="ref" id="ref'+i+'" lang="ja">文文文文文文<br/>&#x'+hex+';字<span id="refSpan'+i+'">字</span></div>' +
'</div>'
}
function spansNearEnough(counter) {
return Math.abs( document.getElementById('testSpan'+counter).getBoundingClientRect().left
- document.getElementById('refSpan'+counter).getBoundingClientRect().left ) < 1;
}

document.querySelector('body').innerHTML = out
setup({explicit_done: true});

document.fonts.ready.then(validate);

function validate() {
for (i=0;i<lines.length;i++) {
test(function() {
assert_true(spansNearEnough(i));
assert_approx_equals(
document.getElementById('testSpan'+i).getBoundingClientRect().left,
document.getElementById('refSpan'+i).getBoundingClientRect().left, 1);
// Hide successful tests.
document.getElementById('test'+i).parentNode.style.display = 'none';
}, lines[i]+' may appear at line start if ja and loose');
// Hide successful tests.
if (spansNearEnough(i)) document.getElementById('test'+i).parentNode.style.display = 'none'
}
done();
}
Expand Down
Expand Up @@ -44,10 +44,6 @@
'<div class="ref" id="ref'+i+'" lang="ja">文文文文文<br/>文&#x'+hex+';字<span id="refSpan'+i+'">字</span></div>' +
'</div>'
}
function spansNearEnough(counter) {
return Math.abs( document.getElementById('testSpan'+counter).getBoundingClientRect().left
- document.getElementById('refSpan'+counter).getBoundingClientRect().left ) < 1;
}

document.querySelector('body').innerHTML = out
setup({explicit_done: true});
Expand All @@ -57,10 +53,12 @@
function validate() {
for (i=0;i<lines.length;i++) {
test(function() {
assert_true(spansNearEnough(i));
assert_approx_equals(
document.getElementById('testSpan'+i).getBoundingClientRect().left,
document.getElementById('refSpan'+i).getBoundingClientRect().left, 1);
// Hide successful tests.
document.getElementById('test'+i).parentNode.style.display = 'none';
}, lines[i]+' may NOT appear at line start if ja and normal');
// Hide successful tests.
if (spansNearEnough(i)) document.getElementById('test'+i).parentNode.style.display = 'none'
}
done();
}
Expand Down