You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AFPObjectAreaInfoTestCase.java 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id$ */
  18. package org.apache.fop.afp;
  19. import org.junit.Before;
  20. import org.junit.Test;
  21. import static org.junit.Assert.assertEquals;
  22. /**
  23. * Test case for {@link AFPObjectAreaInfo}.
  24. */
  25. public class AFPObjectAreaInfoTestCase {
  26. private AFPObjectAreaInfo sut;
  27. /**
  28. * Instantiate the system under test
  29. */
  30. @Before
  31. public void setUp() {
  32. sut = new AFPObjectAreaInfo(1, 2, 3, 4, 5, 6);
  33. }
  34. /**
  35. * Test the getter functions with arbitrary data.
  36. */
  37. @Test
  38. public void testGetters() {
  39. assertEquals(1, sut.getX());
  40. assertEquals(2, sut.getY());
  41. assertEquals(3, sut.getWidth());
  42. assertEquals(4, sut.getHeight());
  43. assertEquals(5, sut.getWidthRes());
  44. assertEquals(5, sut.getHeightRes());
  45. assertEquals(6, sut.getRotation());
  46. }
  47. /**
  48. * Test the resolution setters with arbitrary data.
  49. */
  50. @Test
  51. public void testSetters() {
  52. assertEquals(5, sut.getWidthRes());
  53. assertEquals(5, sut.getHeightRes());
  54. sut.setResolution(20);
  55. assertEquals(20, sut.getWidthRes());
  56. assertEquals(20, sut.getHeightRes());
  57. sut.setHeightRes(10);
  58. assertEquals(20, sut.getWidthRes());
  59. assertEquals(10, sut.getHeightRes());
  60. sut.setWidthRes(9);
  61. assertEquals(9, sut.getWidthRes());
  62. assertEquals(10, sut.getHeightRes());
  63. }
  64. }