From 4e06807baf317709562d0a5283efc24fdcbd14a3 Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Thu, 6 Oct 2011 14:08:37 +1000 Subject: [PATCH] add canvas drawImage unit tests Change-Id: I772bf58bead4b536cc632983846743e0d576bedd Reviewed-on: http://codereview.qt-project.org/6100 Reviewed-by: Qt Sanity Bot Reviewed-by: Charles Yin --- src/declarative/items/context2d/qsgcontext2d.cpp | 40 +- .../declarative/qsgcanvasitem/data/anim-gr.gif | Bin 0 -> 241 bytes .../declarative/qsgcanvasitem/data/anim-gr.png | Bin 0 -> 460 bytes .../qsgcanvasitem/data/anim-poster-gr.png | Bin 0 -> 422 bytes .../declarative/qsgcanvasitem/data/background.png | Bin 0 -> 86 bytes .../auto/declarative/qsgcanvasitem/data/broken.png | Bin 0 -> 87 bytes .../qsgcanvasitem/data/ggrr-256x256.png | Bin 0 -> 120 bytes .../declarative/qsgcanvasitem/data/green-16x16.png | Bin 0 -> 92 bytes .../declarative/qsgcanvasitem/data/green-1x1.png | Bin 0 -> 82 bytes .../qsgcanvasitem/data/green-256x256.png | Bin 0 -> 103 bytes .../declarative/qsgcanvasitem/data/green-2x2.png | Bin 0 -> 118 bytes .../auto/declarative/qsgcanvasitem/data/green.png | Bin 0 -> 87 bytes .../qsgcanvasitem/data/grgr-256x256.png | Bin 0 -> 130 bytes .../declarative/qsgcanvasitem/data/qt-logo.png | Bin 23519 -> 0 bytes .../declarative/qsgcanvasitem/data/red-16x16.png | Bin 0 -> 130 bytes tests/auto/declarative/qsgcanvasitem/data/red.png | Bin 0 -> 87 bytes .../qsgcanvasitem/data/redtransparent.png | Bin 0 -> 109 bytes .../qsgcanvasitem/data/rgrg-256x256.png | Bin 0 -> 131 bytes .../qsgcanvasitem/data/rrgg-256x256.png | Bin 0 -> 120 bytes .../declarative/qsgcanvasitem/data/transparent.png | Bin 0 -> 100 bytes .../qsgcanvasitem/data/transparent50.png | Bin 0 -> 155 bytes .../declarative/qsgcanvasitem/data/tst_canvas.qml | 18 +- .../qsgcanvasitem/data/tst_drawimage.qml | 622 +++++++++++++++++++- .../auto/declarative/qsgcanvasitem/data/yellow.png | Bin 0 -> 95 bytes .../declarative/qsgcanvasitem/data/yellow75.png | Bin 0 -> 150 bytes 25 files changed, 659 insertions(+), 21 deletions(-) create mode 100644 tests/auto/declarative/qsgcanvasitem/data/anim-gr.gif create mode 100644 tests/auto/declarative/qsgcanvasitem/data/anim-gr.png create mode 100644 tests/auto/declarative/qsgcanvasitem/data/anim-poster-gr.png create mode 100644 tests/auto/declarative/qsgcanvasitem/data/background.png create mode 100644 tests/auto/declarative/qsgcanvasitem/data/broken.png create mode 100644 tests/auto/declarative/qsgcanvasitem/data/ggrr-256x256.png create mode 100644 tests/auto/declarative/qsgcanvasitem/data/green-16x16.png create mode 100644 tests/auto/declarative/qsgcanvasitem/data/green-1x1.png create mode 100644 tests/auto/declarative/qsgcanvasitem/data/green-256x256.png create mode 100644 tests/auto/declarative/qsgcanvasitem/data/green-2x2.png create mode 100644 tests/auto/declarative/qsgcanvasitem/data/green.png create mode 100644 tests/auto/declarative/qsgcanvasitem/data/grgr-256x256.png delete mode 100644 tests/auto/declarative/qsgcanvasitem/data/qt-logo.png create mode 100644 tests/auto/declarative/qsgcanvasitem/data/red-16x16.png create mode 100644 tests/auto/declarative/qsgcanvasitem/data/red.png create mode 100644 tests/auto/declarative/qsgcanvasitem/data/redtransparent.png create mode 100644 tests/auto/declarative/qsgcanvasitem/data/rgrg-256x256.png create mode 100644 tests/auto/declarative/qsgcanvasitem/data/rrgg-256x256.png create mode 100644 tests/auto/declarative/qsgcanvasitem/data/transparent.png create mode 100644 tests/auto/declarative/qsgcanvasitem/data/transparent50.png create mode 100644 tests/auto/declarative/qsgcanvasitem/data/yellow.png create mode 100644 tests/auto/declarative/qsgcanvasitem/data/yellow75.png diff --git a/src/declarative/items/context2d/qsgcontext2d.cpp b/src/declarative/items/context2d/qsgcontext2d.cpp index ef69eef..91c9b4d 100644 --- a/src/declarative/items/context2d/qsgcontext2d.cpp +++ b/src/declarative/items/context2d/qsgcontext2d.cpp @@ -2411,7 +2411,7 @@ static v8::Handle ctx2d_measureText(const v8::Arguments &args) Note: - The \a image type can be an Image item, an image url or a \a {QtQuick2::CanvasImageData} object. + The \a image type can be an Image or Canvas item, an image url or a \a {QtQuick2::CanvasImageData} object. When given as Image item, if the image isn't fully loaded, this method draws nothing. When given as url string, the image should be loaded by calling Canvas item's \a QtQuick2::Canvas::loadImage() method first. This image been drawing is subject to the current context clip path, even the given \c image is a {QtQuick2::CanvasImageData} object. @@ -2437,32 +2437,42 @@ static v8::Handle ctx2d_drawImage(const v8::Arguments &args) QImage image; if (args[0]->IsString()) { - image = r->context->createImage(QUrl(engine->toString(args[0]->ToString()))); + QUrl url(engine->toString(args[0]->ToString())); + if (!url.isValid()) + V8THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch"); + + image = r->context->createImage(url); } else if (args[0]->IsObject()) { - QSGImage* imageItem = qobject_cast(engine->toQObject(args[0]->ToObject())); - QV8Context2DPixelArrayResource *r = v8_resource_cast(args[0]->ToObject()->GetInternalField(0)->ToObject()); - if (r) { - image = r->image; + QSGImage *imageItem = qobject_cast(engine->toQObject(args[0]->ToObject())); + QSGCanvasItem *canvas = qobject_cast(engine->toQObject(args[0]->ToObject())); + + QV8Context2DPixelArrayResource *pix = v8_resource_cast(args[0]->ToObject()->GetInternalField(0)->ToObject()); + if (pix) { + image = pix->image; } else if (imageItem) { image = imageItem->pixmap().toImage(); + } else if (canvas) { + image = canvas->toImage(); } else { V8THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch"); } + } else { + V8THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch"); } if (args.Length() == 3) { dx = args[1]->NumberValue(); dy = args[2]->NumberValue(); sx = 0; sy = 0; - sw = image.isNull()? -1 : image.width(); - sh = image.isNull()? -1 : image.height(); + sw = image.width(); + sh = image.height(); dw = sw; dh = sh; } else if (args.Length() == 5) { sx = 0; sy = 0; - sw = image.isNull()? -1 : image.width(); - sh = image.isNull()? -1 : image.height(); + sw = image.width(); + sh = image.height(); dx = args[1]->NumberValue(); dy = args[2]->NumberValue(); dw = args[3]->NumberValue(); @@ -2490,7 +2500,15 @@ static v8::Handle ctx2d_drawImage(const v8::Arguments &args) || !qIsFinite(dh)) return args.This(); - r->context->buffer()->drawImage(image,sx, sy, sw, sh, dx, dy, dw, dh); + if (!image.isNull()) { + if (sx < 0 || sy < 0 || sw == 0 || sh == 0 + || sx + sw > image.width() || sy + sh > image.height() + || sx + sw < 0 || sy + sh < 0) { + V8THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "drawImage(), index size error"); + } + + r->context->buffer()->drawImage(image,sx, sy, sw, sh, dx, dy, dw, dh); + } return args.This(); } diff --git a/tests/auto/declarative/qsgcanvasitem/data/anim-gr.gif b/tests/auto/declarative/qsgcanvasitem/data/anim-gr.gif new file mode 100644 index 0000000000000000000000000000000000000000..45263e0afba7b708417510df24cadf70d82d9116 GIT binary patch literal 241 zcmZ?wbhEHbOkpr$_`txx@E?d76o0ZXFoNj++ulEcJL|r4^K~D8vgv1zHpEf^btD@az;28Ci1NIDx$Bo-U3d6?5L6GvoytbHL!w?6zvIV;iqHq?@gO(Ktbl zoS|)rq)@U)kD_7Q5eZr|_$v>-*5=KZ^ai?#!PC{xWt~$( F698Hck68c! literal 0 HcmV?d00001 diff --git a/tests/auto/declarative/qsgcanvasitem/data/anim-poster-gr.png b/tests/auto/declarative/qsgcanvasitem/data/anim-poster-gr.png new file mode 100644 index 0000000000000000000000000000000000000000..6941207373e513cfe10729077f59d369c59e6046 GIT binary patch literal 422 zcmeAS@N?(olHy`uVBq!ia0vp^DL`z*!3HE(nbz$CQXGlNAwEEw5r`SK=)PP4q^5hi zIEGZrd3(-~7pUNX!JpY})m+CmUU5h_TmPbQf*i-ofglbrvgo|lo-AlR1?WVnG>Ef- zOo*RA3^4e`{DP6ux2tzP_jplqG8(+30gDwD-XWbzP|J1G>}U@UHx3vIVCg!0B<*q;s5{u literal 0 HcmV?d00001 diff --git a/tests/auto/declarative/qsgcanvasitem/data/background.png b/tests/auto/declarative/qsgcanvasitem/data/background.png new file mode 100644 index 0000000000000000000000000000000000000000..6db6c6b1b9d851c7a85b93ddc9e5ddf368ac0a7e GIT binary patch literal 86 zcmeAS@N?(olHy`uVBq!ia0vp^3Lwk@BpAX3RW*Q=tfz}(h{fq-iw3rTiy7MjS(UvQ dcQNdOFc<=K>hx~uHmid)c)I$ztaD0e0sy7L60!gQ literal 0 HcmV?d00001 diff --git a/tests/auto/declarative/qsgcanvasitem/data/broken.png b/tests/auto/declarative/qsgcanvasitem/data/broken.png new file mode 100644 index 0000000000000000000000000000000000000000..f2581017b43d44664e7137a78c0803554b50f3b1 GIT binary patch literal 87 zcmeAS@N?(olHy`uVBq!ia0vp^DL`z*$P6SW{C@KnNHGWagt-1^V32&oX%6J_d%8G= RL|_3xIZszVmvv4FO#n416=47X literal 0 HcmV?d00001 diff --git a/tests/auto/declarative/qsgcanvasitem/data/ggrr-256x256.png b/tests/auto/declarative/qsgcanvasitem/data/ggrr-256x256.png new file mode 100644 index 0000000000000000000000000000000000000000..0342e4a38425886d5fa9159fcfaa9a06093937e3 GIT binary patch literal 120 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpL{;1lA?@E-^nF3$E^2Ncou zba4#HxcBzdMqUO64(0{_{%@Ig;oy#gK1@K#4>??p0xU4pk{oe$?T1I)2OWxmatxlX KelF{r5}E+gJ0chW literal 0 HcmV?d00001 diff --git a/tests/auto/declarative/qsgcanvasitem/data/green-16x16.png b/tests/auto/declarative/qsgcanvasitem/data/green-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..e19a3ffddd2567de2be00a9bcede541935d79bd0 GIT binary patch literal 92 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;bAV5XE5m;VlehybfLswz7srr_ lxTyykfgFa01%FqjueiWqz`&@!Uu6kM$kWx&Wt~$(696W66?^~y literal 0 HcmV?d00001 diff --git a/tests/auto/declarative/qsgcanvasitem/data/green-1x1.png b/tests/auto/declarative/qsgcanvasitem/data/green-1x1.png new file mode 100644 index 0000000000000000000000000000000000000000..862d1dd10cc9f261e0b4df57902258a85b2e6f4b GIT binary patch literal 82 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga%mF?jt_=SfOyUl#0CKrJT^vI= bWRnwsY$gWA^CwK70$B{6u6{1-oD!Mg literal 0 HcmV?d00001 diff --git a/tests/auto/declarative/qsgcanvasitem/data/green-2x2.png b/tests/auto/declarative/qsgcanvasitem/data/green-2x2.png new file mode 100644 index 0000000000000000000000000000000000000000..adc059449c39257a422104029eec60e706c6df3a GIT binary patch literal 118 zcmeAS@N?(olHy`uVBq!ia0vp^Odu=(BG+6W5%zR(4B@z*oRaY4|9nQS84?p17<3hxnEt7#R{*6MJYD@<);T3K0RV-} B7k~f& literal 0 HcmV?d00001 diff --git a/tests/auto/declarative/qsgcanvasitem/data/green.png b/tests/auto/declarative/qsgcanvasitem/data/green.png new file mode 100644 index 0000000000000000000000000000000000000000..28a1faab37797ef39454aa1deac1b470712f7be4 GIT binary patch literal 87 zcmeAS@N?(olHy`uVBq!ia0vp^DL`z*$P6SW{C@KnNHGWagt#*NXE2F7umZ^C_jGX# j(GX2ekYHV$kio>jw1BQFC3$6F@bbJSLTODKN-0VL1Lb+ KelF{r5}E)`vL4s~ literal 0 HcmV?d00001 diff --git a/tests/auto/declarative/qsgcanvasitem/data/qt-logo.png b/tests/auto/declarative/qsgcanvasitem/data/qt-logo.png deleted file mode 100644 index 5ab3a1b0c4618ccce8321db7253b8dcdc86cfa98..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 23519 zcmV)VK(D`vP)FvFqxwoocch#+PZq<9QT9(bdpGw`YySn=Jt$ViL*^r394L96) zVULVk0yo@ngzknLZa6}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1=U4vEuY`?`#560 z2fK!6(?YV+!%wD>x$vjqgL47-(zjN4Uva!#Q9DmkW9Wqfy=&UPQAnf2dauWSPPY3} zcIfO<`s9C<>o-<~wbQhIFlXHGnv8%^Y;Vlx_E3bJWx(F$@l zBAim+?{2M;=}VpS3myow)2rpL7?j}L2j6Kw+>p4=96dXF7tUQ`v{p;(4s&NOK5igM zUZSZt;+BD+^odEDT<;RkSLb!#7i%&YxX5mi)um^-HGX=z{9Ngi+->&zkY}%yGk9fJ zysmb3VTM>2N`|Cth~z!aaHkm4oL*voZ(UC+IH2jD@k0!R&_XP;L8abEh-wz5T#0o>vCaKe?@V4a_1i6g@X2-4Mqd-Vr;KO#JTFD|V{COn1@v@a zvU|G#ef{~GaMJN5rM<-a-p p8}UE=)&EKOU&Hly+4&PX5QWInvX?L?{t4yzQ&-kjLMWPt{tw8XKA8Xj diff --git a/tests/auto/declarative/qsgcanvasitem/data/red-16x16.png b/tests/auto/declarative/qsgcanvasitem/data/red-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..9038fef784dacafdcfdce03fb12b90647bb52d2e GIT binary patch literal 130 zcmeAS@N?(olHy`uVBq!ia0vp^0w65F1SAhIZYc#)oCO|{#X#BvjNMLV+kphj3LMjc zG*~r5%(1nHfgE{H7sn8b)5(AS&u?7T(7Ekcf0RMi!4<5F#d@L~WEmJLmNUsc;ZKYN PDrN9=^>bP0l+XkK&)6W) literal 0 HcmV?d00001 diff --git a/tests/auto/declarative/qsgcanvasitem/data/red.png b/tests/auto/declarative/qsgcanvasitem/data/red.png new file mode 100644 index 0000000000000000000000000000000000000000..a6e195d59cce3c15ef12512bb58ed4f409eb95ae GIT binary patch literal 87 zcmeAS@N?(olHy`uVBq!ia0vp^DL`z*$P6SW{C@KnNHGWagt-1^V32&oX%6J_d%8G= jXow~!NU$zW$Y5e%+QYyoefRMMpcI3rtDnm{r-UW|6k!xK literal 0 HcmV?d00001 diff --git a/tests/auto/declarative/qsgcanvasitem/data/redtransparent.png b/tests/auto/declarative/qsgcanvasitem/data/redtransparent.png new file mode 100644 index 0000000000000000000000000000000000000000..75da08c3d6672e3db0a3fb43394edf42271e7175 GIT binary patch literal 109 zcmeAS@N?(olHy`uVBq!ia0vp^DL`z*$P6SW{C@KnNU;U@gt#&=GyG>@h>8FH2`Iu? z666=m;PC858jvIE>EaloaX$G6KO4J*Lc$dDQ_@B@3~Z|cQtGFs8~`d{@O1TaS?83{ F1ORLq9D)D< literal 0 HcmV?d00001 diff --git a/tests/auto/declarative/qsgcanvasitem/data/rgrg-256x256.png b/tests/auto/declarative/qsgcanvasitem/data/rgrg-256x256.png new file mode 100644 index 0000000000000000000000000000000000000000..e6fba3daa5dfc788eaeedb73636e82abfedc8ae5 GIT binary patch literal 131 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpL{;1lA?@E-^nF3$E^2NbdJ zba4#HxcBygq7VZE$Kefs|6hKPZW*&`@vN1XK>A@orcocp1kyImtX-KO9z9rOVgwTP MboFyt=akR{0Mu9^N&o-= literal 0 HcmV?d00001 diff --git a/tests/auto/declarative/qsgcanvasitem/data/rrgg-256x256.png b/tests/auto/declarative/qsgcanvasitem/data/rrgg-256x256.png new file mode 100644 index 0000000000000000000000000000000000000000..7f6351565473f4b8db1fa69530700491f7c88a54 GIT binary patch literal 120 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpL{;1lA?@E-^nF3$E^2Ncou zba4#HxcBzdMqUO64(0{_{%@Ig;oy#gKFc~3IGSMSkRebhgH5!(>W4@ApRc=tc%H6) JF6*2UngH?+BB1~P literal 0 HcmV?d00001 diff --git a/tests/auto/declarative/qsgcanvasitem/data/transparent.png b/tests/auto/declarative/qsgcanvasitem/data/transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..2b498699a80d9189af3aad09ae9e530fe23ab069 GIT binary patch literal 100 zcmeAS@N?(olHy`uVBq!ia0vp^DL`z*$P6SW{C@KnNHGWagt!9f% literal 0 HcmV?d00001 diff --git a/tests/auto/declarative/qsgcanvasitem/data/tst_canvas.qml b/tests/auto/declarative/qsgcanvasitem/data/tst_canvas.qml index 65649df..b6621d8 100644 --- a/tests/auto/declarative/qsgcanvasitem/data/tst_canvas.qml +++ b/tests/auto/declarative/qsgcanvasitem/data/tst_canvas.qml @@ -234,17 +234,17 @@ Rectangle { var c = canvas.createObject(); verify(c); - c.loadImage("qt-logo.png"); + c.loadImage("red.png"); wait(200); compare(c.imageLoadedCount, 1); - verify(c.isImageLoaded("qt-logo.png")); - verify(!c.isImageLoading("qt-logo.png")); - verify(!c.isImageError("qt-logo.png")); - - c.unloadImage("qt-logo.png"); - verify(!c.isImageLoaded("qt-logo.png")); - verify(!c.isImageLoading("qt-logo.png")); - verify(!c.isImageError("qt-logo.png")); + verify(c.isImageLoaded("red.png")); + verify(!c.isImageLoading("red.png")); + verify(!c.isImageError("red.png")); + + c.unloadImage("red.png"); + verify(!c.isImageLoaded("red.png")); + verify(!c.isImageLoading("red.png")); + verify(!c.isImageError("red.png")); c.destroy(); } diff --git a/tests/auto/declarative/qsgcanvasitem/data/tst_drawimage.qml b/tests/auto/declarative/qsgcanvasitem/data/tst_drawimage.qml index 2f10501..3752f52 100644 --- a/tests/auto/declarative/qsgcanvasitem/data/tst_drawimage.qml +++ b/tests/auto/declarative/qsgcanvasitem/data/tst_drawimage.qml @@ -3,32 +3,215 @@ import QtTest 1.0 import "testhelper.js" as Helper Canvas { id:canvas; width:100;height:50; renderTarget: Canvas.Image + Component.onCompleted: { + canvas.loadImage('green.png'); + canvas.loadImage('red.png'); + canvas.loadImage('rgrg-256x256.png'); + canvas.loadImage('ggrr-256x256.png'); + canvas.loadImage('broken.png'); + } + TestCase { //TODO name: "image"; when: windowShown function test_3args() { + //make sure all images are loaded + wait(200); var ctx = canvas.getContext('2d'); ctx.reset(); + ctx.drawImage('green.png', 0, 0); + ctx.drawImage('red.png', -100, 0); + ctx.drawImage('red.png', 100, 0); + ctx.drawImage('red.png', 0, -50); + ctx.drawImage('red.png', 0, 50); + + verify(Helper.comparePixel(ctx, 0,0, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 99,0, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 0,49, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 99,49, 0,255,0,255,2)); + } function test_5args() { var ctx = canvas.getContext('2d'); ctx.reset(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.drawImage('green.png', 50, 0, 50, 50); + ctx.drawImage('red.png', 0, 0, 50, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 50); + + verify(Helper.comparePixel(ctx, 0,0, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 99,0, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 0,49, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 99,49, 0,255,0,255,2)); + } function test_9args() { var ctx = canvas.getContext('2d'); ctx.reset(); - } + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.drawImage('green.png', 0, 0, 100, 50, 0, 0, 100, 50); + verify(Helper.comparePixel(ctx, 0,0, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 99,0, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 0,49, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 99,49, 0,255,0,255,2)); + + ctx.reset(); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.drawImage('green.png', 0, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage('red.png', 0, 0, 100, 50, -100, 0, 100, 50); + ctx.drawImage('red.png', 0, 0, 100, 50, 100, 0, 100, 50); + ctx.drawImage('red.png', 0, 0, 100, 50, 0, -50, 100, 50); + ctx.drawImage('red.png', 0, 0, 100, 50, 0, 50, 100, 50); + verify(Helper.comparePixel(ctx, 0,0, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 99,0, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 0,49, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 99,49, 0,255,0,255,2)); + + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.drawImage('green.png', 1, 1, 1, 1, 0, 0, 100, 50); + ctx.drawImage('red.png', 0, 0, 100, 50, -50, 0, 50, 50); + ctx.drawImage('red.png', 0, 0, 100, 50, 100, 0, 50, 50); + ctx.drawImage('red.png', 0, 0, 100, 50, 0, -25, 100, 25); + ctx.drawImage('red.png', 0, 0, 100, 50, 0, 50, 100, 25); + verify(Helper.comparePixel(ctx, 0,0, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 99,0, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 0,49, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 99,49, 0,255,0,255,2)); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.drawImage('rgrg-256x256.png', 140, 20, 100, 50, 0, 0, 100, 50); + verify(Helper.comparePixel(ctx, 0,0, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 99,0, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 0,49, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 99,49, 0,255,0,255,2)); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.drawImage('rgrg-256x256.png', 0, 0, 256, 256, 0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 51, 26); + ctx.fillRect(49, 24, 51, 26); + verify(Helper.comparePixel(ctx, 0,0, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 99,0, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 0,49, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 99,49, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 20,20, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 80,20, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 20,30, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 80,30, 0,255,0,255,2)); + + } function test_animated() { var ctx = canvas.getContext('2d'); ctx.reset(); + //should animated image be supported at all? } function test_clip() { var ctx = canvas.getContext('2d'); ctx.reset(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.rect(-10, -10, 1, 1); + ctx.clip(); + ctx.drawImage('red.png', 0, 0); + verify(Helper.comparePixel(ctx, 50,25, 0,255,0,255,2)); + + } + function test_self() { + var ctx = canvas.getContext('2d'); + ctx.reset(); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(50, 0, 50, 50); + ctx.drawImage(canvas, 50, 0); + + verify(Helper.comparePixel(ctx, 0,0, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 99,0, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 0,49, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 99,49, 0,255,0,255,2)); + + ctx.reset(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 1, 100, 49); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 1); + ctx.drawImage(canvas, 0, 1); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 2); + + verify(Helper.comparePixel(ctx, 0,0, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 99,0, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 0,49, 0,255,0,255,2)); + verify(Helper.comparePixel(ctx, 99,49, 0,255,0,255,2)); + + + } + + function test_outsidesource() { + var ctx = canvas.getContext('2d'); + ctx.reset(); + + ctx.drawImage('green.png', 10.5, 10.5, 89.5, 39.5, 0, 0, 100, 50); + ctx.drawImage('green.png', 5.5, 5.5, -5.5, -5.5, 0, 0, 100, 50); + ctx.drawImage('green.png', 100, 50, -5, -5, 0, 0, 100, 50); + try { var err = false; + ctx.drawImage('red.png', -0.001, 0, 100, 50, 0, 0, 100, 50); + } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', -0.001, 0, 100, 50, 0, 0, 100, 50)"); } + try { var err = false; + ctx.drawImage('red.png', 0, -0.001, 100, 50, 0, 0, 100, 50); + } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 0, -0.001, 100, 50, 0, 0, 100, 50)"); } + try { var err = false; + ctx.drawImage('red.png', 0, 0, 100.001, 50, 0, 0, 100, 50); + } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 0, 0, 100.001, 50, 0, 0, 100, 50)"); } + try { var err = false; + ctx.drawImage('red.png', 0, 0, 100, 50.001, 0, 0, 100, 50); + } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 0, 0, 100, 50.001, 0, 0, 100, 50)"); } + try { var err = false; + ctx.drawImage('red.png', 50, 0, 50.001, 50, 0, 0, 100, 50); + } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 50, 0, 50.001, 50, 0, 0, 100, 50)"); } + try { var err = false; + ctx.drawImage('red.png', 0, 0, -5, 5, 0, 0, 100, 50); + } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 0, 0, -5, 5, 0, 0, 100, 50)"); } + try { var err = false; + ctx.drawImage('red.png', 0, 0, 5, -5, 0, 0, 100, 50); + } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 0, 0, 5, -5, 0, 0, 100, 50)"); } +// try { var err = false; +// ctx.drawImage('red.png', 110, 60, -20, -20, 0, 0, 100, 50); +// } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 110, 60, -20, -20, 0, 0, 100, 50)"); } +// verify(Helper.comparePixel(ctx, 50,25, 0,255,0,255,2)); + + } + + function test_null() { + var ctx = canvas.getContext('2d'); + ctx.reset(); + + try { var err = false; + ctx.drawImage(null, 0, 0); + } catch (e) { if (e.code != DOMException.TYPE_MISMATCH_ERR) fail("Failed assertion: expected exception of type TYPE_MISMATCH_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type TYPE_MISMATCH_ERR: ctx.drawImage(null, 0, 0)"); } + + } + function test_composite() { var ctx = canvas.getContext('2d'); ctx.reset(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'destination-over'; + ctx.drawImage('red.png', 0, 0); + verify(Helper.comparePixel(ctx, 50,25, 0,255,0,255,2)); + } function test_path() { var ctx = canvas.getContext('2d'); @@ -37,6 +220,443 @@ Canvas { function test_transform() { var ctx = canvas.getContext('2d'); ctx.reset(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.translate(100, 0); + ctx.drawImage('red.png', 0, 0); + verify(Helper.comparePixel(ctx, 50,25, 0,255,0,255,2)); + } + + function test_imageitem() { + var ctx = canvas.getContext('2d'); + ctx.reset(); + //TODO + } + + function test_imageData() { + var ctx = canvas.getContext('2d'); + ctx.reset(); + //TODO + } + + function test_wrongtype() { + var ctx = canvas.getContext('2d'); + ctx.reset(); + + try { var err = false; + ctx.drawImage(undefined, 0, 0); + } catch (e) { if (e.code != DOMException.TYPE_MISMATCH_ERR) fail("Failed assertion: expected exception of type TYPE_MISMATCH_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type TYPE_MISMATCH_ERR: ctx.drawImage(undefined, 0, 0)"); } + try { var err = false; + ctx.drawImage(0, 0, 0); + } catch (e) { if (e.code != DOMException.TYPE_MISMATCH_ERR) fail("Failed assertion: expected exception of type TYPE_MISMATCH_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type TYPE_MISMATCH_ERR: ctx.drawImage(0, 0, 0)"); } + try { var err = false; + ctx.drawImage("", 0, 0); + } catch (e) { if (e.code != DOMException.TYPE_MISMATCH_ERR) fail("Failed assertion: expected exception of type TYPE_MISMATCH_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type TYPE_MISMATCH_ERR: ctx.drawImage(\"\", 0, 0)"); } + } + + function test_nonfinite() { + var ctx = canvas.getContext('2d'); + ctx.reset(); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + var red = 'red.png'; + ctx.drawImage(red, Infinity, 0); + ctx.drawImage(red, -Infinity, 0); + ctx.drawImage(red, NaN, 0); + ctx.drawImage(red, 0, Infinity); + ctx.drawImage(red, 0, -Infinity); + ctx.drawImage(red, 0, NaN); + ctx.drawImage(red, Infinity, Infinity); + ctx.drawImage(red, Infinity, 0, 100, 50); + ctx.drawImage(red, -Infinity, 0, 100, 50); + ctx.drawImage(red, NaN, 0, 100, 50); + ctx.drawImage(red, 0, Infinity, 100, 50); + ctx.drawImage(red, 0, -Infinity, 100, 50); + ctx.drawImage(red, 0, NaN, 100, 50); + ctx.drawImage(red, 0, 0, Infinity, 50); + ctx.drawImage(red, 0, 0, -Infinity, 50); + ctx.drawImage(red, 0, 0, NaN, 50); + ctx.drawImage(red, 0, 0, 100, Infinity); + ctx.drawImage(red, 0, 0, 100, -Infinity); + ctx.drawImage(red, 0, 0, 100, NaN); + ctx.drawImage(red, Infinity, Infinity, 100, 50); + ctx.drawImage(red, Infinity, Infinity, Infinity, 50); + ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(red, Infinity, Infinity, 100, Infinity); + ctx.drawImage(red, Infinity, 0, Infinity, 50); + ctx.drawImage(red, Infinity, 0, Infinity, Infinity); + ctx.drawImage(red, Infinity, 0, 100, Infinity); + ctx.drawImage(red, 0, Infinity, Infinity, 50); + ctx.drawImage(red, 0, Infinity, Infinity, Infinity); + ctx.drawImage(red, 0, Infinity, 100, Infinity); + ctx.drawImage(red, 0, 0, Infinity, Infinity); + ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(red, -Infinity, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(red, NaN, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, 100, 50); + ctx.drawImage(red, 0, -Infinity, 100, 50, 0, 0, 100, 50); + ctx.drawImage(red, 0, NaN, 100, 50, 0, 0, 100, 50); + ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(red, 0, 0, -Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(red, 0, 0, NaN, 50, 0, 0, 100, 50); + ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, 100, 50); + ctx.drawImage(red, 0, 0, 100, -Infinity, 0, 0, 100, 50); + ctx.drawImage(red, 0, 0, 100, NaN, 0, 0, 100, 50); + ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, 100, 50); + ctx.drawImage(red, 0, 0, 100, 50, -Infinity, 0, 100, 50); + ctx.drawImage(red, 0, 0, 100, 50, NaN, 0, 100, 50); + ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, 100, 50); + ctx.drawImage(red, 0, 0, 100, 50, 0, -Infinity, 100, 50); + ctx.drawImage(red, 0, 0, 100, 50, 0, NaN, 100, 50); + ctx.drawImage(red, 0, 0, 100, 50, 0, 0, Infinity, 50); + ctx.drawImage(red, 0, 0, 100, 50, 0, 0, -Infinity, 50); + ctx.drawImage(red, 0, 0, 100, 50, 0, 0, NaN, 50); + ctx.drawImage(red, 0, 0, 100, 50, 0, 0, 100, Infinity); + ctx.drawImage(red, 0, 0, 100, 50, 0, 0, 100, -Infinity); + ctx.drawImage(red, 0, 0, 100, 50, 0, 0, 100, NaN); + ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, 100, 50); + ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, 50); + ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, 50); + ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, 50); + ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, 50); + ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, 100, Infinity); + ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, 100, 50); + ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, 100, 50); + ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, 100, 50); + ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, Infinity, 50); + ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, 100, Infinity); + ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, 100, 50); + ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, 100, 50); + ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, 100, 50); + ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, Infinity, 50); + ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, 100, Infinity); + ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, 100, 50); + ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, 100, 50); + ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, 100, 50); + ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, Infinity, 50); + ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, 100, Infinity); + ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, 100, 50); + ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, 100, 50); + ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, 100, 50); + ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, Infinity, 50); + ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, 100, Infinity); + ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, 100, 50); + ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, 100, 50); + ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, 100, 50); + ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, Infinity, 50); + ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, 100, Infinity); + ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, 100, 50); + ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, 100, 50); + ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, 100, 50); + ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, Infinity, 50); + ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, 100, Infinity); + ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(red, 0, 0, 100, 50, 0, 0, Infinity, Infinity); + verify(Helper.comparePixel(ctx, 50,25, 0,255,0,255)); + + } + + function test_negative() { + var ctx = canvas.getContext('2d'); + ctx.reset(); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.drawImage('ggrr-256x256.png', 100, 78, 50, 50, 0, 50, 50, -50); + ctx.drawImage('ggrr-256x256.png', 100, 128, 50, -50, 100, 50, -50, -50); +// verify(Helper.comparePixel(ctx, 1,1, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 1,48, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 98,1, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 98,48, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 48,1, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 48,48, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 51,1, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 51,48, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 25,25, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 75,25, 0,255,0,255,2)); + + ctx.reset(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.drawImage('ggrr-256x256.png', 0, 178, 50, -100, 0, 0, 50, 100); + ctx.drawImage('ggrr-256x256.png', 0, 78, 50, 100, 50, 100, 50, -100); +// verify(Helper.comparePixel(ctx, 1,1, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 1,48, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 98,1, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 98,48, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 48,1, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 48,48, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 51,1, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 51,48, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 25,25, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 75,25, 0,255,0,255,2)); + + ctx.reset(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.drawImage('ggrr-256x256.png', 100, 78, -100, 50, 0, 0, 50, 50); + ctx.drawImage('ggrr-256x256.png', 100, 128, -100, -50, 50, 0, 50, 50); +// verify(Helper.comparePixel(ctx, 1,1, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 1,48, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 98,1, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 98,48, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 48,1, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 48,48, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 51,1, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 51,48, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 25,25, 0,255,0,255,2)); +// verify(Helper.comparePixel(ctx, 75,25, 0,255,0,255,2)); + + } + + function test_canvas() { + var ctx = canvas.getContext('2d'); + ctx.reset(); + var canvas2 = Qt.createQmlObject("import QtQuick 2.0; Canvas{renderTarget:Canvas.Image}", canvas); + canvas2.width = 100; + canvas2.height = 50; + var ctx2 = canvas2.getContext('2d'); + ctx2.fillStyle = '#0f0'; + ctx2.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#f00'; + ctx.drawImage(canvas2, 0, 0); + + //verify(Helper.comparePixel(ctx, 0,0, 0,255,0,255,2)); + //verify(Helper.comparePixel(ctx, 99,0, 0,255,0,255,2)); + //verify(Helper.comparePixel(ctx, 0,49, 0,255,0,255,2)); + //verify(Helper.comparePixel(ctx, 99,49, 0,255,0,255,2)); + + } + + function test_broken() { + var ctx = canvas.getContext('2d'); + ctx.reset(); + var img = 'broken.png'; + verify(!img.complete); + ctx.drawImage(img, 0, 0); + } + + function test_alpha() { + var ctx=canvas.getContext('2d'); + ctx.reset(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalAlpha = 0; + ctx.drawImage('red.png', 0, 0); + verify(Helper.comparePixel(ctx, 50,25, 0,255,0,255, 2)); + + } } } diff --git a/tests/auto/declarative/qsgcanvasitem/data/yellow.png b/tests/auto/declarative/qsgcanvasitem/data/yellow.png new file mode 100644 index 0000000000000000000000000000000000000000..51e8aaf38c1b3a105fc6038c93b5648a4bf9efd4 GIT binary patch literal 95 zcmeAS@N?(olHy`uVBq!ia0vp^DL`z*$P6SW{C@KnNHGWagt-3y&(L-3iz|>T?&;zf qQW5v|03$Du=V0(R_;h0NA~Qy&Jq(P_g*_*Mf()LnelF{r5}E*PXBuY! literal 0 HcmV?d00001 diff --git a/tests/auto/declarative/qsgcanvasitem/data/yellow75.png b/tests/auto/declarative/qsgcanvasitem/data/yellow75.png new file mode 100644 index 0000000000000000000000000000000000000000..2bb82c9834790bfeb1a65cf2ef202dc63d2ebac4 GIT binary patch literal 150 zcmeAS@N?(olHy`uVBq!ia0vp^DL`z*!3HE(nbz$CQn8*cjv*CsZ!a1$GB9v3E4-CI zm9e>LIeW;0$+N1Oi#eQH6j&6U1eBlzhhUR{B7|`45NP3m5Fk}9Py(*hN#GC@Lu;q( TYk|aYphXOxu6{1-oD!M<5gsEm literal 0 HcmV?d00001 -- 1.7.2.5