15
15
* limitations under the License.
18
/* $Id: DSCCommentBoundingBoxTestCase.java 750418 2009-03-05 11:03:54Z vhennebert $ */
18
/* $Id: DSCCommentBoundingBoxTestCase.java 1365650 2012-07-25 15:59:30Z mehdi $ */
20
20
package org.apache.xmlgraphics.ps.dsc.events;
22
22
import java.awt.Rectangle;
23
23
import java.awt.geom.Rectangle2D;
25
import junit.framework.TestCase;
25
import org.junit.Test;
27
import static org.junit.Assert.assertEquals;
27
29
import org.apache.xmlgraphics.ps.dsc.DSCCommentFactory;
29
public class DSCCommentBoundingBoxTestCase extends TestCase {
31
public class DSCCommentBoundingBoxTestCase {
31
34
public void testBoundingBox() throws Exception {
32
35
DSCComment comment = DSCCommentFactory.createDSCCommentFor("BoundingBox");
33
DSCCommentBoundingBox bbox = (DSCCommentBoundingBox)comment;
36
DSCCommentBoundingBox bbox = (DSCCommentBoundingBox) comment;
34
37
bbox.parseValue("289 412 306 429");
35
38
Rectangle refRect = new Rectangle(289, 412, 306 - 289, 429 - 412);
36
39
assertEquals(refRect, bbox.getBoundingBox());
38
41
comment = DSCCommentFactory.createDSCCommentFor("BoundingBox");
39
bbox = (DSCCommentBoundingBox)comment;
42
bbox = (DSCCommentBoundingBox) comment;
40
43
bbox.parseValue("289.12 412.2 306.777 429.11");
41
44
Rectangle2D refRect2D = new Rectangle2D.Double(
42
45
289.12, 412.2, 306.777 - 289.12, 429.11 - 412.2);
43
46
assertEquals(refRect2D, bbox.getBoundingBox());
45
48
comment = DSCCommentFactory.createDSCCommentFor("HiResBoundingBox");
46
bbox = (DSCCommentHiResBoundingBox)comment;
49
bbox = (DSCCommentHiResBoundingBox) comment;
47
50
bbox.parseValue("289.12 412.2 306.777 429.11");
48
51
refRect2D = new Rectangle2D.Double(
49
52
289.12, 412.2, 306.777 - 289.12, 429.11 - 412.2);