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

version» Context lines:

pike.git/src/modules/Image/testsuite.in.in:1:   // -*- pike -*- - // $Id: testsuite.in.in,v 1.19 1999/06/19 19:05:45 mirar Exp $ + // $Id: testsuite.in.in,v 1.20 1999/06/19 19:26:02 mirar Exp $   #module Image.Image   {   //-----------------------------------------------------------------------   #chapter testsuite      #test Image.PNM.decode, ==    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) fail("differ\n");    ok();
pike.git/src/modules/Image/testsuite.in.in:190:    if (img->clear(1,255,0)!=({1,255,0})) fail("wrong color (color)");    ok();      #test Image.Image->clone    object img=Image.Image(100,100)->test(42);    if (img!=img->clone()) fail("differ");    img->setpixel(2,2,0,255,0);    if (img->clone()==img->invert()->clone()) fail("clone of other doesn't differ");    ok();    + #test Image.Image->find_autocrop +  object img=Image.Image(20,20); +  img->box(4,4,8,8,Image.Color.red); +  img->box(8,8,12,12,Image.Color.green); +  img->box(12,4,16,8,Image.Color.blue); +  +  array z; +  if (!equal(z=img->find_autocrop(),({ 4, 4, 16, 12 }))) +  fail(sprintf("find_autocrop() returned %O, not %O\n",z,({ 4, 4, 16, 12 }))); +  if (!equal(z=img->find_autocrop(5),({ -1, -1, 21, 17 }))) +  fail(sprintf("find_autocrop(5) returned %O, not %O\n",z,({ -1, -1, 21, 17 }))); +  if (!equal(z=img->find_autocrop(-2),({ 6, 6, 14, 10 }))) +  fail(sprintf("find_autocrop(-2) returned %O, not %O\n",z,({ 6, 6, 14, 10 }))); +  +  if (!equal(z=img->find_autocrop(0,1,0,0,0),({ 4, 0, 19, 19 }))) +  fail(sprintf("find_autocrop(0,1,0,0,0) returned %O, not %O\n",z,({ 4, 0, 19, 19 }))); +  if (!equal(z=img->find_autocrop(0,0,1,0,0),({ 0, 0, 16, 19 }))) +  fail(sprintf("find_autocrop(0,0,1,0,0) returned %O, not %O\n",z,({ 0, 0, 16, 19 }))); +  if (!equal(z=img->find_autocrop(0,0,0,1,0),({ 0, 4, 19, 19 }))) +  fail(sprintf("find_autocrop(0,0,0,1,0) returned %O, not %O\n",z,({ 0, 4, 19, 19 }))); +  if (!equal(z=img->find_autocrop(0,0,0,0,1),({ 0, 0, 19, 12 }))) +  fail(sprintf("find_autocrop(0,0,0,0,1) returned %O, not %O\n",z,({ 0, 0, 19, 12 }))); +  ok(); +  +    #test Image.Image->autocrop    object img=Image.Image(20,20);    img->box(4,4,8,8,Image.Color.red);    img->box(8,8,12,12,Image.Color.green);    img->box(12,4,16,8,Image.Color.blue);       if (img->autocrop()!=    Image.GIF.decode(MIME.decode_base64(    "R0lGODlhDQAJAJEAAAAAAP8AAAAA/wD/ACwAAAAADQAJAAECIkwcACDSck5azkE5mb1yaYsNg7gJ\r\nHjCOw3mqI+u5K4y6ZwEAOw==")))    fail("autocropped (all) image is not correct");