[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [calligra/krita_strokes_framework_kazakov] krita/image/tests: Added
From:       Dmitry Kazakov <dimula73 () gmail ! com>
Date:       2011-08-19 7:35:11
Message-ID: 20110819073511.81332A60A9 () git ! kde ! org
[Download RAW message or body]

Git commit 4fe71eb0c0cfeff79b77f4cbf645c24c18a2630a by Dmitry Kazakov.
Committed on 16/08/2011 at 10:26.
Pushed by dkazakov into branch 'krita_strokes_framework_kazakov'.

Added a unittest for a new KisFullRefreshWalker

M  +1    -0    krita/image/tests/kis_walkers_test.h
M  +58   -0    krita/image/tests/kis_walkers_test.cpp

http://commits.kde.org/calligra/4fe71eb0c0cfeff79b77f4cbf645c24c18a2630a

diff --git a/krita/image/tests/kis_walkers_test.cpp b/krita/image/tests/kis_walkers_test.cpp
index 2d55a7a..b1f1849 100644
--- a/krita/image/tests/kis_walkers_test.cpp
+++ b/krita/image/tests/kis_walkers_test.cpp
@@ -21,6 +21,7 @@
 #include "kis_base_rects_walker.h"
 #include "kis_merge_walker.h"
 #include "kis_refresh_subtree_walker.h"
+#include "kis_full_refresh_walker.h"
 
 #include <qtest_kde.h>
 #include <KoColorSpaceRegistry.h>
@@ -433,6 +434,63 @@ void KisWalkersTest::testRefreshSubtreeVisiting()
       +----------+
       |root      |
       | layer 5  |
+      | cplx  2  |
+      | group    |
+      |  paint 4 |
+      |  paint 3 |
+      |  cplx  1 |
+      |  paint 2 |
+      | paint 1  |
+      +----------+
+     */
+
+void KisWalkersTest::testFullRefreshVisiting()
+{
+    const KoColorSpace * colorSpace = KoColorSpaceRegistry::instance()->rgb8();
+    KisImageSP image = new KisImage(0, 512, 512, colorSpace, "walker test");
+
+    KisLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE_U8);
+    KisLayerSP paintLayer2 = new KisPaintLayer(image, "paint2", OPACITY_OPAQUE_U8);
+    KisLayerSP paintLayer3 = new KisPaintLayer(image, "paint3", OPACITY_OPAQUE_U8);
+    KisLayerSP paintLayer4 = new KisPaintLayer(image, "paint4", OPACITY_OPAQUE_U8);
+    KisLayerSP paintLayer5 = new KisPaintLayer(image, "paint5", OPACITY_OPAQUE_U8);
+
+    KisLayerSP groupLayer = new KisGroupLayer(image, "group", OPACITY_OPAQUE_U8);
+    KisLayerSP complexRectsLayer1 = new ComplexRectsLayer(image, "cplx1", OPACITY_OPAQUE_U8);
+    KisLayerSP complexRectsLayer2 = new ComplexRectsLayer(image, "cplx2", OPACITY_OPAQUE_U8);
+
+    image->addNode(paintLayer1, image->rootLayer());
+    image->addNode(groupLayer, image->rootLayer());
+    image->addNode(complexRectsLayer2, image->rootLayer());
+    image->addNode(paintLayer5, image->rootLayer());
+
+    image->addNode(paintLayer2, groupLayer);
+    image->addNode(complexRectsLayer1, groupLayer);
+    image->addNode(paintLayer3, groupLayer);
+    image->addNode(paintLayer4, groupLayer);
+
+    QRect testRect(10,10,10,10);
+    // Empty rect to show we don't need any cropping
+    QRect cropRect;
+
+    KisFullRefreshWalker walker(cropRect);
+
+    {
+        QString order("root,paint5,cplx2,group,paint1,"
+                      "group,paint4,paint3,cplx1,paint2");
+        QStringList orderList = order.split(",");
+        QRect accessRect(-7,-7,44,44);
+
+        reportStartWith("root");
+        walker.collectRects(groupLayer, testRect);
+        verifyResult(walker, orderList, accessRect, true, true);
+    }
+}
+
+    /*
+      +----------+
+      |root      |
+      | layer 5  |
       | cache1   |
       | group    |
       |  paint 4 |
diff --git a/krita/image/tests/kis_walkers_test.h b/krita/image/tests/kis_walkers_test.h
index b979843..e4ee00b 100644
--- a/krita/image/tests/kis_walkers_test.h
+++ b/krita/image/tests/kis_walkers_test.h
@@ -207,6 +207,7 @@ private slots:
     void testUsualVisiting();
     void testMergeVisiting();
     void testRefreshSubtreeVisiting();
+    void testFullRefreshVisiting();
     void testCachedVisiting();
     void testMasksVisiting();
     void testMasksOverlapping();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic