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

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

import org.eclipse.birt.report.tests.engine.EngineCase;

/**
 * <b>Bug description</b>
 * <p>
 * Enhance to add the iid after &lt;col&gt;
 * <p>
 * <b>Test description</b>
 * <p>
 * This test make sure that the iid is added after the col.
 *  
 */

public class Regression_144489 extends EngineCase
{
	private final static String INPUT = "regression_144489.rptdesign";
	private final static String OUTPUT = "regression_144489.html";
	
	public void test_Regression_144489( ) throws Exception
	{
		runAndRender_HTML( INPUT , OUTPUT );
		testCompare( OUTPUT );
	}
	
	protected void testCompare(String fileHTML) throws IOException
	{

		String fileHTMLFile = getClassFolder() + "/" + OUTPUT_FOLDER + "/" + fileHTML;
		BufferedReader reader = new BufferedReader( new FileReader( new File( fileHTMLFile ) ) );
		String line = null;
		boolean hasCol = false;
		while ((line = reader.readLine()) != null) 
		{
			if (line.indexOf( "<col" ) > 0 ) 
			{
				if ( line.indexOf( "iid" ) > 0 )
				{
					hasCol = true;
					break;
				}
				else
					fail( "No iid after col and test fail." );
			}
		}
		if ( hasCol == false )
			fail( "No <col>" );
	}
}
