<html> <head> <style> img { display: block; border-style: groove} </style> <script> function startTest() { var obj = myWidget.image; var pxm = myWidget.pixmap; var img = obj.toHTMLImageElement(); var img1 = document.getElementById("img1"); var img2 = document.getElementById("img2"); document.body.appendChild(img); document.body.appendChild(pxm.toHTMLImageElement()); var signalsFired = 0; myWidget.compare(obj.toString(),"[Qt Native Pixmap "+obj.width+","+obj.height+"]"); myWidget.compare(String(pxm),"[Qt Native Pixmap "+pxm.width+","+pxm.height+"]"); // this shouldn't work but shouldn't crash myWidget.randomSlot("foobar"); myWidget.pixmapSignal.connect(function(imgFromSignal) { myWidget.compare(imgFromSignal.height, img2.height); if (++signalsFired == 2) myWidget.completeTest(); }); myWidget.imageSignal.connect(function(imgFromSignal) { myWidget.compare(pxm.height, img2.height); if (++signalsFired == 2) myWidget.completeTest(); }); function continueTestAfterImagesAreLoaded() { if (img1.complete && img2.complete) { myWidget.compare(pxm.height, img2.height); myWidget.pixmapSlot(img); myWidget.imageSlot(pxm); } } img1.onload = continueTestAfterImagesAreLoaded; img2.onload = continueTestAfterImagesAreLoaded; img1.src = obj.toDataUrl(); img2.src = myWidget.pixmap.toDataUrl(); myWidget.image = pxm; myWidget.pixmap = img; } </script> </head> <body onload="startTest()"> <img id="img1" /> <img id="img2" /> </body> </html>