use of org.xwiki.icon.IconSet in project xwiki-platform by xwiki.
the class DefaultIconRendererTest method renderHTML.
@Test
public void renderHTML() throws Exception {
IconSet iconSet = new IconSet("default");
iconSet.setRenderHTML("<img src=\"$icon.png\" />");
iconSet.addIcon("test", new Icon("blabla"));
when(velocityRenderer.render("#set($icon = \"blabla\")\n<img src=\"$icon.png\" />")).thenReturn("<img src=\"blabla.png\" />");
// Test
String result = mocker.getComponentUnderTest().renderHTML("test", iconSet);
// Verify
assertEquals("<img src=\"blabla.png\" />", result);
}
use of org.xwiki.icon.IconSet in project xwiki-platform by xwiki.
the class DefaultIconRendererTest method renderHTMLWithJSX.
@Test
public void renderHTMLWithJSX() throws Exception {
IconSet iconSet = new IconSet("default");
iconSet.setJsx("jsx");
iconSet.addIcon("test", new Icon("blabla"));
// Test
mocker.getComponentUnderTest().renderHTML("test", iconSet);
// Verify
verify(jsExtension).use("jsx");
verify(linkExtension, never()).use(any());
verify(skinExtension, never()).use(any());
}
use of org.xwiki.icon.IconSet in project xwiki-platform by xwiki.
the class DefaultIconSetCacheTest method putByNameAndWiki.
@Test
public void putByNameAndWiki() throws Exception {
IconSet iconSet = new IconSet("key");
mocker.getComponentUnderTest().put("key", "wikiId", iconSet);
verify(cache).set("NAMED:6wikiId_key", iconSet);
}
use of org.xwiki.icon.IconSet in project xwiki-platform by xwiki.
the class DefaultIconSetCacheTest method setUp.
@Before
public void setUp() throws Exception {
cacheManager = mocker.getInstance(CacheManager.class);
entityReferenceSerializer = mocker.getInstance(new DefaultParameterizedType(null, EntityReferenceSerializer.class, String.class));
cache = mock(Cache.class);
CacheFactory cacheFactory = mock(CacheFactory.class);
when(cacheManager.getCacheFactory()).thenReturn(cacheFactory);
CacheConfiguration configuration = new CacheConfiguration("iconset");
when(cacheFactory.<IconSet>newCache(eq(configuration))).thenReturn(cache);
}
use of org.xwiki.icon.IconSet in project xwiki-platform by xwiki.
the class DefaultIconSetCacheTest method getByDocRef.
@Test
public void getByDocRef() throws Exception {
IconSet iconSet = new IconSet("key");
DocumentReference docRef = new DocumentReference("a", "b", "c");
when(entityReferenceSerializer.serialize(docRef)).thenReturn("a:b.c");
when(cache.get("DOC:a:b.c")).thenReturn(iconSet);
IconSet result = mocker.getComponentUnderTest().get(docRef);
assertTrue(iconSet == result);
}
Aggregations