IReportItemUITest.java from BIRT at Krugle
Show IReportItemUITest.java syntax highlighted
/*******************************************************************************
* Copyright (c) 2004 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.designer.ui.extensions;
import org.eclipse.birt.report.designer.internal.ui.editors.schematic.figures.LabelFigure;
import org.eclipse.birt.report.designer.internal.ui.extension.ExtensionPointManager;
import org.eclipse.birt.report.designer.tests.ITestConstants;
import org.eclipse.birt.report.designer.tests.example.matrix.ReportItemPropertyEditUITest;
import org.eclipse.birt.report.designer.tests.example.matrix.TestingMatrixUI;
import org.eclipse.birt.report.designer.testutil.BaseTestCase;
import org.eclipse.birt.report.model.api.ExtendedItemHandle;
import org.eclipse.jface.window.Window;
/**
*
*/
public class IReportItemUITest extends BaseTestCase
{
private IReportItemFigureProvider ui;
protected void setUp( ) throws Exception
{
super.setUp( );
ui = ExtensionPointManager.getInstance( )
.getExtendedElementPoint( ITestConstants.TEST_EXTENSION_NAME )
.getReportItemUI( );
}
public void testGetQuickEditPage( )
{
assertTrue( ExtensionPointManager.getInstance( ).getExtendedElementPoint( ITestConstants.TEST_EXTENSION_NAME ).getReportItemPropertyEditUI( ) instanceof ReportItemPropertyEditUITest);
}
public void testGetBuilder( )
{
IReportItemBuilderUI builder = ExtensionPointManager.getInstance( ).getExtendedElementPoint( ITestConstants.TEST_EXTENSION_NAME ).getReportItemBuilderUI( ) ;
assertNotNull( builder );
ExtendedItemHandle handle = getReportDesignHandle( ).getElementFactory( )
.newExtendedItem( null,
ITestConstants.TEST_EXTENSION_NAME );
assertNotNull( handle );
assertEquals( ITestConstants.TEST_EXTENSION_NAME,
handle.getExtensionName( ) );
assertEquals( Window.CANCEL, builder.open( null ) );
assertEquals( Window.OK, builder.open( handle ) );
for ( int i = 0; i < TestingMatrixUI.TEST_ELEMENT_CONTENT.length; i++ )
{
assertEquals( TestingMatrixUI.TEST_ELEMENT_CONTENT[i],
handle.getProperty( TestingMatrixUI.TEST_PROPERTY[i] ) );
}
assertEquals( Window.OK, builder.open( handle ) );
for ( int i = 0; i < TestingMatrixUI.TEST_ELEMENT_CONTENT.length; i++ )
{
assertEquals( TestingMatrixUI.TEST_ELEMENT_CONTENT_EDITED[i],
handle.getProperty( TestingMatrixUI.TEST_PROPERTY[i] ) );
}
}
public void testGetFigure( )
{
assertTrue( ui.createFigure( null ) instanceof LabelFigure );
}
public void testUpdateFigure( )
{
try
{
ui.updateFigure( null, null );
}
catch ( Throwable e )
{//should invoke exception
return;
}
fail( );
}
}
See more files for this project here