bug 1333607 - fix some plugin tests to work on high dpi machines r=jimm

This commit is contained in:
Brad Lassey 2017-01-26 16:09:41 -05:00
Родитель d07b805990
Коммит 95541ed5c6
4 изменённых файлов: 13 добавлений и 9 удалений

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

@ -34,8 +34,9 @@
function doTest() {
is(p.getClipRegionRectCount(), 1, "getClipRegionRectCount should be a single rect");
is(p.getClipRegionRectEdge(0,2) - p.getClipRegionRectEdge(0,0), 100, "width of clip region rect");
is(p.getClipRegionRectEdge(0,3) - p.getClipRegionRectEdge(0,1), 26, "height of clip region rect");
var dpr = window.devicePixelRatio;
is(p.getClipRegionRectEdge(0,2) - p.getClipRegionRectEdge(0,0), 100 * dpr, "width of clip region rect");
is(p.getClipRegionRectEdge(0,3) - p.getClipRegionRectEdge(0,1), 26 * dpr, "height of clip region rect");
}
</script>

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

@ -40,10 +40,11 @@ function runTests() {
function verify(test,x,y,next) {
var p = $("plugin1").getLastMouseX();
const delta = 2;
ok(p-delta <= x && x <= p+delta, "test"+test+" LastMouseX got " + p + " expected " + x +
var dpr = window.devicePixelRatio / SpecialPowers.getFullZoom(window);
ok(p-delta <= x * dpr && x * dpr <= p+delta, "test"+test+" LastMouseX got " + p + " expected " + x +
" with fullZoom="+SpecialPowers.getFullZoom(window)+" MozTransform='"+$("container").style.MozTransform+"'");
p = $("plugin1").getLastMouseY();
ok(p-delta <= y && y <= p+delta, "test"+test+" LastMouseY got " + p + " expected " + y +
ok(p-delta <= y * dpr && y * dpr <= p+delta, "test"+test+" LastMouseY got " + p + " expected " + y +
" with fullZoom="+SpecialPowers.getFullZoom(window)+" MozTransform='"+$("container").style.MozTransform+"'");
if (next) next();
}

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

@ -40,10 +40,11 @@ function runTests() {
function verify(test,x,y,next) {
var p = $("plugin1").getLastMouseX();
const delta = 2;
ok(p-delta <= x && x <= p+delta, "test"+test+" LastMouseX got " + p + " expected " + x +
var dpr = window.devicePixelRatio / SpecialPowers.getFullZoom(window);
ok(p-delta <= x * dpr && x * dpr <= p+delta, "test"+test+" LastMouseX got " + p + " expected " + x +
" with fullZoom="+SpecialPowers.getFullZoom(window)+" MozTransform='"+$("container").style.MozTransform+"'");
p = $("plugin1").getLastMouseY();
ok(p-delta <= y && y <= p+delta, "test"+test+" LastMouseY got " + p + " expected " + y +
ok(p-delta <= y * dpr && y * dpr <= p+delta, "test"+test+" LastMouseY got " + p + " expected " + y +
" with fullZoom="+SpecialPowers.getFullZoom(window)+" MozTransform='"+$("container").style.MozTransform+"'");
if (next) next();
}

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

@ -34,11 +34,12 @@
function doTest() {
is(p.getClipRegionRectCount(), 1, "getClipRegionRectCount should be a single rect");
is(p.getClipRegionRectEdge(0,2) - p.getClipRegionRectEdge(0,0), 100, "width of clip region rect");
is(p.getClipRegionRectEdge(0,3) - p.getClipRegionRectEdge(0,1), 50, "height of clip region rect");
var dpr = window.devicePixelRatio;
is(p.getClipRegionRectEdge(0,2) - p.getClipRegionRectEdge(0,0), 100 * dpr, "width of clip region rect");
is(p.getClipRegionRectEdge(0,3) - p.getClipRegionRectEdge(0,1), 50 * dpr, "height of clip region rect");
}
</script>
<p id="display"></p>
<embed id="theplugin" type="application/x-test" width="100" height="50" style="opacity:0" wmode="window"></embed>
<embed id="theplugin" type="application/x-test" width="100" height="50" style="opacity:0" wmode="window"></embed>