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

import java.util.ArrayList;

import org.eclipse.birt.report.engine.api.IGetParameterDefinitionTask;
import org.eclipse.birt.report.engine.api.IParameterSelectionChoice;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.tests.engine.EngineCase;

/**
 * <b>Bug description</b>
 * <p>
 * The cascading parameter does not work when a column name includes double
 * quotation marks.
 * <p>
 * <b>Test description</b>
 * <p>
 * This test makes sure that cascading parameters work properly when column
 * names include double quotation.
 * 
 */
public class Regression_137130 extends EngineCase
{

	private final static String INPUT = "regression_137130.rptdesign"; //$NON-NLS-1$
	private IReportRunnable RunnableReportDesign;

	/**
	 * @throws Exception
	 */

	public void test_Regression_137130( ) throws Exception
	{
		RunnableReportDesign = engine.openReportDesign( this.getClassFolder( )
				+ "/" + INPUT_FOLDER + "/" + INPUT );
		IGetParameterDefinitionTask parameterTask = engine
				.createGetParameterDefinitionTask( RunnableReportDesign );
		ArrayList CascadingParameter = (ArrayList) parameterTask
				.getSelectionListForCascadingGroup(
						"NewCascadingParameterGroup", new Object[0] );
		if ( parameterTask.getErrors( ).size( ) <= 0 )
		{
			assertEquals( "Error:not getting the right size of parameter", 7,
					CascadingParameter.size( ) );
			IParameterSelectionChoice choice = (IParameterSelectionChoice) CascadingParameter
					.get( 0 );
			assertEquals( "Error:The first value is wrong", "Boston", choice
					.getValue( ) );
		}
		else
		{
			fail( "Fail to throw Exception " );
		}

	}

}
