
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>
 * TOC defined in text item doesn't show up in Web Viewer
 * 
 * <p>
 * <b>Test description:</b>
 * <p>
 * This test makes sure that text TOC is generated and can be got from report
 * document
 * 
 */
public class Regression_120495 extends EngineCase
{

	private final static String INPUT = "regression_120495.rptdesign"; //$NON-NLS-1$
	private final static String OUTPUT = "regression_120495.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_120495( ) 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 = "text";
		assertEquals(
				"Toc with datetime type display different format from preview page",
				tocValue, tocLabel );
	}
}
