4b19c11998-04-16Mirar (Pontus Hagland) test_any([[# 1 "-"
ab6aec1997-02-11Fredrik Hübinette (Hubbe) 
4b19c11998-04-16Mirar (Pontus Hagland)  #7 "testsuite.in.in" object img1=Image.PNM.decode("P1\n5 5\n0 1 1 1 1\n1 0 1 1 1\n1 1 0 1 1\n1 1 1 0 1\n1 1 1 1 0"); object img2=Image.PNM.decode("P4\n5 5\nx¸Øèð"); if (img1!=img2) return ( "differ\n" ); return "ok"; ]], "ok") test_any([[# 1 "-" #13 "testsuite.in.in" if ("hejsan, hoppsan" != MIME.decode_base64("aGVqc2FuLCBob3Bwc2Fu\n")) return ( "differ" ); return "ok"; ]], "ok") test_any([[# 1 "-" #18 "testsuite.in.in" object img1=Image.GIF.decode(MIME.decode_base64("R0lGODlhBQAFAIAAAAAAAP///ywAAAAABQAFAAACCAxwEWrY8BwoADs=")); object img2=Image.PNM.decode("P4\n5 5\nx\00èØèð"); if (img1!=img2) return ( "differ\n" ); return "ok"; ]], "ok") test_any([[# 1 "-" #27 "testsuite.in.in" object img=Image.image(); if (!img || img->xsize() || img->ysize()) return ( "have size" ); return "ok"; ]], "ok") test_any([[# 1 "-" #34 "testsuite.in.in" object img=Image.image(100,100); if (!img || img->xsize()!=100 || img->ysize()!=100) return ( "wrong size" ); if (img!=0) return ( "wrong color" ); return "ok"; ]], "ok") test_any([[# 1 "-" #42 "testsuite.in.in" int x=1; while ((x<<1)>0) x=(x<<1)+1; if (!catch { Image.image(x,2); } || !catch { Image.image(x/32768,32769); }) return ( "permitted" ); return "ok"; ]], "ok") test_any([[# 1 "-" #48 "testsuite.in.in" object img=Image.image(1000,1000,17,42,96); if (!img || img->xsize()!=1000 || img->ysize()!=1000) return ( "wrong size" ); if (img!=({17,42,96})) return ( "wrong color" ); return "ok"; ]], "ok") test_any([[# 1 "-" #59 "testsuite.in.in" object img=Image.image(10,10); img=img->test(); if (equal(img->max(),({0,0,0}))) return ( "failed" ); img->setpixel(2,2,0,255,0); if (img==img->invert()) return ( "failed" ); return "ok"; ]], "ok") test_any([[# 1 "-" #70 "testsuite.in.in" object img=Image.image(100,100)->test(); if (img!=img->copy()) return ( "differ" ); if (img->copy(25,25,75,75)!=img->copy(25,25,75,75)) return ( "subregion differ" ); if (img->copy(25,25,75,75)==img) return ( "subregion doesn't differ" ); img->setpixel(2,2,0,255,0); if (img->copy()==img->invert()->copy()) return ( "copy of other doesn't differ" ); return "ok"; ]], "ok") test_any([[# 1 "-" #79 "testsuite.in.in" object img=Image.image(100,100)->test(); if (img->clear()==img) return ( "doesn't differ" ); if (img->clear(0,0,0)!=0) return ( "wrong color (black)" ); if (img->clear(1,255,0)!=({1,255,0})) return ( "wrong color (color)" ); return "ok"; ]], "ok") test_any([[# 1 "-" #86 "testsuite.in.in" object img=Image.image(100,100)->test(); if (img!=img->clone()) return ( "differ" ); img->setpixel(2,2,0,255,0); if (img->clone()==img->invert()->clone()) return ( "clone of other doesn't differ" ); return "ok"; ]], "ok") test_any([[# 1 "-" #96 "testsuite.in.in" array a=({0,0,0}); array b=copy_value(a); b[0]=17; b[1]=42; b[2]=128; if (!equal( ({0,0,0}), a)) return ( "differ (1)" ); if (!equal( ({17,42,128}), b)) return ( "differ (2)" ); return "ok"; ]], "ok") test_any([[# 1 "-" #103 "testsuite.in.in" if (!equal( ({0,0,0}), Image.image(10,10,0,0,0)->max() )) return ( "erranous (1)" ); if (!equal( ({17,42,36}), Image.image(10,10,17,42,36)->max() )) return ( "erranous (2)" ); if (!equal( ({17,42,36}), Image.image(10,10,0,0,0) ->setpixel(5,5,17,42,36)->max() )) return ( "erranous (3)" ); if (!equal( ({17,42,36}), Image.image(10,10,0,0,0) ->setpixel(2,2,1,2,3) ->setpixel(3,3,17,42,36) ->setpixel(4,4,3,2,1) ->max())) return ( "erranous (4)" ); return "ok"; ]], "ok") test_any([[# 1 "-" #126 "testsuite.in.in" object img=Image.image(10,10,255,0,0); if (!equal(img->getpixel(5,5),({255,0,0}))) return ( "getpixel erranous" ); img->setpixel(5,5,1,2,3); if (!equal(img->getpixel(5,5),({1,2,3}))) return ( "failed" ); return "ok"; ]], "ok") test_any([[# 1 "-" #133 "testsuite.in.in" object img=Image.image(10,10,255,0,0); img->setpixel(5,5,0,255,0,127); if (!equal(img->getpixel(5,5),({127,128,0}))) return ( "failed" ); return "ok"; ]], "ok") test_any([[# 1 "-" #139 "testsuite.in.in" object img=Image.image(100,100,0,0,0); foreach (({40,50,60}),int z) { img->line(50-z,0,50,50,255,255,255); img->line(50-z,100,50,50,255,255,255); img->line(0,50-z,50,50,255,255,255); img->line(100,50-z,50,50,255,255,255); } object img1=Image.GIF.decode(MIME.decode_base64( "R0lGODlhZABkAIAAAAAAAP///ywAAAAAZABkAAAC/wxwCGaq/l6UktZ6Mdat9sdsmziOpWl6WPMp\r\nYZrCcTxLLfLdi07Tve9brFQeXjB4RIKGQ5tQqYRGccTN7TWdZlPXWNeo1Wq7zqoLLBYjyWZXUa1W\r\ns526Kzoeby5H2L37npfn5kcUEGDY1icoqEe10qL4dMbIaFXW9pcIWBkFacknOTjJWenZaHWoSSpo\r\narO50yr0uvrpeBmkmDNLe1s3FhqayquUc0osLLozjEuIs4va+8xZfJt3SO28bIKdzNjXgaxdNTcd\r\nDi4dB+6qbT4qbhu73J79rt7Mjnwubt9dn99Pip+yd48GhVvF4h5BEPYOlrIFbOEbRw6tQUTH6xpF\r\njP9N9En0ISyhN3gfj1FkRbKkSVkcqQhUiSthRWYsWpZMxQDdC5swcUaksROmtxC7ggodKovmwKMP\r\nNQKNxJTVtTs+o9KaygWq1aEzYfHcuq2iU7D4IHUlG9DcV7RP3bElqPUtO7k36X5ca9fL2byl9vKV\r\nivfvo8CCXREu7CwuYjFEFwdM6rjpz8i/FFOO+eTwX5Ga+XK+nO4kaMaiR3cSOdn0NlGd6fJrLfe1\r\namKsZ2O+aBsoIdhoufEm6zu3l93Cwzb7bTUe8qjKi9eCmFp4c+fr7i0XSi767OzXe2LqrpI7dbfQ\r\noUs3pn20L0y511c7zx488+fjFaaHz74+D/lH99cJR2+efqD890ABADs=")); if (img!=img1) return ( "differ" ); return "ok"; ]], "ok") test_any([[# 1 "-" #153 "testsuite.in.in" object img=Image.image(100,100,0,0,0); img->line(40,0,0,40); if (!equal( ({0,0,0}), img->max() )) return ( "differ (reset)" ); img->line(10,10,20,20,128,13,42); if (!equal( ({128,13,42}), img->max() )) return ( "differ (direct)" ); img->setcolor(200,19,99); img->line(30,20,20,30); if (!equal( ({200,19,99}), img->max() )) return ( "differ (setcolor)" ); return "ok"; ]], "ok")