/* 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";
async function testIsControl(pyVar, isControl) {
const result = await runPython(`bool(${pyVar}.CurrentIsControlElement)`);
if (isControl) {
ok(result, `${pyVar} is a control element`);
} else {
ok(!result, `${pyVar} isn't a control element`);
}
}
/**
* Define a global Python variable and assign it to a given Python expression.
*/
function definePyVar(varName, expression) {
return runPython(`
global ${varName}
${varName} = ${expression}
`);
}
/**
* Get the UIA element with the given id and assign it to a global Python
* variable using the id as the variable name.
*/
function assignPyVarToUiaWithId(id) {
return definePyVar(id, `findUiaByDomId(doc, "${id}")`);
}
addUiaTask(
`