blob: 0f2c345e476c6d43e8dbac748875298605dc3193 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
<html>
<head>
<style>
img { display: block; border-style: groove}
</style>
<script>
function startTest()
{
var obj = myWidget.image;
var pxm = myWidget.pixmap;
var img = new Image;
obj.assignToHTMLImageElement(img);
var img1 = document.getElementById("img1");
var img2 = document.getElementById("img2");
var img3 = document.getElementById("img3");
var img4 = document.getElementById("img4");
document.body.appendChild(img);
obj.assignToHTMLImageElement(img3);
pxm.assignToHTMLImageElement(img4);
myWidget.compare(pxm.width, img4.width);
myWidget.compare(obj.width, img3.width);
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" />
<img id="img3" />
<img id="img4" />
</body>
</html>
|