MCPcopy Create free account
hub / github.com/HumbleUI/Skija / execute

Method execute

tests/java/PathMeasureTest.java:13–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11
12public class PathMeasureTest implements Executable {
13 @Override
14 public void execute() throws Exception {
15 try (var path = new PathBuilder().moveTo(0, 0).lineTo(40, 0).moveTo(0, 40).lineTo(10, 50).build();
16 var measure = new PathMeasure(path, false);
17 var path2 = new PathBuilder().lineTo(10, 10).build();)
18 {
19 assertEquals(40f, measure.getLength());
20 assertClose(new Point(0, 0), measure.getPosition(0));
21 assertClose(new Point(1, 0), measure.getTangent(0));
22 assertClose(new Point(20, 0), measure.getPosition(20));
23 assertClose(new Point(1, 0), measure.getTangent(20));
24 assertEquals(false, measure.isClosed());
25
26 assertClose(Matrix33.makeTranslate(20, 0), measure.getMatrix(20, true, false));
27 assertClose(Matrix33.makeRotate(0), measure.getMatrix(20, false, true));
28 assertClose(Matrix33.makeTranslate(20, 0).makeConcat(Matrix33.makeRotate(0)), measure.getMatrix(20, true, true));
29
30 measure.nextContour();
31 assertClose(14.14213f, measure.getLength());
32 assertClose(new Point(0, 40), measure.getPosition(0));
33 assertClose(new Point(0.70710677f, 0.70710677f), measure.getTangent(0));
34 assertClose(new Point(4.949747f, 44.949745f), measure.getPosition(7));
35 assertClose(new Point(0.70710677f, 0.70710677f), measure.getTangent(7));
36
37 assertClose(Matrix33.makeTranslate(4.949747f, 44.949745f), measure.getMatrix(7, true, false));
38 assertClose(Matrix33.makeRotate(45), measure.getMatrix(7, false, true));
39 assertClose(Matrix33.makeTranslate(4.949747f, 44.949745f).makeConcat(Matrix33.makeRotate(45)), measure.getMatrix(7, true, true));
40
41 measure.setPath(path2, false);
42 assertClose(14.142136f, measure.getLength());
43 }
44 }
45}

Callers

nothing calls this directly

Calls 15

makeTranslateMethod · 0.95
makeRotateMethod · 0.95
lineToMethod · 0.80
moveToMethod · 0.80
assertEqualsMethod · 0.80
assertCloseMethod · 0.80
getTangentMethod · 0.80
getMatrixMethod · 0.80
makeConcatMethod · 0.80
nextContourMethod · 0.80
buildMethod · 0.45
getLengthMethod · 0.45

Tested by

no test coverage detected