mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
59 lines
1.6 KiB
HTML
59 lines
1.6 KiB
HTML
<html>
|
|
<head>
|
|
<title>Test NPN_Invalidate working for a windowed plugin</title>
|
|
<script type="text/javascript"
|
|
src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css"
|
|
href="/tests/SimpleTest/test.css" />
|
|
</head>
|
|
<body onload="checkPaintCountStabilized()">
|
|
<p id="display"></p>
|
|
|
|
<embed id="p" type="application/x-test" wmode="window" drawmode="solid"
|
|
color="FFFF0000">
|
|
</embed>
|
|
|
|
<script class="testbody" type="application/javascript">
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
var lastPaintCount;
|
|
var p = document.getElementById("p");
|
|
|
|
function checkPainted() {
|
|
if (p.getPaintCount() > lastPaintCount) {
|
|
ok(true, "Plugin did repaint");
|
|
SimpleTest.finish();
|
|
} else {
|
|
setTimeout(checkPainted, 100);
|
|
}
|
|
}
|
|
|
|
function doTest() {
|
|
// Cause the plugin to invalidate itself using NPN_Invalidate,
|
|
// and then wait for the plugin's paintCount to increase. This is the
|
|
// simplest way to check that a windowed plugin has repainted.
|
|
p.setColor("FF00FF00");
|
|
checkPainted();
|
|
}
|
|
|
|
function checkPaintCountStabilized() {
|
|
// Wait for the paint count to stabilize (i.e. doesn't change for a full
|
|
// second), so that all buffered-up painting is hopefully finished,
|
|
// before running the test
|
|
lastPaintCount = p.getPaintCount();
|
|
setTimeout(function() {
|
|
var newCount = p.getPaintCount();
|
|
if (newCount == lastPaintCount) {
|
|
doTest();
|
|
} else {
|
|
checkPaintCountStabilized();
|
|
}
|
|
}, 1000);
|
|
}
|
|
</script>
|
|
|
|
<div id="verbose">
|
|
</div>
|
|
</body>
|
|
</html>
|