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

import org.eclipse.birt.report.engine.api.IReportDocument;
import org.eclipse.birt.report.engine.api.TOCNode;
import org.eclipse.birt.report.tests.engine.EngineCase;

/**
 * <b>Bug description</b>
 * <p>
 * Total function in Group TOC doesn't return correct value
 * 
 * <p>
 * <b>Test description:</b>
 * <p>
 * This test makes sure that toc with Sum function can be displayed well in
 * Groop
 * 
 */
public class Regression_138858 extends EngineCase
{

	private final static String INPUT = "regression_138858.rptdesign"; //$NON-NLS-1$
	private final static String OUTPUT = "regression_138858.rptdocument"; //$NON-NLS-1$
	private String path = getClassFolder( )
			+ System.getProperty( "file.separator" );
	private String out_path = path + "output"
			+ System.getProperty( "file.separator" );

	/**
	 * @throws Exception
	 */

	public void test_Regression_138858( ) throws Exception
	{
		run( INPUT, OUTPUT );
		IReportDocument reportDoc = engine.openReportDocument( out_path
				+ OUTPUT );
		TOCNode root = reportDoc.findTOC( "/" );
		String tocValue, tocLabel;
		tocLabel = ( (TOCNode) root.getChildren( ).get( 0 ) )
				.getDisplayString( );
		tocValue = "430300";
		assertEquals(
				"Toc with Sum function in group display incorrectly in preview page",
				tocValue, tocLabel );
		tocLabel = ( (TOCNode) root.getChildren( ).get( 1 ) )
				.getDisplayString( );
		tocValue = "117000";
		assertEquals(
				"Toc with Sum function in group display incorrectly in preview page",
				tocValue, tocLabel );

	}
}
