
/*******************************************************************************
 * Copyright (c) 2004, 2005 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.engine.parser;

import java.util.ArrayList;

import org.eclipse.birt.report.engine.api.IParameterDefnBase;
import org.eclipse.birt.report.engine.api.impl.ParameterGroupDefn;
import org.eclipse.birt.report.engine.api.impl.ScalarParameterDefn;


/**
 * 
 */

public class TestPromptText extends AbstractDesignTestCase
{
	protected ScalarParameterDefn scalarParameter;
	protected ArrayList parameters;

	public void testPromptText( )
	{		
		loadDesign( "prompt_text.xml" );
		parameters = new ReportParser().getParameters( report.getReportDesign( ), true );
		assertTrue( parameters != null );
		
		//prompt text
		if ( parameters != null && parameters.size( ) > 0 )
		{
			assertEquals( "testPromptText", ( (ScalarParameterDefn)parameters.get( 0 ) ).getPromptText() );
		}
	}
	
	public void testCascadingParameterPromptText( )
	{
		loadDesign( "parameterGroupDefnPromptText.xml" );
		parameters = new ReportParser().getParameters( report.getReportDesign( ), true );
		assertTrue( parameters != null );
		if ( parameters != null && parameters.size( ) > 0 )
		{
			for ( int i = 0; i < parameters.size( ); i++ )
			{
				IParameterDefnBase parameter = ( IParameterDefnBase ) parameters.get( i );
				if ( parameter instanceof ParameterGroupDefn )
				{
					assertEquals( "testParameterGroupDefnPromptText", ( ( ParameterGroupDefn )parameter ).getPromptText() );
				}
			}
		}
	}
}
