[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/libs/flake
From: Jan Hambrecht <jaham () gmx ! net>
Date: 2009-06-08 21:27:24
Message-ID: 1244496444.105916.8381.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 979085 by jaham:
when opening subpath, the StopPath property has to be set not unset on the last point of the subpath
changed unittests to test for that
M +5 -2 KoPathShape.cpp
M +8 -0 tests/TestPathShape.cpp
--- trunk/koffice/libs/flake/KoPathShape.cpp #979084:979085
@@ -735,7 +735,10 @@
if (subpath == 0)
return false;
- return subpath->last()->properties() & KoPathPoint::CloseSubpath;
+ const bool firstClosed = subpath->first()->properties() & KoPathPoint::CloseSubpath;
+ const bool lastClosed = subpath->last()->properties() & KoPathPoint::CloseSubpath;
+
+ return firstClosed && lastClosed;
}
bool KoPathShape::insertPoint(KoPathPoint* point, const KoPathPointIndex &pointIndex)
@@ -897,7 +900,7 @@
// make the first point a start node
subpath->first()->setProperty(KoPathPoint::StartSubpath);
// make the last point an end node
- subpath->last()->unsetProperty(KoPathPoint::StopSubpath);
+ subpath->last()->setProperty(KoPathPoint::StopSubpath);
return pathPointIndex(oldStartPoint);
}
--- trunk/koffice/libs/flake/tests/TestPathShape.cpp #979084:979085
@@ -469,14 +469,22 @@
// open at middle point in subpath
QVERIFY(path.openSubpath(path.pathPointIndex(point1)) == KoPathPointIndex(0, 2));
+ QVERIFY(path.pointByIndex(KoPathPointIndex(0,0))->properties() & KoPathPoint::StartSubpath);
+ QVERIFY(path.pointByIndex(KoPathPointIndex(0,2))->properties() & KoPathPoint::StopSubpath);
// open at first point in subpath
QVERIFY(path.openSubpath(path.pathPointIndex(point2)) == KoPathPointIndex(1, 0));
+ QVERIFY(path.pointByIndex(KoPathPointIndex(1,0))->properties() & KoPathPoint::StartSubpath);
+ QVERIFY(path.pointByIndex(KoPathPointIndex(1,3))->properties() & KoPathPoint::StopSubpath);
// open at last point in subpath
QVERIFY(path.openSubpath(path.pathPointIndex(point3)) == KoPathPointIndex(2, 1));
+ QVERIFY(path.pointByIndex(KoPathPointIndex(2,0))->properties() & KoPathPoint::StartSubpath);
+ QVERIFY(path.pointByIndex(KoPathPointIndex(2,3))->properties() & KoPathPoint::StopSubpath);
// try to open open subpath
QVERIFY(path.openSubpath(path.pathPointIndex(point3)) == KoPathPointIndex(-1, -1));
// open if the first path is a curve
QVERIFY(path.openSubpath(path.pathPointIndex(point5)) == KoPathPointIndex(3, 1));
+ QVERIFY(path.pointByIndex(KoPathPointIndex(3,0))->properties() & KoPathPoint::StartSubpath);
+ QVERIFY(path.pointByIndex(KoPathPointIndex(3,2))->properties() & KoPathPoint::StopSubpath);
// try to open none existing subpath
QVERIFY(path.openSubpath(KoPathPointIndex(4, 1)) == KoPathPointIndex(-1, -1));
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic