WebKit/qt/tests/hybridPixmap/test.html
changeset 0 4f2f89ce4247
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WebKit/qt/tests/hybridPixmap/test.html	Fri Sep 17 09:02:29 2010 +0300
@@ -0,0 +1,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>