pike.git / src / modules / Image / testsuite.in

version» Context lines:

pike.git/src/modules/Image/testsuite.in:49:   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" ); + if (!catch { Image.image(x,2); }) return ( x+"x2 permitted" ); + if (!catch { Image.image(x/32768,65537); }) return ( (x/32768)+"x65537 permitted" ); + if (!catch { Image.image(x/(32768*3),65537); }) return ( (x/(32768*3))+"x65537 permitted" );   return "ok";      ]], "ok")   test_any([[# 1 "-"       - #48 "testsuite.in.in" + #49 "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" + #60 "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" + #71 "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" + #80 "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" + #87 "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" + #97 "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" + #104 "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)" );
pike.git/src/modules/Image/testsuite.in:155:   ->setpixel(4,4,3,2,1)   ->max()))   return ( "erranous (4)" );   return "ok";         ]], "ok")   test_any([[# 1 "-"       - #126 "testsuite.in.in" + #127 "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" + #134 "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" + #140 "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" + #154 "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")