/*******************************************************************************
 * Copyright (c) 2004 Actuate Corporation. All rights reserved. This program and
 * the accompanying materials are made available under the terms of the Eclipse
 * Public License v1.0 which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html Contributors: Actuate Corporation -
 * initial API and implementation
 ******************************************************************************/

package org.eclipse.birt.report.tests.engine.api;

import junit.framework.Test;
import junit.framework.TestSuite;
import java.util.*;

import org.eclipse.birt.report.engine.api.HTMLRenderContext;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.tests.engine.EngineCase;
import org.eclipse.birt.report.engine.api.RenderOptionBase;

/**
 * <b>HTMLRenderContext test</b>
 * <p>
 * This case tests methods in HTMLRenderContext API. 
 */
public class HTMLRenderContextTest extends EngineCase
{

	/**
	 * @param name
	 */
	public HTMLRenderContextTest( String name )
	{
		super( name );
	}

	/**
	 * Test suite()
	 * 
	 * @return
	 */
	public static Test suite( )
	{
		return new TestSuite( HTMLRenderContextTest.class );
	}

	protected void setUp( ) throws Exception
	{
		super.setUp( );

	}

	protected void tearDown( ) throws Exception
	{
		super.tearDown( );
	}

	/**
	 * Test setBaseImageURL(java.lang.String baseImageURL) method Test
	 * getBaseImageURL() method
	 */
	public void testGetBaseImageURL( )
	{
		HTMLRenderContext context = new HTMLRenderContext( );
		String baseURL = "image", baseURLGet;
		context.setBaseImageURL( baseURL );
		baseURLGet = context.getBaseImageURL( );
		assertEquals( "getBaseImageURL() fail", baseURL, baseURLGet );
	}

	/**
	 * Test setBaseURL(java.lang.String baseURL) method Test getBaseURL() method
	 */
	public void testGetBaseURL( )
	{
		HTMLRenderContext context = new HTMLRenderContext( );
		String baseURL = "image", baseURLGet;
		context.setBaseURL( baseURL );
		baseURLGet = context.getBaseURL( );
		assertEquals( "getBaseURL() fail", baseURL, baseURLGet );
	}

	/**
	 * Test setImageDirectory(java.lang.String imageDirectory) method Test
	 * getImageDirectory() method
	 */
	public void testGetImageDirectory( )
	{
		HTMLRenderContext context = new HTMLRenderContext( );
		String dir = "image", dirGet;
		context.setImageDirectory( dir );
		dirGet = context.getImageDirectory( );
		assertEquals( "getBaseURL() fail", dir, dirGet );
		
		String separator="/";
		dir="image"+separator+"doc";
		context.setImageDirectory( dir );
		assertEquals("image/doc",context.getImageDirectory( ));
		
	}
	
	/**
	 * Test setRenderOption(IRenderOption) method Test
	 * getRenderOption() method
	 */
	
	public void testGetRenderOption()
	{
		RenderOptionBase rendop=new RenderOptionBase();
		rendop.setOutputFormat( "fo" );
		rendop.setOutputFileName( "outputfile" );
		
		HTMLRenderContext context = new HTMLRenderContext( );
		context.SetRenderOption( rendop );
		
		RenderOptionBase ropb=(RenderOptionBase)(context.getRenderOption( ));
			
		assertEquals("fo",ropb.getOutputFormat( ));
		HashMap outsetting=new HashMap();
		outsetting = ropb.getOutputSetting( );
		
		assertFalse(outsetting.isEmpty( ));
		assertEquals(2,outsetting.size( ));
		
		ropb.getOutputSetting( ).put(
				HTMLRenderOption.URL_ENCODING, "UTF-8" );
		assertEquals(3,outsetting.size( ));
		
	}
	
	/**
	 * Test setSupportedImageFormats(java.lang.String formats) method Test
	 * getSupportedImageFormats() method
	 */
	
	public void testGetSupportedImageFormats()
	{
		HTMLRenderContext context = new HTMLRenderContext( );
		String baseURL = "Format", baseURLGet;
		context.setBaseImageURL( baseURL );
		baseURLGet = context.getBaseImageURL( );
		assertEquals( "getBaseImageURL() fail", baseURL, baseURLGet );
	}
	
}


@@ -563,16 +563,65 @@
 e.api;%0A%0A
+import java.util.HashMap;%0Aimport java.util.Map;%0A%0A
 import j
@@ -641,16 +641,16 @@
 k.Test;%0A
-
 import j
@@ -678,28 +678,8 @@
 ite;
-%0Aimport java.util.*;
 %0A%0Aim
@@ -843,22 +843,23 @@
 api.
-I
 Re
-portRunnabl
+nderOptionBas
 e;%0Ai
@@ -916,68 +916,8 @@
 ase;
-%0Aimport org.eclipse.birt.report.engine.api.RenderOptionBase;
 %0A%0A/*
@@ -3202,20 +3202,16 @@
 ( ));%0A%09%09
-Hash
 Map outs

fix the compile error of tests.engine