Home | History | Annotate | Download | only in hybridPixmap
      1 <html>
      2     <head>
      3         <style>
      4             img { display: block; border-style: groove}
      5         </style>
      6         <script>
      7             function startTest()
      8             {
      9                 var obj = myWidget.image;
     10                 var pxm = myWidget.pixmap;
     11 
     12                 var img = new Image;
     13                 obj.assignToHTMLImageElement(img);
     14                 var img1 = document.getElementById("img1");
     15                 var img2 = document.getElementById("img2");
     16                 var img3 = document.getElementById("img3");
     17                 var img4 = document.getElementById("img4");
     18                 document.body.appendChild(img);
     19                 obj.assignToHTMLImageElement(img3);
     20                 pxm.assignToHTMLImageElement(img4);
     21                 myWidget.compare(pxm.width, img4.width);
     22                 myWidget.compare(obj.width, img3.width);
     23                 var signalsFired = 0;
     24                 myWidget.compare(obj.toString(),"[Qt Native Pixmap "+obj.width+","+obj.height+"]");
     25                 myWidget.compare(String(pxm),"[Qt Native Pixmap "+pxm.width+","+pxm.height+"]");
     26 
     27                 // this shouldn't work but shouldn't crash
     28                 myWidget.randomSlot("foobar");
     29 
     30                 myWidget.pixmapSignal.connect(function(imgFromSignal) {
     31                     myWidget.compare(imgFromSignal.height, img2.height);
     32                     if (++signalsFired == 2)
     33                         myWidget.completeTest();
     34                 });
     35 
     36                 myWidget.imageSignal.connect(function(imgFromSignal) {
     37                     myWidget.compare(pxm.height, img2.height);
     38                     if (++signalsFired == 2)
     39                         myWidget.completeTest();
     40                 });
     41 
     42                 function continueTestAfterImagesAreLoaded()
     43                 {
     44                     if (img1.complete && img2.complete) {
     45                         myWidget.compare(pxm.height, img2.height);
     46                         myWidget.pixmapSlot(img);
     47                         myWidget.imageSlot(pxm);
     48                     }
     49                 }
     50                 img1.onload = continueTestAfterImagesAreLoaded;
     51                 img2.onload = continueTestAfterImagesAreLoaded;
     52                 img1.src = obj.toDataUrl();
     53                 img2.src = myWidget.pixmap.toDataUrl();
     54                 myWidget.image = pxm;
     55                 myWidget.pixmap = img;
     56             }
     57         </script>
     58     </head>
     59     <body onload="startTest()">
     60         <img id="img1" />
     61         <img id="img2" />
     62         <img id="img3" />
     63         <img id="img4" />
     64     </body>
     65 </html>
     66