#550 Adobe path points now constrained to a more robust [-16...16] range

This commit is contained in:
Harald Kuhr 2020-07-10 19:29:50 +02:00
parent 8f942922fd
commit 7e55d7765d
2 changed files with 30 additions and 10 deletions

View File

@ -107,8 +107,8 @@ final class AdobePathSegment {
case OPEN_SUBPATH_BEZIER_LINKED: case OPEN_SUBPATH_BEZIER_LINKED:
case OPEN_SUBPATH_BEZIER_UNLINKED: case OPEN_SUBPATH_BEZIER_UNLINKED:
isTrue( isTrue(
cppx >= 0 && cppx <= 1 && cppy >= 0 && cppy <= 1, cppx >= -16 && cppx <= 16 && cppy >= -16 && cppy <= 16,
String.format("Expected point in range [0...1]: (%f, %f)", cppx ,cppy) String.format("Expected point in range [-16...16]: (%f, %f)", cppx ,cppy)
); );
break; break;
case PATH_FILL_RULE_RECORD: case PATH_FILL_RULE_RECORD:

View File

@ -113,8 +113,13 @@ public class AdobePathSegmentTest {
} }
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void testCreateOpenLinkedRecordNegative() { public void testCreateOpenLinkedRecordOutOfRangeNegative() {
new AdobePathSegment(AdobePathSegment.OPEN_SUBPATH_BEZIER_LINKED, -.5, -.5, 0, 0, 1, 1); new AdobePathSegment(AdobePathSegment.OPEN_SUBPATH_BEZIER_LINKED, -16.1, -16.1, 0, 0, 1, 1);
}
@Test(expected = IllegalArgumentException.class)
public void testCreateOpenLinkedRecordOutOfRangePositive() {
new AdobePathSegment(AdobePathSegment.OPEN_SUBPATH_BEZIER_LINKED, 16.1, 16.1, 0, 0, 1, 1);
} }
@Test @Test
@ -138,8 +143,13 @@ public class AdobePathSegmentTest {
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void testCreateOpenUnlinkedRecordNegative() { public void testCreateOpenUnlinkedRecordOutOfRangeNegative() {
new AdobePathSegment(AdobePathSegment.OPEN_SUBPATH_BEZIER_UNLINKED, -.5, -.5, 0, 0, 1, 1); new AdobePathSegment(AdobePathSegment.OPEN_SUBPATH_BEZIER_UNLINKED, -16.5, 0, 0, 0, 1, 1);
}
@Test(expected = IllegalArgumentException.class)
public void testCreateOpenUnlinkedRecorOutOfRangePositive() {
new AdobePathSegment(AdobePathSegment.OPEN_SUBPATH_BEZIER_UNLINKED, 0, -17, 0, 0, 16.5, 1);
} }
/// Closed subpath /// Closed subpath
@ -164,8 +174,13 @@ public class AdobePathSegmentTest {
} }
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void testCreateClosedLinkedRecordNegative() { public void testCreateClosedLinkedRecordOutOfRangeNegative() {
new AdobePathSegment(AdobePathSegment.CLOSED_SUBPATH_BEZIER_LINKED, -.5, -.5, 0, 0, 1, 1); new AdobePathSegment(AdobePathSegment.CLOSED_SUBPATH_BEZIER_LINKED, -16.5, -.5, 0, 0, 1, 1);
}
@Test(expected = IllegalArgumentException.class)
public void testCreateClosedLinkedRecordOutOfRangePositive() {
new AdobePathSegment(AdobePathSegment.CLOSED_SUBPATH_BEZIER_LINKED, .5, 16.5, 0, 0, 1, 1);
} }
@Test @Test
@ -189,8 +204,13 @@ public class AdobePathSegmentTest {
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void testCreateClosedUnlinkedRecordNegative() { public void testCreateClosedUnlinkedRecordOutOfRangeNegative() {
new AdobePathSegment(AdobePathSegment.CLOSED_SUBPATH_BEZIER_UNLINKED, -.5, -.5, 0, 0, 1, 1); new AdobePathSegment(AdobePathSegment.CLOSED_SUBPATH_BEZIER_UNLINKED, -.5, -16.5, 0, 0, 1, 1);
}
@Test(expected = IllegalArgumentException.class)
public void testCreateClosedUnlinkedRecordOutOfRangePositive() {
new AdobePathSegment(AdobePathSegment.CLOSED_SUBPATH_BEZIER_UNLINKED, 16.5, .5, 0, 0, 1, 1);
} }
@Test @Test