org.eclipse.birt.report.tests.model.api
Class DimensionHandleTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.eclipse.birt.report.tests.model.BaseTestCase
              extended byorg.eclipse.birt.report.tests.model.api.DimensionHandleTest
All Implemented Interfaces:
junit.framework.Test

public class DimensionHandleTest
extends BaseTestCase

Test DimensionHandle.


Method Test Case Expected
testGetDisplayValue() value is from an choice display value is from message file of the locale
value is a dimension value, locale is English, China display value is locale-specific
value is a dimension value of a highlight member, locales are English, China display value is locale-specific and matches with the design file.
testGetStringValue() value is from an choice return should be the choice name
value is a real dimension return should be the dimension in string
value is a member of a highlight. returned value matches with the value in the design file.
testSetValue() property type is dimension with choices set the value to an choice
property type is dimension with choices set the value to "12pt"
application unit is "cm", set the value to 12( double ) the dimension should be set using the application unit
Sets a dimension value to a highlight member The value is set and the value matches with the output file.
testIsKeyword() value is "larger" from an choice. is a keyword
value is a real dimension value -- "12pt". not a keyword
testGetMeasure() dimension is from an choice return should be 0.0
a real dimension return is the numeric part of it.
value is a dimension value of a highlight member The measure matches with the set value.
testGetUnits() dimension is from an choice return should be DimensionValue.DEFAULT_UNIT
a real dimension return should be the corresponding unit of it.
value is a dimension value of a highlight member The unit matches with the set value.
Field Summary
 
Fields inherited from class org.eclipse.birt.report.tests.model.BaseTestCase
design, designHandle, GOLDEN_FOLDER, INPUT_FOLDER, OUTPUT_FOLDER, PLUGIN_NAME, PLUGIN_PATH, PLUGINLOC, ROM_DEF_NAME, sessionHandle, TEST_FOLDER, TEST_LOCALE
 
Constructor Summary
DimensionHandleTest(java.lang.String name)
           
 
Method Summary
protected  void setUp()
           
static junit.framework.Test suite()
           
 void testComputedValue()
          Tests the computed dimension value.
 void testFontSizeAbsoluteValue()
          Tests the computation the relative dimension value with the relative value.
 void testGetDisplayValue()
          test getDisplayValue().
 void testGetMeasure()
          test getMeasure().
 void testGetStringValue()
          test getStringValue().
 void testGetUnits()
          Test getUnits().
 void testIsKeyword()
          Test isKeyword().
 void testSetValue()
          Test setValue( String ) and setValue( double ).
 void testUnits()
          Tests all the cases without a unit.
 
Methods inherited from class org.eclipse.birt.report.tests.model.BaseTestCase
compareErrors, compareTextFile, compareTextFileAsResource, createDesign, createDesign, dumpErrors, getClassFolder, getFullQualifiedClassName, openDesign, openDesign, openDesign, openDesign, openDesignAsResource, openDesignAsResource, printSemanticError, printSemanticErrors, printSyntaxError, saveAs, saveAsInTempDir, tearDown
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DimensionHandleTest

public DimensionHandleTest(java.lang.String name)
Parameters:
name -
Method Detail

suite

public static junit.framework.Test suite()

setUp

protected void setUp()
              throws java.lang.Exception
Overrides:
setUp in class BaseTestCase
Throws:
java.lang.Exception

testGetDisplayValue

public void testGetDisplayValue()
test getDisplayValue().

1. value is from an choice, display value is from message file of the locale.

2. value is a dimension value, locale is English, China display value is locale-specific.


testGetStringValue

public void testGetStringValue()
test getStringValue().

1. value is from an choice, return should be the choice name.

2. value is a real dimension, return should be the dimension in string.


testSetValue

public void testSetValue()
                  throws java.lang.Exception
Test setValue( String ) and setValue( double ).

1. property type is dimension with choices, set the value to an choice.

2. property type is dimension with choices, set the value to "12pt"

3. application unit is "cm", set the value to 12( double ), the dimension should be set using the application unit.

Throws:
java.lang.Exception - if the value is invalid or the output file cannot be saved on the storage.

testIsKeyword

public void testIsKeyword()
                   throws org.eclipse.birt.report.model.api.activity.SemanticException
Test isKeyword().

1. value is "larger" from an choice.

2. value is a real dimension value -- "12pt".

Throws:
org.eclipse.birt.report.model.api.activity.SemanticException

testGetMeasure

public void testGetMeasure()
                    throws org.eclipse.birt.report.model.api.activity.SemanticException
test getMeasure().

1. dimension is from an choice, return should be 0.0

2. a real dimension, return is the numeric part of it.

Throws:
org.eclipse.birt.report.model.api.activity.SemanticException

testGetUnits

public void testGetUnits()
                  throws org.eclipse.birt.report.model.api.activity.SemanticException
Test getUnits().

1. dimension is from an choice, return should be DimensionValue.DEFAULT_UNIT

2. a real dimension, return should be the corresponding unit of it.

Throws:
org.eclipse.birt.report.model.api.activity.SemanticException

testComputedValue

public void testComputedValue()
Tests the computed dimension value.


testFontSizeAbsoluteValue

public void testFontSizeAbsoluteValue()
                               throws org.eclipse.birt.report.model.api.activity.SemanticException
Tests the computation the relative dimension value with the relative value.

Throws:
org.eclipse.birt.report.model.api.activity.SemanticException

testUnits

public void testUnits()
               throws java.lang.Exception
Tests all the cases without a unit.

Throws:
java.lang.Exception - if any exception