Commit 32dca1f8 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fix KisProcessingsTest

After the change in KisLayer::changeRect() when the COMPOSITE_COPY
layers became "changeRect-cropping", clone layers in the processings
tests became containing garbage outside the main area. This is ok,
because the blur layer above will never let these pixels being painted.
And when the blur layer goes away, these areas will be regenerated back.
parent 7c436e50
......@@ -54,12 +54,23 @@ public:
applicator.end();
image->waitForDone();
/**
* NOTE: after a change in KisLayer::changeRect(), which now
* crops change rect for layers with COMPOSITE_COPY
* composition, the clone layer will have some ghost pixels
* outside main projection rect. That is ok, because these
* pixels will never be painted due to a Filter Layer above,
* which crops the change rect.
*/
QVERIFY(checkLayers(image, testname));
undoStore->undo();
image->waitForDone();
QVERIFY(checkLayersInitial(image));
if (!checkLayersInitial(image)) {
qWarning() << "NOTE: undo is not completely identical to the original image. Falling back to projection comparison";
QVERIFY(checkLayersInitialRootOnly(image));
}
}
};
......
......@@ -160,15 +160,21 @@ protected:
return checkLayers(image, prefix + prefix2, baseFuzzyness);
}
bool checkLayersInitialRootOnly(KisImageWSP image, int baseFuzzyness = 0) {
QString prefix = "initial_with_selection";
QString prefix2 = findNode(image->root(), "shape") ? "_with_shape" : "";
return checkLayers(image, prefix + prefix2, baseFuzzyness, false);
}
/**
* Checks the content of image's layers against the set of
* QImages stored in @p prefix subfolder
*/
bool checkLayers(KisImageWSP image, const QString &prefix, int baseFuzzyness = 0) {
bool checkLayers(KisImageWSP image, const QString &prefix, int baseFuzzyness = 0, bool recursive = true) {
QVector<QImage> images;
QVector<QString> names;
fillNamesImages(image->root(), image->bounds(), images, names);
fillNamesImages(image->root(), image->bounds(), images, names, recursive);
bool valid = true;
......@@ -266,7 +272,8 @@ private:
void fillNamesImages(KisNodeSP node, const QRect &rc,
QVector<QImage> &images,
QVector<QString> &names) {
QVector<QString> &names,
bool recursive = true) {
while (node) {
if(node->paintDevice()) {
......@@ -290,7 +297,9 @@ private:
rc.width(), rc.height()));
}
fillNamesImages(node->firstChild(), rc, images, names);
if (recursive) {
fillNamesImages(node->firstChild(), rc, images, names);
}
node = node->nextSibling();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment