/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* import-globals-from ../../mochitest/layout.js */
loadScripts({ name: "layout.js", dir: MOCHITESTS_DIR });
async function runTests(browser, accDoc) {
await loadContentScripts(browser, {
script: "Layout.sys.mjs",
symbol: "Layout",
});
let paragraph = findAccessibleChildByID(accDoc, "paragraph", [
nsIAccessibleText,
]);
let offset = 64; // beginning of 4th stanza
let [x /* ,y*/] = getPos(paragraph);
let [docX, docY] = getPos(accDoc);
paragraph.scrollSubstringToPoint(
offset,
offset,
COORDTYPE_SCREEN_RELATIVE,
docX,
docY
);
await waitForContentPaint(browser);
testTextPos(paragraph, offset, [x, docY], COORDTYPE_SCREEN_RELATIVE);
await SpecialPowers.spawn(browser, [], () => {
content.Layout.zoomDocument(content.document, 2.0);
});
paragraph = findAccessibleChildByID(accDoc, "paragraph2", [
nsIAccessibleText,
]);
offset = 52; // // beginning of 4th stanza
[x /* ,y*/] = getPos(paragraph);
paragraph.scrollSubstringToPoint(
offset,
offset,
COORDTYPE_SCREEN_RELATIVE,
docX,
docY
);
await waitForContentPaint(browser);
testTextPos(paragraph, offset, [x, docY], COORDTYPE_SCREEN_RELATIVE);
}
/**
* Test caching of accessible object states
*/
addAccessibleTask(
`
Пошел котик на торжок
Купил котик пирожок
Пошел котик на улочку
Купил котик булочку
Самому ли съесть
Либо Сашеньке снесть
Я и сам укушу
Я и Сашеньке снесу