~hjd/ubuntu/wily/xmlgraphics-commons/debian-merged

« back to all changes in this revision

Viewing changes to test/java/org/apache/xmlgraphics/ps/dsc/events/DSCCommentBoundingBoxTestCase.java

  • Committer: Hans Joachim Desserud
  • Date: 2015-11-11 18:22:53 UTC
  • mfrom: (9.1.5 sid)
  • Revision ID: hans_joachim_desserud-20151111182253-zwi0frfm97j0wddn
  * Merge from Debian unstable.  Remaining changes:
    - d/control: Drop dependencies required for unit testing as they
      include libmockito-java which would pull maven into main, disable unit
      test execution.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 * limitations under the License.
16
16
 */
17
17
 
18
 
/* $Id: DSCCommentBoundingBoxTestCase.java 750418 2009-03-05 11:03:54Z vhennebert $ */
 
18
/* $Id: DSCCommentBoundingBoxTestCase.java 1365650 2012-07-25 15:59:30Z mehdi $ */
19
19
 
20
20
package org.apache.xmlgraphics.ps.dsc.events;
21
21
 
22
22
import java.awt.Rectangle;
23
23
import java.awt.geom.Rectangle2D;
24
24
 
25
 
import junit.framework.TestCase;
 
25
import org.junit.Test;
 
26
 
 
27
import static org.junit.Assert.assertEquals;
26
28
 
27
29
import org.apache.xmlgraphics.ps.dsc.DSCCommentFactory;
28
30
 
29
 
public class DSCCommentBoundingBoxTestCase extends TestCase {
 
31
public class DSCCommentBoundingBoxTestCase {
30
32
 
 
33
    @Test
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());
37
40
 
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());
44
47
 
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);