Branch: krita-colorchannels-silvioheinrich

Silvio Heinrich plassy at web.de
Wed Apr 13 16:26:16 CEST 2011


On 04/13/2011 11:20 AM, Cyrille Berger Skott wrote:
> Looks like it is breaking two unit tests:
> http://my.cdash.org/viewTest.php?onlydelta&buildid=177252
Phew.... this unit test stuff is starting to get really annoying :P
Every time i make some changes a couple of tests are breaking :D.

Ok, to the first test "krita-plugin-format-xcf_test":
It compares an imported xcf file with a png file that contains the 
expected result.
Thats fine so far. I wanted to look what's going wrong, so i opened the 
xcf file in gimp and in krita...
but i couldn't see any difference. I looked again at the output of the 
unit test and there was written:
     DEBUG : KisXCFTest::testFiles() Comparison failures:  
("subtract-multiply-masks.xcf: Pixel (28,10) has different values")

So i looked what values the Pixel 28,10 has in gimp and what value it 
has in Krita:
Krita  -> RGB(216,214,214)
Gimp -> RGB(216,213,214)

Seems like the two pictures are compared to exact.
I would say it is completely acceptable if the result differs slightly 
to the expected result.
I think a tolerance of 1-2 units is fine (there shouldn't be any visual 
difference noticeable).
Otherwise we would limit ourself to implement every blending mode 
absolutely exact (without any optimization)
or to do it exactly like gimp/photoshop or whatever...
So my point is that we should compare just the visual result and not the 
exact pixel values (what doesn't work with floating point color spaces 
anyway).
We should compare the images with a tolerance here.

The second test "krita-image-KisPainterTest":
I actually can't remember messing around with the selection...
But maybe i don't understand the test right

the code:
/*
Note: the bltSelection tests assume the following geometry:

0,0               0,30
   +---------+------+
   |  10,10  |      |
   |    +----+      |
   |    |####|      |
   |    |####|      |
   +----+----+      |
   |       20,20    |
   |                |
   |                |
   +----------------+
                   30,30
  */
void KisPainterTest::testPaintDeviceBltSelection(const KoColorSpace * cs)
{

     KisPaintDeviceSP dst = new KisPaintDevice(cs);

     KisPaintDeviceSP src = new KisPaintDevice(cs);
     KoColor c(Qt::red, cs);
     c.setOpacity(quint8(128));
     src->fill(0, 0, 20, 20, c.data());

     QCOMPARE(src->exactBounds(), QRect(0, 0, 20, 20));

     KisSelectionSP selection = new KisSelection();
     selection->getOrCreatePixelSelection()->select(QRect(10, 10, 20, 20));
     selection->updateProjection();
     QCOMPARE(selection->selectedExactRect(), QRect(10, 10, 20, 20));

     KisPainter painter(dst);
     painter.setSelection(selection);

     painter.bitBlt(0, 0, src, 0, 0, 30, 30);
     painter.end();

     QImage image = dst->convertToQImage(0);
     image.save("blt_Selection_" + cs->name() + ".png");

     QCOMPARE(dst->exactBounds(), QRect(10, 10, 10, 10));

     const KoCompositeOp* op = cs->compositeOp(COMPOSITE_SUBTRACT);
     if (op->id() == COMPOSITE_SUBTRACT) {

         KisPaintDeviceSP dst2 = new KisPaintDevice(cs);
         KisPainter painter2(dst2);
         painter2.setSelection(selection);
         painter2.setCompositeOp(op);
         painter2.bitBlt(0, 0, src, 0, 0, 30, 30);
         painter2.end();

         QCOMPARE(dst2->exactBounds(), QRect(0, 0, 64, 64));
     }
}

it fails here -> QCOMPARE(dst2->exactBounds(), QRect(0, 0, 64, 64)); 
with the line:

FAIL!  : KisPainterTest::testPaintDeviceBltSelection() Compared values 
are not the same
    Actual (dst2->exactBounds()): QRect(10,10 10x10) (bottomright 19,19)
    Expected (QRect(0, 0, 64, 64)): QRect(0,0 64x64) (bottomright 63,63)
    Loc: 
[/home/silvio/kde4/src/calligra/krita/image/tests/kis_painter_test.cpp(160)]

For me it seems that the second test creates a paint device (dst2) and 
sets a selection XYWH(10,10,20,20) then
it blits the source device (src) which is XYWH(0,0,20,20) to dst2 with 
the statement "painter2.bitBlt(0, 0, src, 0, 0, 30, 30);".
but src is WH(20,20) not WH(30,30) ??
And then at the end the bounds of dst2 are expected to be XYWH(0,0,64,64) ??
Why should dst2 extend to WH(64,64) here?

I actually don't know what i broke here...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kimageshop/attachments/20110413/9752ba1c/attachment.htm 


More information about the kimageshop mailing list