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

import java.util.HashMap;

import org.eclipse.birt.report.engine.api.EngineConstants;
import org.eclipse.birt.report.engine.api.EngineException;
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.engine.api.IRunAndRenderTask;
import org.eclipse.birt.report.tests.engine.EngineCase;

/**
 * <b>Bug description</b>
 * <p>
 * No errors occour when setting a unexisting parameter in a report
 * <p>
 * <b>Test description</b>
 * <p>
 * This test makes sure that error meesages are thrown out.
 * 
 * 
 * 
 */
public class Regression_79249 extends EngineCase
{

	private final static String INPUT = "regression_79249.rptdesign"; //$NON-NLS-1$
	private final static String OUTPUT = "regression_79249.html"; //$NON-NLS-1$
	private String separator = System.getProperty( "file.separator" );
	private String path = getClassFolder( ) + separator;
	private String outputPath = path + OUTPUT_FOLDER + separator;
	private String inputPath = path + INPUT_FOLDER + separator;

	/**
	 * @throws Exception
	 */

	public void test_Regression_79249( ) throws Exception
	{
		IReportRunnable runnable = engine.openReportDesign( inputPath + INPUT );
		HTMLRenderOption options = new HTMLRenderOption( );
		options.setOutputFormat( "html" );
		options.setOutputFileName( outputPath + OUTPUT );
		HTMLRenderContext renderContext = new HTMLRenderContext( );
		renderContext.setImageDirectory( "image" );
		HashMap appContext = new HashMap( );
		appContext.put( EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT,
				renderContext );

		IRunAndRenderTask task = engine.createRunAndRenderTask( runnable );
		task.setAppContext( appContext );
		task.setRenderOption( options );
		task.run( );

		if ( task.getErrors( ) != null && task.getErrors( ).size( ) > 0 )
		{
			assertTrue( "Fail to throw EngineException", task.getErrors( ).get(
					0 ) instanceof EngineException );

		}
		else
		{
			fail( "Fail to throw EngineException " );
		}

		task.close( );
		this.removeFile( outputPath + OUTPUT );
	}

}
