зеркало из https://github.com/mozilla/pjs.git
Bug 691184 - Add test_2d.text.align.(default|invalid).html & test_2d.text.baseline.(default|invalid).html from Philip Taylor's canvas tests; r=smaug
This commit is contained in:
Родитель
516a9c5a9e
Коммит
02f1ba4ee1
|
@ -18539,6 +18539,102 @@ var ctx = canvas.getContext('2d');
|
|||
ok(ctx.strokeStyle == '#000000', "ctx.strokeStyle == '#000000'");
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- [[[ test_2d.text.align.default.html ]]] -->
|
||||
|
||||
<p>Canvas test: 2d.text.align.default</p>
|
||||
<canvas height="50" id="c569a" width="100"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
|
||||
function test_2d_text_align_default() {
|
||||
|
||||
var canvas = document.getElementById('c569a');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ok(ctx.textAlign === 'start', "ctx.textAlign === 'start'");
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- [[[ test_2d.text.align.invalid.html ]]] -->
|
||||
|
||||
<p>Canvas test: 2d.text.align.invalid</p>
|
||||
<canvas height="50" id="c570a" width="100"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
|
||||
function test_2d_text_align_invalid() {
|
||||
|
||||
var canvas = document.getElementById('c570a');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.textAlign = 'start';
|
||||
ctx.textAlign = 'bogus';
|
||||
ok(ctx.textAlign === 'start', "ctx.textAlign === 'start'");
|
||||
|
||||
ctx.textAlign = 'start';
|
||||
ctx.textAlign = 'END';
|
||||
ok(ctx.textAlign === 'start', "ctx.textAlign === 'start'");
|
||||
|
||||
ctx.textAlign = 'start';
|
||||
ctx.textAlign = 'end ';
|
||||
ok(ctx.textAlign === 'start', "ctx.textAlign === 'start'");
|
||||
|
||||
ctx.textAlign = 'start';
|
||||
ctx.textAlign = 'end\0';
|
||||
ok(ctx.textAlign === 'start', "ctx.textAlign === 'start'");
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- [[[ test_2d.text.baseline.default.html ]]] -->
|
||||
|
||||
<p>Canvas test: 2d.text.baseline.default</p>
|
||||
<canvas height="50" id="c572a" width="100"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
|
||||
function test_2d_text_baseline_default() {
|
||||
|
||||
var canvas = document.getElementById('c572a');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ok(ctx.textBaseline === 'alphabetic', "ctx.textBaseline === 'alphabetic'");
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- [[[ test_2d.text.baseline.invalid.html ]]] -->
|
||||
|
||||
<p>Canvas test: 2d.text.baseline.invalid</p>
|
||||
<canvas height="50" id="c573a" width="100"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
|
||||
function test_2d_text_baseline_invalid() {
|
||||
|
||||
var canvas = document.getElementById('c573a');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.textBaseline = 'bogus';
|
||||
ok(ctx.textBaseline === 'top', "ctx.textBaseline === 'top'");
|
||||
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.textBaseline = 'MIDDLE';
|
||||
ok(ctx.textBaseline === 'top', "ctx.textBaseline === 'top'");
|
||||
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.textBaseline = 'middle ';
|
||||
ok(ctx.textBaseline === 'top', "ctx.textBaseline === 'top'");
|
||||
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.textBaseline = 'middle\0';
|
||||
ok(ctx.textBaseline === 'top', "ctx.textBaseline === 'top'");
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -24182,6 +24278,26 @@ function runTests() {
|
|||
} catch (e) {
|
||||
ok(false, "unexpected exception thrown in: test_2d_strokeStyle_default");
|
||||
}
|
||||
try {
|
||||
test_2d_text_align_default();
|
||||
} catch (e) {
|
||||
ok(false, "unexpected exception thrown in: test_2d_text_align_default");
|
||||
}
|
||||
try {
|
||||
test_2d_text_align_invalid();
|
||||
} catch (e) {
|
||||
ok(false, "unexpected exception thrown in: test_2d_text_align_invalid");
|
||||
}
|
||||
try {
|
||||
test_2d_text_baseline_default();
|
||||
} catch (e) {
|
||||
ok(false, "unexpected exception thrown in: test_2d_text_baseline_default");
|
||||
}
|
||||
try {
|
||||
test_2d_text_baseline_invalid();
|
||||
} catch (e) {
|
||||
ok(false, "unexpected exception thrown in: test_2d_text_baseline_invalid");
|
||||
}
|
||||
try {
|
||||
test_2d_transformation_order();
|
||||
} catch (e) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче