} else {
// try and determine modified date
URI fontUri = resourceResolver.resolveFromBase(fontInfo.getEmbedURI());
- File fontFile = new File(fontUri);
- long lastModified = fontFile.lastModified();
+ long lastModified = getLastModified(fontUri);
cachedFontFile = new CachedFontFile(lastModified);
if (log.isTraceEnabled()) {
log.trace("Font added to cache: " + cacheKey);
package org.apache.fop.fonts;
+import java.io.File;
import java.net.URI;
+import java.net.URISyntaxException;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InOrder;
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.io.InternalResourceResolver;
+import org.apache.fop.apps.io.ResourceResolverFactory;
public class FontManagerTestCase {
inOrder.verify(fontCacheManager).setCacheFile(any(URI.class));
}
+ @Test
+ public void testSetCacheURL() throws URISyntaxException {
+ InternalResourceResolver rr = ResourceResolverFactory.createDefaultInternalResourceResolver(
+ new File(".").toURI());
+ String uri = "abc://localhost/f";
+ EmbedFontInfo efi = new EmbedFontInfo(new FontUris(new URI(uri), null), false, false, null, null);
+ FontCache fc = new FontCache();
+ fc.addFont(efi, rr);
+ Assert.assertTrue(fc.containsFont(uri));
+ }
+
@Test
public void testGetFontCache() {
sut.getFontCache();