package org.richfaces.renderkit.html.iconimages;

import java.awt.Color;

import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
import org.ajax4jsf.util.HtmlColor;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;

/**
 * @author Anton Belevich
 *
 */
public class PanelMenuIconBasicTest extends AbstractAjax4JsfTestCase {

	public PanelMenuIconBasicTest(String name) {
		super(name);
	}
	
public void testSaveResources(){
		
		PanelMenuIconBasic icon = new PanelMenuIconChevron();
	
		Skin skin = SkinFactory.getInstance().getSkin(facesContext);
		Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(facesContext);
		
		String skinParameter = "headerTextColor";
		String headerTextColor = (String) skin.getParameter(facesContext, skinParameter);
		
		if (null == headerTextColor || "".equals(headerTextColor))
			headerTextColor = (String) defaultSkin.getParameter(facesContext, skinParameter);
		
		assertNotNull(headerTextColor);
		
		Color color1 = HtmlColor.decode(headerTextColor);
		
		byte [] data = (byte []) icon.getDataToStore(facesContext, new Boolean(true));
		
		assertNotNull(data);
		
		Object results = (Object)icon.deserializeData(data);
		
		assertNotNull(results);
		
		assertEquals(color1, results);
	
	}

}
