AMGIFImageScaler implements AMImageScaler { private String _getResizeFitValues( AMImageConfigurationEntry amImageConfigurationEntry) { Map<String, String> properties = amImageConfigurationEntry.getProperties(); int maxHeight = GetterUtil.getInteger(properties.get("max-height")); String maxHeightString = StringPool.UNDERLINE; if (maxHeight != 0) { maxHeightString = String.valueOf(maxHeight); } int maxWidth = GetterUtil.getInteger(properties.get("max-width")); String maxWidthString = StringPool.UNDERLINE; if (maxWidth != 0) { maxWidthString = String.valueOf(maxWidth); } return StringBundler.concat(maxWidthString, "x", maxHeightString); }  @Override boolean isEnabled(); @Override AMImageScaledImage scaleImage(
		FileVersion fileVersion,
		AMImageConfigurationEntry amImageConfigurationEntry);  }
@Test public void testGetResizeFitArgumentWithBlankMaxHeight() { AMGIFImageScaler amGIFImageScaler = new AMGIFImageScaler(); AMImageConfigurationEntry amImageConfigurationEntry = new AMImageConfigurationEntryImpl( "test", "desc", "12345", HashMapBuilder.put( "max-height", "" ).put( "max-width", "100" ).build(), true); Assert.assertEquals( "100x_", _getResizeFitValues(amGIFImageScaler, amImageConfigurationEntry)); }
@Test public void testGetResizeFitArgumentWithBlankMaxWidth() { AMGIFImageScaler amGIFImageScaler = new AMGIFImageScaler(); AMImageConfigurationEntry amImageConfigurationEntry = new AMImageConfigurationEntryImpl( "test", "desc", "12345", HashMapBuilder.put( "max-height", "100" ).put( "max-width", "" ).build(), true); Assert.assertEquals( "_x100", _getResizeFitValues(amGIFImageScaler, amImageConfigurationEntry)); }
@Test public void testGetResizeFitArgumentWithMaxWidthAndMaxHeight() { AMGIFImageScaler amGIFImageScaler = new AMGIFImageScaler(); AMImageConfigurationEntry amImageConfigurationEntry = new AMImageConfigurationEntryImpl( "test", "desc", "12345", HashMapBuilder.put( "max-height", "100" ).put( "max-width", "200" ).build(), true); Assert.assertEquals( "200x100", _getResizeFitValues(amGIFImageScaler, amImageConfigurationEntry)); }
@Test public void testGetResizeFitArgumentWithOnlyMaxHeight() { AMGIFImageScaler amGIFImageScaler = new AMGIFImageScaler(); AMImageConfigurationEntry amImageConfigurationEntry = new AMImageConfigurationEntryImpl( "test", "desc", "12345", HashMapBuilder.put( "max-height", "100" ).build(), true); Assert.assertEquals( "_x100", _getResizeFitValues(amGIFImageScaler, amImageConfigurationEntry)); }
@Test public void testGetResizeFitArgumentWithZeroMaxHeight() { AMGIFImageScaler amGIFImageScaler = new AMGIFImageScaler(); AMImageConfigurationEntry amImageConfigurationEntry = new AMImageConfigurationEntryImpl( "test", "desc", "12345", HashMapBuilder.put( "max-height", "0" ).put( "max-width", "100" ).build(), true); Assert.assertEquals( "100x_", _getResizeFitValues(amGIFImageScaler, amImageConfigurationEntry)); }
@Test public void testGetResizeFitArgumentWithZeroMaxWidth() { AMGIFImageScaler amGIFImageScaler = new AMGIFImageScaler(); AMImageConfigurationEntry amImageConfigurationEntry = new AMImageConfigurationEntryImpl( "test", "desc", "12345", HashMapBuilder.put( "max-height", "100" ).put( "max-width", "0" ).build(), true); Assert.assertEquals( "_x100", _getResizeFitValues(amGIFImageScaler, amImageConfigurationEntry)); }