Upload Kmake

This commit is contained in:
Gorochu
2026-05-26 23:36:42 -07:00
parent ba051b2f74
commit 555ec72358
41615 changed files with 13344630 additions and 1 deletions

View File

@ -0,0 +1,34 @@
function raf() {
return new Promise((resolve) => {
// rAF twice.
window.requestAnimationFrame(() => {
window.requestAnimationFrame(resolve);
});
});
}
async function runTest({target, eventName, passive, expectCancelable}) {
await raf();
let cancelable = null;
let arrived = false;
target.addEventListener(eventName, function (event) {
cancelable = event.cancelable;
arrived = true;
}, {passive:passive, once:true});
promise_test(async (t) => {
t.add_cleanup(() => {
document.querySelector('.remove-on-cleanup')?.remove();
});
const pos_x = Math.floor(window.innerWidth / 2);
const pos_y = Math.floor(window.innerHeight / 2);
const delta_x = 0;
const delta_y = 100;
await new test_driver.Actions()
.scroll(pos_x, pos_y, delta_x, delta_y).send();
await t.step_wait(() => arrived, `Didn't get event ${eventName} on ${target.localName}`);
assert_equals(cancelable, expectCancelable);
});
}

View File

@ -0,0 +1,34 @@
function waitForCompositorCommit() {
return new Promise((resolve) => {
// rAF twice.
window.requestAnimationFrame(() => {
window.requestAnimationFrame(resolve);
});
});
}
function injectInput(touchDiv) {
return new test_driver.Actions()
.addPointer("touch_pointer", "touch")
.pointerMove(0, 0, {origin: touchDiv})
.pointerDown()
.pointerMove(30, 30)
.pointerUp()
.send();
}
function runTest({target, eventName, passive, expectCancelable}) {
let touchDiv = document.getElementById("touchDiv");
let cancelable = null;
let arrived = false;
target.addEventListener(eventName, function (event) {
cancelable = event.cancelable;
arrived = true;
}, {passive});
promise_test(async () => {
await waitForCompositorCommit();
await injectInput(touchDiv);
await waitFor(() => arrived);
assert_equals(cancelable, expectCancelable);
});
}

View File

@ -0,0 +1,15 @@
function waitFor(condition, MAX_FRAME = 500) {
return new Promise((resolve, reject) => {
function tick(frames) {
// We requestAnimationFrame either for MAX_FRAME frames or until condition is
// met.
if (frames >= MAX_FRAME)
reject(new Error(`Condition did not become true after ${MAX_FRAME} frames`));
else if (condition())
resolve();
else
requestAnimationFrame(() => tick(frames + 1));
}
tick(0);
});
}