2022-12-06 13:17:30 +01:00
|
|
|
<!doctype html>
|
|
|
|
|
|
|
|
<head>
|
2023-12-06 16:41:11 +01:00
|
|
|
<script type="text/javascript" src="tst_qwasmwindow_harness.js"></script>
|
2022-12-06 13:17:30 +01:00
|
|
|
<script>
|
|
|
|
(async () => {
|
2023-12-06 16:41:11 +01:00
|
|
|
const instance = await tst_qwasmwindow_harness_entry({});
|
2022-12-06 13:17:30 +01:00
|
|
|
window.instance = instance;
|
|
|
|
|
|
|
|
const testSandbox = document.createElement('div');
|
|
|
|
testSandbox.id = 'test-sandbox';
|
2023-06-14 14:54:34 +02:00
|
|
|
let nextScreenId = 1;
|
2022-12-06 13:17:30 +01:00
|
|
|
document.body.appendChild(testSandbox);
|
|
|
|
|
2023-02-22 09:50:54 +01:00
|
|
|
const eventList = [];
|
|
|
|
|
2022-12-06 13:17:30 +01:00
|
|
|
const makeSizedDiv = (left, top, width, height) => {
|
|
|
|
const screenDiv = document.createElement('div');
|
|
|
|
|
|
|
|
screenDiv.style.left = `${left}px`;
|
|
|
|
screenDiv.style.top = `${top}px`;
|
|
|
|
screenDiv.style.width = `${width}px`;
|
|
|
|
screenDiv.style.height = `${height}px`;
|
|
|
|
screenDiv.style.backgroundColor = 'lightblue';
|
2023-06-14 14:54:34 +02:00
|
|
|
screenDiv.id = `test-screen-${nextScreenId++}`;
|
2022-12-06 13:17:30 +01:00
|
|
|
|
|
|
|
return screenDiv;
|
|
|
|
};
|
|
|
|
|
|
|
|
window.testSupport = {
|
|
|
|
initializeScreenWithFixedPosition: (left, top, width, height) => {
|
|
|
|
const screenDiv = makeSizedDiv(left, top, width, height);
|
|
|
|
testSandbox.appendChild(screenDiv);
|
|
|
|
|
|
|
|
screenDiv.style.position = 'fixed';
|
|
|
|
instance.qtAddContainerElement(screenDiv);
|
|
|
|
|
|
|
|
return screenDiv;
|
|
|
|
},
|
|
|
|
initializeScreenWithRelativePosition: (left, top, width, height) => {
|
|
|
|
const screenDiv = makeSizedDiv(left, top, width, height);
|
|
|
|
testSandbox.appendChild(screenDiv);
|
|
|
|
|
|
|
|
screenDiv.style.position = 'relative';
|
|
|
|
instance.qtAddContainerElement(screenDiv);
|
|
|
|
|
|
|
|
return screenDiv;
|
|
|
|
},
|
2023-02-15 12:00:10 +01:00
|
|
|
initializeScreenInScrollContainer:
|
|
|
|
(scrollWidth, scrollHeight, left, top, width, height) => {
|
|
|
|
const scrollContainer = document.createElement('div');
|
|
|
|
scrollContainer.style.height = `${scrollHeight}px`;
|
|
|
|
scrollContainer.style.width = `${scrollWidth}px`;
|
|
|
|
testSandbox.appendChild(scrollContainer);
|
2022-12-06 13:17:30 +01:00
|
|
|
|
2023-02-15 12:00:10 +01:00
|
|
|
const screenDiv = makeSizedDiv(left, top, width, height);
|
|
|
|
scrollContainer.appendChild(screenDiv);
|
|
|
|
screenDiv.style.position = 'relative';
|
2022-12-06 13:17:30 +01:00
|
|
|
|
2023-02-15 12:00:10 +01:00
|
|
|
instance.qtAddContainerElement(screenDiv);
|
2022-12-06 13:17:30 +01:00
|
|
|
|
2023-02-15 12:00:10 +01:00
|
|
|
return [scrollContainer, screenDiv];
|
2023-02-22 09:50:54 +01:00
|
|
|
},
|
|
|
|
reportEvent: event => {
|
|
|
|
eventList.push(event);
|
|
|
|
},
|
2023-06-14 14:54:34 +02:00
|
|
|
events: () => eventList,
|
|
|
|
hitTestPoint: (x, y, screenId) => {
|
|
|
|
return document
|
2023-11-03 09:54:30 +01:00
|
|
|
.querySelector(`#${screenId}`)
|
|
|
|
.querySelector('#qt-shadow-container')
|
|
|
|
.shadowRoot.elementsFromPoint(x, y);
|
2023-06-14 14:54:34 +02:00
|
|
|
}
|
2022-12-06 13:17:30 +01:00
|
|
|
};
|
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
</body>
|