Bug 1249489 - covert css to device pixels in elm/test_canvas.html, r=yzen

This commit is contained in:
Alexander Surkov 2016-02-23 18:43:25 -05:00
Родитель 7f92893842
Коммит a5c89bc409
1 изменённых файлов: 10 добавлений и 6 удалений

Просмотреть файл

@ -18,22 +18,26 @@
src="../layout.js"></script>
<script type="application/javascript">
var kX = 10, kY = 10, kWidth = 150, kHeight = 100;
function doTest()
{
var canv = document.getElementById("c");
var context = canv.getContext('2d');
var element = document.getElementById("showA");
context.beginPath();
context.rect(10, 10, 150, 100);
context.rect(kX, kY, kWidth, kHeight);
context.addHitRegion({control: element});
var input = getAccessible("showA");
var input = getAccessible("showA");
var [cnvX, cnvY, cnvWidth, cnvHeight] = getBoundsForDOMElm(canv);
var [accX, accY, accWidth, accHeight] = getBounds(input);
is(accX, cnvX + 10, "accX should be 10 and not " + accX);
is(accY, cnvY + 10, "accY should be 10 and not " + accY);
is(accWidth, 150, "accWidth should be 150 and not " + accWidth);
is(accHeight, 100, "accHeight should be 100 and not " + accHeight);
var [x, y, w, h] = CSSToDevicePixels(window, kX, kY, kWidth, kHeight);
is(accX, cnvX + x, "wrong accX");
is(accY, cnvY + y, "wrong accY");
is(accWidth, w, "wrong accWidth");
is(accHeight, h, "wrong accHeight");
SimpleTest.finish();
}