Transform { public static AffineTransform getAffineTransform(Transform t, float width, float height) { List<SingleTransform> multipleTransform = t.getMultipleTransform(); AffineTransform affineTransform = new AffineTransform(); for (int k = multipleTransform.size() - 1; k >= 0; k--) { SingleTransform transform = multipleTransform.get(k); float[] floats = new float[6]; for (int i = 0; i < 4; i++) floats[i] = transform.getFloats()[i]; for (int i = 4; i < 6; i++) floats[i] = transform.getUnitValues()[i - 4].getUnitType() == UnitValue.POINT ? transform.getUnitValues()[i - 4].getValue() : transform.getUnitValues()[i - 4].getValue() / 100 * (i == 4 ? width : height); affineTransform.preConcatenate(new AffineTransform(floats)); } return affineTransform; } Transform(int length); void addSingleTransform(SingleTransform singleTransform); static AffineTransform getAffineTransform(Transform t, float width, float height);  }
@Test public void getAffineTransformPercentPointUnitValuesTest() { Assert.assertEquals(new AffineTransform(new float[] {-2f, 3f, -4f, -5f, 12f, 30f, type}), getAffineTransform(UnitValue.PERCENT, UnitValue.POINT)); }
@Test public void getAffineTransformPointPercentUnitValuesTest() { Assert.assertEquals(new AffineTransform(new float[] {-2f, 3f, -4f, -5f, 20f, 24f, type}), getAffineTransform(UnitValue.POINT, UnitValue.PERCENT)); }
@Test public void getAffineTransformPercentPercentUnitValuesTest() { Assert.assertEquals(new AffineTransform(new float[] {-2f, 3f, -4f, -5f, 12f, 24f, type}), getAffineTransform(UnitValue.PERCENT, UnitValue.PERCENT)); }
@Test public void getAffineTransformPointPointUnitValuesTest() { Assert.assertEquals(new AffineTransform(new float[] {-2f, 3f, -4f, -5f, 20f, 30f, type}), getAffineTransform(UnitValue.POINT, UnitValue.POINT)); }