Changeset 16978 in josm for trunk/test/unit/org
- Timestamp:
- 2020-08-30T09:46:47+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/tools/ImageResizeModeTest.java
r16946 r16978 14 14 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 15 15 16 /** 17 * Unit tests of {@link ImageResizeMode} class. 18 */ 16 19 public class ImageResizeModeTest { 17 20 … … 23 26 public JOSMTestRules test = new JOSMTestRules().preferences(); 24 27 28 final Dimension image = new Dimension(64, 48); 29 final Dimension smallImage = new Dimension(14, 10); 30 31 /** 32 * Test method for {@link ImageResizeMode#computeDimension} using {@link ImageResizeMode#AUTO} 33 */ 25 34 @Test 26 public void testComputeDimension() { 27 final Dimension image = new Dimension(64, 48); 35 public void testComputeDimensionAuto() { 28 36 assertThrows(IllegalArgumentException.class, () -> ImageResizeMode.AUTO.computeDimension(new Dimension(0, 0), image)); 29 37 assertEquals(new Dimension(64, 48), ImageResizeMode.AUTO.computeDimension(ImageResource.DEFAULT_DIMENSION, image)); … … 33 41 assertEquals(new Dimension(21, 16), ImageResizeMode.AUTO.computeDimension(new Dimension(-1, 16), image)); 34 42 assertEquals(new Dimension(24, 32), ImageResizeMode.AUTO.computeDimension(new Dimension(24, 32), image)); 43 } 44 45 /** 46 * Test method for {@link ImageResizeMode#computeDimension} using {@link ImageResizeMode#BOUNDED} 47 */ 48 @Test 49 public void testComputeDimensionBounded() { 35 50 assertEquals(new Dimension(64, 48), ImageResizeMode.BOUNDED.computeDimension(ImageResource.DEFAULT_DIMENSION, image)); 36 51 assertEquals(new Dimension(64, 48), ImageResizeMode.BOUNDED.computeDimension(new Dimension(-1, -1), image)); … … 39 54 assertEquals(new Dimension(21, 16), ImageResizeMode.BOUNDED.computeDimension(new Dimension(-1, 16), image)); 40 55 assertEquals(new Dimension(24, 18), ImageResizeMode.BOUNDED.computeDimension(new Dimension(24, 32), image)); 56 assertEquals(new Dimension(14, 10), ImageResizeMode.BOUNDED.computeDimension(new Dimension(64, 48), smallImage)); 57 assertEquals(new Dimension(14, 10), ImageResizeMode.BOUNDED.computeDimension(new Dimension(16, 16), smallImage)); 58 assertEquals(new Dimension(11, 8), ImageResizeMode.BOUNDED.computeDimension(new Dimension(16, 8), smallImage)); 59 assertEquals(new Dimension(12, 8), ImageResizeMode.BOUNDED.computeDimension(new Dimension(12, 12), smallImage)); 60 assertEquals(new Dimension(11, 8), ImageResizeMode.BOUNDED.computeDimension(new Dimension(12, 8), smallImage)); 61 assertEquals(new Dimension(8, 5), ImageResizeMode.BOUNDED.computeDimension(new Dimension(8, 16), smallImage)); 62 assertEquals(new Dimension(8, 5), ImageResizeMode.BOUNDED.computeDimension(new Dimension(8, 8), smallImage)); 63 assertEquals(new Dimension(8, 5), ImageResizeMode.BOUNDED.computeDimension(new Dimension(8, 8), smallImage)); 64 } 65 66 /** 67 * Test method for {@link ImageResizeMode#computeDimension} using {@link ImageResizeMode#PADDED} 68 */ 69 @Test 70 public void testComputeDimensionPadded() { 41 71 assertThrows(IllegalArgumentException.class, () -> ImageResizeMode.PADDED.computeDimension(new Dimension(0, 0), image)); 42 72 assertThrows(IllegalArgumentException.class, () -> ImageResizeMode.PADDED.computeDimension(ImageResource.DEFAULT_DIMENSION, image)); … … 48 78 } 49 79 80 /** 81 * Test method for {@link ImageResizeMode#cacheKey} 82 */ 50 83 @Test 51 84 public void testCacheKey() {
Note:
See TracChangeset
for help on using the changeset viewer.