poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r645483 [1/7] - in /poi/branches/ooxml: ./ src/documentation/content/xdocs/ src/java/org/apache/poi/hssf/record/ src/java/org/apache/poi/hssf/record/cf/ src/java/org/apache/poi/hssf/usermodel/ src/java/org/apache/poi/util/ src/testcases/org...
Date Mon, 07 Apr 2008 12:52:00 GMT
Author: nick
Date: Mon Apr  7 05:51:50 2008
New Revision: 645483

URL: http://svn.apache.org/viewvc?rev=645483&view=rev
Log:
Merged revisions 638786-638802,638805-638811,638813-638814,638816-639230,639233-639241,639243-639253,639255-639486,639488-639601,639603-639835,639837-639917,639919-640056,640058-640710,640712-641156,641158-641184,641186-641795,641797-641798,641800-641933,641935-641963,641965-641966,641968-641995,641997-642230,642232-642562,642564-642565,642568-642570,642572-642573,642576-642736,642739-642877,642879,642881-642890,642892-642903,642905-642945,642947-643624,643626-643653,643655-643669,643671,643673-643830,643832-643833,643835-644342,644344-644472,644474-644508,644510-645478 via svnmerge from 
https://svn.apache.org:443/repos/asf/poi/trunk

........
  r645348 | josh | 2008-04-07 04:02:03 +0100 (Mon, 07 Apr 2008) | 1 line
  
  refactored all hssf junits to get test sample data in the in one place
........
  r645352 | josh | 2008-04-07 04:23:04 +0100 (Mon, 07 Apr 2008) | 2 lines
  
  30311 - More work on Conditional Formatting - patch from Dmitriy
........

Added:
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/HSSFTestDataSamples.java
      - copied unchanged from r645352, poi/trunk/src/testcases/org/apache/poi/hssf/HSSFTestDataSamples.java
Modified:
    poi/branches/ooxml/   (props changed)
    poi/branches/ooxml/src/documentation/content/xdocs/changes.xml
    poi/branches/ooxml/src/documentation/content/xdocs/status.xml
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CFRuleRecord.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/cf/FontFormatting.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFFontFormatting.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFPatternFormatting.java
    poi/branches/ooxml/src/java/org/apache/poi/util/HexRead.java
    poi/branches/ooxml/src/testcases/org/apache/poi/TestPOIDocumentMain.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/extractor/TestExcelExtractor.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestBOFRecord.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestCFRuleRecord.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestChartTitleFormatRecord.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestFormulaRecord.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestRecordFactory.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestSSTDeserializer.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestSSTRecord.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestUnicodeNameRecord.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/aggregates/TestValueRecordsAggregate.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/AbstractPtgTestCase.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/TestExternalFunctionFormulas.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/eval/TestFormulaBugs.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/eval/TestFormulasFromSpreadsheet.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/TestReadMissingBuiltInFuncs.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestLookupFunctionsFromSpreadsheet.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBug42464.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestFormulaEvaluatorBugs.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFComment.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFConditionalFormatting.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFHeaderFooter.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFHyperlink.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPictureData.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestNamedRange.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestPOIFSProperties.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestReadWriteChart.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestSheetHiding.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestSheetShiftRows.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestUppercaseWorkbook.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestWorkbook.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/util/TestAreaReference.java
    poi/branches/ooxml/src/testcases/org/apache/poi/poifs/filesystem/TestOffice2007XMLException.java
    poi/branches/ooxml/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java
    poi/branches/ooxml/src/testcases/org/apache/poi/poifs/filesystem/TestPropertySorter.java

Propchange: poi/branches/ooxml/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Apr  7 05:51:50 2008
@@ -1 +1 @@
-/poi/trunk:1-638784,638786-639486,639488-639601,639603-640056,640058-642562,642564-642566,642568-642574,642576-642736,642739-645088
+/poi/trunk:1-638784,638786-639486,639488-639601,639603-640056,640058-642562,642564-642566,642568-642574,642576-642736,642739-645478

Modified: poi/branches/ooxml/src/documentation/content/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/documentation/content/xdocs/changes.xml?rev=645483&r1=645482&r2=645483&view=diff
==============================================================================
--- poi/branches/ooxml/src/documentation/content/xdocs/changes.xml (original)
+++ poi/branches/ooxml/src/documentation/content/xdocs/changes.xml Mon Apr  7 05:51:50 2008
@@ -37,6 +37,8 @@
 
 		<!-- Don't forget to update status.xml too! -->
         <release version="3.0.3-beta1" date="2008-04-??">
+           <action dev="POI-DEVELOPERS" type="add">30311 - More work on Conditional Formatting</action>
+           <action dev="POI-DEVELOPERS" type="fix">refactored all junits' usage of HSSF.testdata.path to one place</action>
            <action dev="POI-DEVELOPERS" type="fix">44739 - Small fixes for conditional formatting (regions with max row/col index)</action>
            <action dev="POI-DEVELOPERS" type="add">Implement Sheet.removeShape(Shape shape) in HSLF</action>
            <action dev="RK" type="add">44694 - HPSF: Support for property sets without sections</action>

Modified: poi/branches/ooxml/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/documentation/content/xdocs/status.xml?rev=645483&r1=645482&r2=645483&view=diff
==============================================================================
--- poi/branches/ooxml/src/documentation/content/xdocs/status.xml (original)
+++ poi/branches/ooxml/src/documentation/content/xdocs/status.xml Mon Apr  7 05:51:50 2008
@@ -34,6 +34,8 @@
 	<!-- Don't forget to update changes.xml too! -->
     <changes>
         <release version="3.0.3-beta1" date="2008-04-??">
+           <action dev="POI-DEVELOPERS" type="add">30311 - More work on Conditional Formatting</action>
+           <action dev="POI-DEVELOPERS" type="fix">refactored all junits' usage of HSSF.testdata.path to one place</action>
            <action dev="POI-DEVELOPERS" type="fix">44739 - Small fixes for conditional formatting (regions with max row/col index)</action>
            <action dev="RK" type="add">44694 - HPSF: Support for property sets without sections</action>
            <action dev="POI-DEVELOPERS" type="add">Implement Sheet.removeShape(Shape shape) in HSLF</action>

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CFRuleRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CFRuleRecord.java?rev=645483&r1=645482&r2=645483&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CFRuleRecord.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/record/CFRuleRecord.java Mon Apr  7 05:51:50 2008
@@ -238,6 +238,17 @@
 		this.fontFormatting = fontFormatting;
 		setOptionFlag(fontFormatting != null, font);
 	}
+	public FontFormatting getFontFormatting()
+	{
+		if( containsFontFormattingBlock())
+		{
+			return fontFormatting;
+		}
+		else
+		{
+			return null;
+		}
+	}
 	
 	public boolean containsAlignFormattingBlock()
 	{
@@ -257,6 +268,17 @@
 		this.borderFormatting = borderFormatting;
 		setOptionFlag(borderFormatting != null, bord);
 	}
+	public BorderFormatting getBorderFormatting()
+	{
+		if( containsBorderFormattingBlock())
+		{
+			return borderFormatting;
+		}
+		else
+		{
+			return null;
+		}
+	}
 	
 	public boolean containsPatternFormattingBlock()
 	{
@@ -267,7 +289,17 @@
 		this.patternFormatting = patternFormatting;
 		setOptionFlag(patternFormatting!=null, patt);
 	}
-
+	public PatternFormatting getPatternFormatting()
+	{
+		if( containsPatternFormattingBlock())
+		{
+			return patternFormatting;
+		}
+		else
+		{
+			return null;
+		}
+	}
 	
 	public boolean containsProtectionFormattingBlock()
 	{
@@ -616,12 +648,6 @@
 		return rec;
 	}
 
-	public FontFormatting getFontFormatting()
-	{
-		return fontFormatting;
-	}
-
-	
 	/**
 	 * @return <code>null</code> if <tt>formula</tt> was null.
 	 */

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/record/cf/FontFormatting.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/record/cf/FontFormatting.java?rev=645483&r1=645482&r2=645483&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/record/cf/FontFormatting.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/record/cf/FontFormatting.java Mon Apr  7 05:51:50 2008
@@ -45,8 +45,8 @@
     private static final int OFFSET_OPTION_FLAGS = 88;
     private static final int OFFSET_ESCAPEMENT_TYPE_MODIFIED = 92;
     private static final int OFFSET_UNDERLINE_TYPE_MODIFIED = 96;
-    private static final int OFFSET_NOT_USED1 = 100;
-    private static final int OFFSET_NOT_USED2 = 104;
+    private static final int OFFSET_FONT_WEIGHT_MODIFIED = 100;
+    private static final int OFFSET_NOT_USED = 104;
     private static final int OFFSET_FONT_FORMATING_END = 116;
 
     
@@ -56,7 +56,6 @@
     private static final BitField posture		= BitFieldFactory.getInstance(0x00000002);
     private static final BitField outline		= BitFieldFactory.getInstance(0x00000008);
     private static final BitField shadow		= BitFieldFactory.getInstance(0x00000010);
-    private static final BitField condense		= BitFieldFactory.getInstance(0x00000020);
     private static final BitField cancellation	= BitFieldFactory.getInstance(0x00000080);
     
     // OPTION FLAGS MASKS
@@ -64,7 +63,6 @@
     private static final BitField styleModified			= BitFieldFactory.getInstance(0x00000002);
     private static final BitField outlineModified 		= BitFieldFactory.getInstance(0x00000008);
     private static final BitField shadowModified 		= BitFieldFactory.getInstance(0x00000010);
-    private static final BitField condenseModified		= BitFieldFactory.getInstance(0x00000020);
     private static final BitField cancellationModified	= BitFieldFactory.getInstance(0x00000080);
 
     /**
@@ -125,10 +123,9 @@
     	
     	this.setFontHeight((short)-1);
     	this.setItalic(false);
-    	this.setBold(false);
+    	this.setFontWieghtModified(false);
     	this.setOutline(false);
     	this.setShadow(false);
-    	this.setCondense(false);
     	this.setStrikeout(false);
     	this.setEscapementType((short)0);
     	this.setUnderlineType((byte)0);
@@ -137,15 +134,13 @@
     	this.setFontStyleModified(false);
     	this.setFontOutlineModified(false);
     	this.setFontShadowModified(false);
-    	this.setFontCondenseModified(false);
     	this.setFontCancellationModified(false);
     	
     	this.setEscapementTypeModified(false);
     	this.setUnderlineTypeModified(false);
     	
     	LittleEndian.putShort(record, OFFSET_FONT_NAME, (short)0);
-    	LittleEndian.putInt(record, OFFSET_NOT_USED1, 0x00000001);
-    	LittleEndian.putInt(record, OFFSET_NOT_USED2, 0x00000001);
+    	LittleEndian.putInt(record, OFFSET_NOT_USED, 0x00000001);
     	LittleEndian.putShort(record, OFFSET_FONT_FORMATING_END, (short)0x0001);
     }
     
@@ -249,16 +244,6 @@
     	return getFontOption(shadow);
     }
 
-    public void setCondense(boolean on)
-    {
-    	setFontOption(on, condense);
-    }
-
-    public boolean isCondenseOn()
-    {
-    	return getFontOption(condense);
-    }
-
     /**
      * set the font to be stricken out or not
      *
@@ -420,6 +405,7 @@
     	return getOptionFlag(styleModified);
     }
 
+    
     public void setFontStyleModified(boolean modified)
     {
     	setOptionFlag(modified, styleModified);
@@ -444,16 +430,6 @@
     {
     	setOptionFlag(modified, shadowModified);
     }
-    public boolean isFontCondenseModified()
-    {
-    	return getOptionFlag(condenseModified);
-    }
-    
-    public void setFontCondenseModified(boolean modified)
-    {
-    	setOptionFlag(modified, condenseModified);
-    }
-    
     public void setFontCancellationModified(boolean modified)
     {
     	setOptionFlag(modified, cancellationModified);
@@ -469,7 +445,6 @@
     	int value = modified? 0 : 1;
     	LittleEndian.putInt(record,OFFSET_ESCAPEMENT_TYPE_MODIFIED, value);
     }
-    
     public boolean isEscapementTypeModified()
     {
     	int escapementModified = LittleEndian.getInt(record,OFFSET_ESCAPEMENT_TYPE_MODIFIED);
@@ -488,6 +463,18 @@
     	return underlineModified == 0;
     }
     
+    public void setFontWieghtModified(boolean modified)
+    {
+    	int value = modified? 0 : 1;
+    	LittleEndian.putInt(record,OFFSET_FONT_WEIGHT_MODIFIED, value);
+    }
+
+    public boolean isFontWeightModified()
+    {
+    	int fontStyleModified = LittleEndian.getInt(record,OFFSET_FONT_WEIGHT_MODIFIED);
+    	return fontStyleModified == 0;
+    }
+
     public String toString()
     {
         StringBuffer buffer = new StringBuffer();
@@ -521,14 +508,6 @@
         {
             buffer.append("    .font shadow is not modified\n");
         }
-        if( isFontCondenseModified() )
-        {
-            buffer.append("    .font condense = ").append(isCondenseOn()).append("\n");
-        }
-        else
-        {
-            buffer.append("    .font condense is not modified\n");
-        }
         
         if( isFontCancellationModified() )
         {
@@ -572,11 +551,32 @@
         }
         buffer.append("    .color index = ").append("0x"+Integer.toHexString(getFontColorIndex()).toUpperCase()).append("\n");
         
+
+        buffer.append("    ====\n");
+        buffer.append("    ["+OFFSET_FONT_HEIGHT+"] FONT HEIGHT: "+intToHex(OFFSET_FONT_HEIGHT)+"\n");
+        buffer.append("    ["+OFFSET_FONT_OPTIONS+"] FONT OPTIONS: "+intToHex(OFFSET_FONT_OPTIONS)+"\n");
+        buffer.append("    ["+OFFSET_FONT_WEIGHT+"] FONT WEIGHT: "+shortToHex(OFFSET_FONT_WEIGHT)+"\n");
+        buffer.append("    ["+OFFSET_ESCAPEMENT_TYPE+"] FONT ESCAPEMENT: "+shortToHex(OFFSET_ESCAPEMENT_TYPE)+"\n");
+        buffer.append("    ["+OFFSET_UNDERLINE_TYPE+"] FONT UNDERLINE: "+byteToHex(OFFSET_UNDERLINE_TYPE)+"\n");
+        buffer.append("    ["+(OFFSET_UNDERLINE_TYPE+1)+"] FONT NOT USED: "+byteToHex(OFFSET_UNDERLINE_TYPE+1)+"\n");
+        buffer.append("    ["+(OFFSET_UNDERLINE_TYPE+2)+"] FONT NOT USED: "+byteToHex(OFFSET_UNDERLINE_TYPE+2)+"\n");
+        buffer.append("    ["+(OFFSET_UNDERLINE_TYPE+3)+"] FONT NOT USED: "+byteToHex(OFFSET_UNDERLINE_TYPE+3)+"\n");
+        buffer.append("    ["+OFFSET_FONT_COLOR_INDEX+"] FONT COLIDX: "+intToHex(OFFSET_FONT_COLOR_INDEX)+"\n");
+        buffer.append("    ["+(OFFSET_FONT_COLOR_INDEX+4)+"] FONT NOT USED: "+intToHex(OFFSET_FONT_COLOR_INDEX+4)+"\n");
+        buffer.append("    ["+OFFSET_OPTION_FLAGS+"] FONT OPTIONS: "+intToHex(OFFSET_OPTION_FLAGS)+"\n");
+        buffer.append("    ["+OFFSET_ESCAPEMENT_TYPE_MODIFIED+"] FONT ESC MOD: "+intToHex(OFFSET_ESCAPEMENT_TYPE_MODIFIED)+"\n");
+        buffer.append("    ["+OFFSET_UNDERLINE_TYPE_MODIFIED+"] FONT UND MOD: "+intToHex(OFFSET_UNDERLINE_TYPE_MODIFIED)+"\n");
+        buffer.append("    ["+OFFSET_FONT_WEIGHT+"] FONT WGH MOD: "+intToHex(OFFSET_FONT_WEIGHT)+"\n");
+        buffer.append("    ["+OFFSET_NOT_USED+"] FONT NOT USED: "+intToHex(OFFSET_NOT_USED)+"\n");
+        buffer.append("    ["+(OFFSET_NOT_USED+4)+"] FONT NOT USED: "+intToHex(OFFSET_NOT_USED+4)+"\n");
+        buffer.append("    ["+(OFFSET_NOT_USED+8)+"] FONT NOT USED: "+intToHex(OFFSET_NOT_USED+8)+"\n");
+        buffer.append("    ["+OFFSET_FONT_FORMATING_END+"] FONT FORMATTING END: "+shortToHex(OFFSET_FONT_FORMATING_END)+"\n");
+        buffer.append("    ====\n");
         
         buffer.append("    [/Font Formatting]\n");
         return buffer.toString();
     }
-    
+
     public Object clone() 
     {
       FontFormatting rec = new FontFormatting();
@@ -588,4 +588,18 @@
       }
       return rec;
     }
+
+	private String intToHex(int offset)
+	{
+		return Integer.toHexString(LittleEndian.getInt(record, offset));
+	}
+	private String shortToHex(int offset)
+	{
+		return Integer.toHexString(LittleEndian.getShort(record, offset)&0xFFFF);
+	}
+	private String byteToHex(int offset)
+	{
+		return Integer.toHexString(record[offset]&0xFF);
+	}
+	
 }

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java?rev=645483&r1=645482&r2=645483&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java Mon Apr  7 05:51:50 2008
@@ -65,6 +65,11 @@
 		borderFormatting = new BorderFormatting();
 	}
 
+	protected HSSFBorderFormatting(BorderFormatting borderFormatting)
+	{
+		this.borderFormatting = borderFormatting;
+	}
+	
 	protected BorderFormatting getBorderFormattingBlock()
 	{
 		return borderFormatting;

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java?rev=645483&r1=645482&r2=645483&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java Mon Apr  7 05:51:50 2008
@@ -17,8 +17,6 @@
 
 package org.apache.poi.hssf.usermodel;
 
-import java.util.List;
-
 import org.apache.poi.hssf.model.FormulaParser;
 import org.apache.poi.hssf.model.Workbook;
 import org.apache.poi.hssf.record.CFRuleRecord;
@@ -40,9 +38,6 @@
 public final class HSSFConditionalFormattingRule
 {
     private static final byte CELL_COMPARISON = CFRuleRecord.CONDITION_TYPE_CELL_VALUE_IS;
- 
-
-
 
 	private final CFRuleRecord cfRuleRecord;
 	private final Workbook workbook;
@@ -73,6 +68,19 @@
 		FontFormatting block = fontFmt==null ? null : fontFmt.getFontFormattingBlock();
 		cfRuleRecord.setFontFormatting(block);
 	}
+	
+	/**
+	 * @return - font formatting object  if defined,  <code>null</code> otherwise
+	 */
+	public HSSFFontFormatting getFontFormatting()
+	{
+		FontFormatting ff = cfRuleRecord.getFontFormatting();
+		if ( ff == null ) {
+			return null;
+		}
+		return new HSSFFontFormatting(ff);
+	}
+	
 	/**
 	 * @param borderFmt pass <code>null</code> to signify 'border unchanged'
 	 */
@@ -82,6 +90,17 @@
 		cfRuleRecord.setBorderFormatting(block);
 	}
 	/**
+	 * @return - border formatting object  if defined,  <code>null</code> otherwise
+	 */
+	public HSSFBorderFormatting getBorderFormatting()
+	{
+		BorderFormatting bf = cfRuleRecord.getBorderFormatting();
+		if ( bf == null ) {
+			return null;
+		}
+		return new HSSFBorderFormatting(bf);
+	}
+	/**
 	 * @param patternFmt pass <code>null</code> to signify 'pattern unchanged'
 	 */
 	public void setPatternFormatting(HSSFPatternFormatting patternFmt)
@@ -89,6 +108,17 @@
 		PatternFormatting block = patternFmt==null ? null : patternFmt.getPatternFormattingBlock();
 		cfRuleRecord.setPatternFormatting(block);
 	}
+	/**
+	 * @return - pattern formatting object  if defined, <code>null</code> otherwise
+	 */
+	public HSSFPatternFormatting getPatternFormatting()
+	{
+		PatternFormatting pf = cfRuleRecord.getPatternFormatting();
+		if ( pf == null ) {
+			return null;
+		}
+		return new HSSFPatternFormatting(pf);
+	}
 	
 	public String getFormula1()
 	{
@@ -112,11 +142,9 @@
 
 	private String toFormulaString(Ptg[] parsedExpression)
 	{
-		String formula = null;
-		if(parsedExpression!=null)
-		{
-		formula = FormulaParser.toFormulaString(workbook, parsedExpression);
+		if(parsedExpression ==null) {
+			return null;
 		}
-		return formula;
+		return FormulaParser.toFormulaString(workbook, parsedExpression);
 	}
 }

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFFontFormatting.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFFontFormatting.java?rev=645483&r1=645482&r2=645483&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFFontFormatting.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFFontFormatting.java Mon Apr  7 05:51:50 2008
@@ -25,64 +25,51 @@
  * @author Dmitriy Kumshayev
  *
  */
-public class HSSFFontFormatting
+public final class HSSFFontFormatting
 {
-    /**
-     * Escapement type - None
-     */
-    public final static short     SS_NONE             = FontFormatting.SS_NONE;
+	/** Escapement type - None */
+	public final static short SS_NONE  = FontFormatting.SS_NONE;
+	/** Escapement type - Superscript */
+	public final static short SS_SUPER = FontFormatting.SS_SUPER;
+	/** Escapement type - Subscript */
+	public final static short SS_SUB   = FontFormatting.SS_SUB;
     
-    /**
-     * Escapement type - Superscript
-     */
-    public final static short     SS_SUPER            = FontFormatting.SS_SUPER;
+	/** Underline type - None */ 
+	public final static byte U_NONE              = FontFormatting.U_NONE;
+    /** Underline type - Single */ 
+	public final static byte U_SINGLE            = FontFormatting.U_SINGLE;
+    /** Underline type - Double */ 
+	public final static byte U_DOUBLE            = FontFormatting.U_DOUBLE;
+	/**  Underline type - Single Accounting */ 
+	public final static byte U_SINGLE_ACCOUNTING = FontFormatting.U_SINGLE_ACCOUNTING;
+    /** Underline type - Double Accounting */ 
+	public final static byte U_DOUBLE_ACCOUNTING = FontFormatting.U_DOUBLE_ACCOUNTING;
     
-    /**
-     * Escapement type - Subscript
-     */
-    public final static short     SS_SUB              = FontFormatting.SS_SUB;
-    
-    /**
-     *  Underline type - None
-     */ 
-    public final static byte      U_NONE              = FontFormatting.U_NONE;
-    /**
-     *  Underline type - Single
-     */ 
-    public final static byte      U_SINGLE            = FontFormatting.U_SINGLE;
-    /**
-     *  Underline type - Double
-     */ 
-    public final static byte      U_DOUBLE            = FontFormatting.U_DOUBLE;
-    /**
-     *  Underline type - Single Accounting
-     */ 
-    public final static byte      U_SINGLE_ACCOUNTING = FontFormatting.U_SINGLE_ACCOUNTING;
-    /**
-     *  Underline type - Double Accounting
-     */ 
-    public final static byte      U_DOUBLE_ACCOUNTING = FontFormatting.U_DOUBLE_ACCOUNTING;
-    
-	private FontFormatting fontFormatting;
+	private final FontFormatting fontFormatting;
 	
 	public HSSFFontFormatting()
 	{
 		fontFormatting = new FontFormatting();
 	}
 
+	protected HSSFFontFormatting(FontFormatting ff)
+	{
+		fontFormatting = ff;
+	}
+	
 	protected FontFormatting getFontFormattingBlock()
 	{
 		return fontFormatting;
 	}
 
-    /**
-     * get the type of super or subscript for the font
-     *
-     * @return super or subscript option
-     * @see #SS_NONE
-     * @see #SS_SUPER
-     * @see #SS_SUB
-     */
+	/**
+	 * get the type of super or subscript for the font
+	 *
+	 * @return super or subscript option
+	 * @see #SS_NONE
+	 * @see #SS_SUPER
+	 * @see #SS_SUB
+	 */
 	public short getEscapementType()
 	{
 		return fontFormatting.getEscapementType();
@@ -96,22 +83,22 @@
 		return fontFormatting.getFontColorIndex();
 	}
 
-    /**
-     * gets the height of the font in 1/20th point units
-     *
-     * @return fontheight (in points/20); or -1 if not modified
-     */
+	/**
+	 * gets the height of the font in 1/20th point units
+	 *
+	 * @return fontheight (in points/20); or -1 if not modified
+	 */
 	public short getFontHeight()
 	{
 		return fontFormatting.getFontHeight();
 	}
 
-    /**
-     * get the font weight for this font (100-1000dec or 0x64-0x3e8).  Default is
-     * 0x190 for normal and 0x2bc for bold
-     *
-     * @return bw - a number between 100-1000 for the fonts "boldness"
-     */
+	/**
+	 * get the font weight for this font (100-1000dec or 0x64-0x3e8).  Default is
+	 * 0x190 for normal and 0x2bc for bold
+	 *
+	 * @return bw - a number between 100-1000 for the fonts "boldness"
+	 */
 
 	public short getFontWeight()
 	{
@@ -127,38 +114,30 @@
 		return fontFormatting.getRawRecord();
 	}
 
-    /**
-     * get the type of underlining for the font
-     *
-     * @return font underlining type
-     *
-     * @see #U_NONE
-     * @see #U_SINGLE
-     * @see #U_DOUBLE
-     * @see #U_SINGLE_ACCOUNTING
-     * @see #U_DOUBLE_ACCOUNTING
-     */
+	/**
+	 * get the type of underlining for the font
+	 *
+	 * @return font underlining type
+	 *
+	 * @see #U_NONE
+	 * @see #U_SINGLE
+	 * @see #U_DOUBLE
+	 * @see #U_SINGLE_ACCOUNTING
+	 * @see #U_DOUBLE_ACCOUNTING
+	 */
 	public short getUnderlineType()
 	{
 		return fontFormatting.getUnderlineType();
 	}
 
-    /**
-     * get whether the font weight is set to bold or not
-     *
-     * @return bold - whether the font is bold or not
-     */
-	public boolean isBold()
-	{
-		return fontFormatting.isBold();
-	}
-
 	/**
-	 * @return  whether the font is condense or not
+	 * get whether the font weight is set to bold or not
+	 *
+	 * @return bold - whether the font is bold or not
 	 */
-	public boolean isCondenseOn()
+	public boolean isBold()
 	{
-		return fontFormatting.isFontOutlineModified() && fontFormatting.isCondenseOn();
+		return fontFormatting.isFontWeightModified() && fontFormatting.isBold();
 	}
 
 	/**
@@ -178,14 +157,6 @@
 	}
 
 	/**
-	 * @return true if font condense type was modified from default   
-	 */
-	public boolean isFontCondenseModified()
-	{
-		return fontFormatting.isFontCondenseModified();
-	}
-
-	/**
 	 * @return true if font outline type was modified from default   
 	 */
 	public boolean isFontOutlineModified()
@@ -249,66 +220,61 @@
 		return fontFormatting.isUnderlineTypeModified();
 	}
 
-    /**
-     * set font style options.
-     * 
-     * @param italic - if true, set posture style to italic, otherwise to normal 
-     * @param bold- if true, set font weight to bold, otherwise to normal
-     */
+	/**
+	 * @return true if font weight was modified from default   
+	 */
+	public boolean isFontWeightModified()
+	{
+		return fontFormatting.isFontWeightModified();
+	}
+
+	/**
+	 * set font style options.
+	 * 
+	 * @param italic - if true, set posture style to italic, otherwise to normal 
+	 * @param bold- if true, set font weight to bold, otherwise to normal
+	 */
 	
 	public void setFontStyle(boolean italic, boolean bold)
 	{
-    	boolean modified = italic || bold;
-    	fontFormatting.setItalic(italic);
-    	fontFormatting.setBold(bold);
-    	fontFormatting.setFontStyleModified(modified);
+		boolean modified = italic || bold;
+		fontFormatting.setItalic(italic);
+		fontFormatting.setBold(bold);
+		fontFormatting.setFontStyleModified(modified);
+		fontFormatting.setFontWieghtModified(modified);
 	}
 
-    /**
-     * set font style options to default values (non-italic, non-bold)
-     */
+	/**
+	 * set font style options to default values (non-italic, non-bold)
+	 */
 	public void resetFontStyle()
 	{
 		setFontStyle(false,false);
 	}
 
-    /**
-     * set the escapement type for the font
-     *
-     * @param escapementType  super or subscript option
-     * @see #SS_NONE
-     * @see #SS_SUPER
-     * @see #SS_SUB
-     */
-	public void setCondense(boolean on)
-	{
-		fontFormatting.setCondense(on);
-		fontFormatting.setFontCondenseModified(on);
-	}
-
-    /**
-     * set the escapement type for the font
-     *
-     * @param escapementType  super or subscript option
-     * @see #SS_NONE
-     * @see #SS_SUPER
-     * @see #SS_SUB
-     */
+	/**
+	 * set the escapement type for the font
+	 *
+	 * @param escapementType  super or subscript option
+	 * @see #SS_NONE
+	 * @see #SS_SUPER
+	 * @see #SS_SUB
+	 */
 	public void setEscapementType(short escapementType)
 	{
-    	switch(escapementType)
-    	{
-    		case HSSFFontFormatting.SS_SUB:
-    		case HSSFFontFormatting.SS_SUPER:
-    			fontFormatting.setEscapementType(escapementType);
-    			fontFormatting.setEscapementTypeModified(true);
-    	    	break;
-    		case HSSFFontFormatting.SS_NONE:
-    			fontFormatting.setEscapementType(escapementType);
-    			fontFormatting.setEscapementTypeModified(false);
-    	    	break;
-    		default:
-    	}
+		switch(escapementType)
+		{
+			case HSSFFontFormatting.SS_SUB:
+			case HSSFFontFormatting.SS_SUPER:
+				fontFormatting.setEscapementType(escapementType);
+				fontFormatting.setEscapementTypeModified(true);
+				break;
+			case HSSFFontFormatting.SS_NONE:
+				fontFormatting.setEscapementType(escapementType);
+				fontFormatting.setEscapementTypeModified(false);
+				break;
+			default:
+		}
 	}
 
 	/**
@@ -339,15 +305,6 @@
 	}
 
 	/**
-	 * @param modified
-	 * @see org.apache.poi.hssf.record.cf.FontFormatting#setFontCondenseModified(boolean)
-	 */
-	public void setFontCondenseModified(boolean modified)
-	{
-		fontFormatting.setFontCondenseModified(modified);
-	}
-
-	/**
 	 * @param height
 	 * @see org.apache.poi.hssf.record.cf.FontFormatting#setFontHeight(short)
 	 */
@@ -413,35 +370,35 @@
 		fontFormatting.setFontCancellationModified(strike);
 	}
 
-    /**
-     * set the type of underlining type for the font
-     *
-     * @param u  super or subscript option
-     *
-     * @see #U_NONE
-     * @see #U_SINGLE
-     * @see #U_DOUBLE
-     * @see #U_SINGLE_ACCOUNTING
-     * @see #U_DOUBLE_ACCOUNTING
-     */
+	/**
+	 * set the type of underlining type for the font
+	 *
+	 * @param u  super or subscript option
+	 *
+	 * @see #U_NONE
+	 * @see #U_SINGLE
+	 * @see #U_DOUBLE
+	 * @see #U_SINGLE_ACCOUNTING
+	 * @see #U_DOUBLE_ACCOUNTING
+	 */
 	public void setUnderlineType(short underlineType)
 	{
-    	switch(underlineType)
-    	{
-    		case HSSFFontFormatting.U_SINGLE:
-    		case HSSFFontFormatting.U_DOUBLE:
-    		case HSSFFontFormatting.U_SINGLE_ACCOUNTING:
-    		case HSSFFontFormatting.U_DOUBLE_ACCOUNTING:
-    			fontFormatting.setUnderlineType(underlineType);
-    	    	setUnderlineTypeModified(true);
-    	    	break;
-    			
-    		case HSSFFontFormatting.U_NONE:
-    			fontFormatting.setUnderlineType(underlineType);
-    	    	setUnderlineTypeModified(false);
-    	    	break;
-    	    default:
-    	}
+		switch(underlineType)
+		{
+			case HSSFFontFormatting.U_SINGLE:
+			case HSSFFontFormatting.U_DOUBLE:
+			case HSSFFontFormatting.U_SINGLE_ACCOUNTING:
+			case HSSFFontFormatting.U_DOUBLE_ACCOUNTING:
+				fontFormatting.setUnderlineType(underlineType);
+				setUnderlineTypeModified(true);
+				break;
+				
+			case HSSFFontFormatting.U_NONE:
+				fontFormatting.setUnderlineType(underlineType);
+				setUnderlineTypeModified(false);
+				break;
+			default:
+		}
 	}
 
 	/**
@@ -452,5 +409,4 @@
 	{
 		fontFormatting.setUnderlineTypeModified(modified);
 	}
-	
 }

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFPatternFormatting.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFPatternFormatting.java?rev=645483&r1=645482&r2=645483&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFPatternFormatting.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFPatternFormatting.java Mon Apr  7 05:51:50 2008
@@ -27,50 +27,54 @@
  */
 public class HSSFPatternFormatting
 {
-    /**  No background */
-    public final static short NO_FILL 				=  PatternFormatting.NO_FILL;
-    /**  Solidly filled */
-    public final static short SOLID_FOREGROUND 		=  PatternFormatting.SOLID_FOREGROUND;
-    /**  Small fine dots */
-    public final static short FINE_DOTS 			=  PatternFormatting.FINE_DOTS;
-    /**  Wide dots */
-    public final static short ALT_BARS 				=  PatternFormatting.ALT_BARS;
-    /**  Sparse dots */
-    public final static short SPARSE_DOTS 			=  PatternFormatting.SPARSE_DOTS;
-    /**  Thick horizontal bands */
-    public final static short THICK_HORZ_BANDS 		=  PatternFormatting.THICK_HORZ_BANDS;
-    /**  Thick vertical bands */
-    public final static short THICK_VERT_BANDS 		=  PatternFormatting.THICK_VERT_BANDS;
-    /**  Thick backward facing diagonals */
-    public final static short THICK_BACKWARD_DIAG 	=  PatternFormatting.THICK_BACKWARD_DIAG;
-    /**  Thick forward facing diagonals */
-    public final static short THICK_FORWARD_DIAG 	=  PatternFormatting.THICK_FORWARD_DIAG;
-    /**  Large spots */
-    public final static short BIG_SPOTS 			=  PatternFormatting.BIG_SPOTS;
-    /**  Brick-like layout */
-    public final static short BRICKS 				=  PatternFormatting.BRICKS;
-    /**  Thin horizontal bands */
-    public final static short THIN_HORZ_BANDS 		=  PatternFormatting.THIN_HORZ_BANDS;
-    /**  Thin vertical bands */
-    public final static short THIN_VERT_BANDS 		=  PatternFormatting.THIN_VERT_BANDS;
-    /**  Thin backward diagonal */
-    public final static short THIN_BACKWARD_DIAG 	=  PatternFormatting.THIN_BACKWARD_DIAG;
-    /**  Thin forward diagonal */
-    public final static short THIN_FORWARD_DIAG 	=  PatternFormatting.THIN_FORWARD_DIAG;
-    /**  Squares */
-    public final static short SQUARES 				=  PatternFormatting.SQUARES;
-    /**  Diamonds */
-    public final static short DIAMONDS 				=  PatternFormatting.DIAMONDS;
-    /**  Less Dots */
-    public final static short LESS_DOTS 			=  PatternFormatting.LESS_DOTS;
-    /**  Least Dots */
-    public final static short LEAST_DOTS 			=  PatternFormatting.LEAST_DOTS;
+	/**  No background */
+	public final static short NO_FILL 				=  PatternFormatting.NO_FILL;
+	/**  Solidly filled */
+	public final static short SOLID_FOREGROUND 		=  PatternFormatting.SOLID_FOREGROUND;
+	/**  Small fine dots */
+	public final static short FINE_DOTS 			=  PatternFormatting.FINE_DOTS;
+	/**  Wide dots */
+	public final static short ALT_BARS 				=  PatternFormatting.ALT_BARS;
+	/**  Sparse dots */
+	public final static short SPARSE_DOTS 			=  PatternFormatting.SPARSE_DOTS;
+	/**  Thick horizontal bands */
+	public final static short THICK_HORZ_BANDS 		=  PatternFormatting.THICK_HORZ_BANDS;
+	/**  Thick vertical bands */
+	public final static short THICK_VERT_BANDS 		=  PatternFormatting.THICK_VERT_BANDS;
+	/**  Thick backward facing diagonals */
+	public final static short THICK_BACKWARD_DIAG 	=  PatternFormatting.THICK_BACKWARD_DIAG;
+	/**  Thick forward facing diagonals */
+	public final static short THICK_FORWARD_DIAG 	=  PatternFormatting.THICK_FORWARD_DIAG;
+	/**  Large spots */
+	public final static short BIG_SPOTS 			=  PatternFormatting.BIG_SPOTS;
+	/**  Brick-like layout */
+	public final static short BRICKS 				=  PatternFormatting.BRICKS;
+	/**  Thin horizontal bands */
+	public final static short THIN_HORZ_BANDS 		=  PatternFormatting.THIN_HORZ_BANDS;
+	/**  Thin vertical bands */
+	public final static short THIN_VERT_BANDS 		=  PatternFormatting.THIN_VERT_BANDS;
+	/**  Thin backward diagonal */
+	public final static short THIN_BACKWARD_DIAG 	=  PatternFormatting.THIN_BACKWARD_DIAG;
+	/**  Thin forward diagonal */
+	public final static short THIN_FORWARD_DIAG 	=  PatternFormatting.THIN_FORWARD_DIAG;
+	/**  Squares */
+	public final static short SQUARES 				=  PatternFormatting.SQUARES;
+	/**  Diamonds */
+	public final static short DIAMONDS 				=  PatternFormatting.DIAMONDS;
+	/**  Less Dots */
+	public final static short LESS_DOTS 			=  PatternFormatting.LESS_DOTS;
+	/**  Least Dots */
+	public final static short LEAST_DOTS 			=  PatternFormatting.LEAST_DOTS;
 
 	private PatternFormatting patternFormatting;
 	
 	public HSSFPatternFormatting()
 	{
 		patternFormatting = new PatternFormatting();
+	}
+	protected HSSFPatternFormatting(PatternFormatting patternFormatting)
+	{
+		this.patternFormatting = patternFormatting;
 	}
 
 	protected PatternFormatting getPatternFormattingBlock()

Modified: poi/branches/ooxml/src/java/org/apache/poi/util/HexRead.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/util/HexRead.java?rev=645483&r1=645482&r2=645483&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/util/HexRead.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/util/HexRead.java Mon Apr  7 05:51:50 2008
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,7 +14,6 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.util;
 
@@ -25,6 +23,7 @@
 
 /**
  * Utilities to read hex from files.
+ * TODO - move to test packages
  *
  * @author Marc Johnson
  * @author Glen Stampoultzis (glens at apache.org)
@@ -62,10 +61,8 @@
      *
      * @see #readData(String)
      */
-    public static byte[] readData( String filename, String section ) throws IOException
-    {
-        File file = new File( filename );
-        FileInputStream stream = new FileInputStream( file );
+    public static byte[] readData(InputStream stream, String section ) throws IOException {
+    	
         try
         {
             StringBuffer sectionText = new StringBuffer();
@@ -99,6 +96,12 @@
             stream.close();
         }
         throw new IOException( "Section '" + section + "' not found" );
+    }
+    public static byte[] readData( String filename, String section ) throws IOException
+    {
+        File file = new File( filename );
+        FileInputStream stream = new FileInputStream( file );
+        return readData(stream, section);
     }
 
     static public byte[] readData( InputStream stream, int eofChar )

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/TestPOIDocumentMain.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/TestPOIDocumentMain.java?rev=645483&r1=645482&r2=645483&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/TestPOIDocumentMain.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/TestPOIDocumentMain.java Mon Apr  7 05:51:50 2008
@@ -15,17 +15,17 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
-
 
 package org.apache.poi;
 
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
 import junit.framework.TestCase;
-import java.io.*;
 
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.poifs.filesystem.*;
+import org.apache.poi.hssf.HSSFTestDataSamples;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 
 /**
  * Tests that POIDocument correctly loads and saves the common
@@ -36,85 +36,73 @@
  *
  * @author Nick Burch (nick at torchbox dot com)
  */
-public class TestPOIDocumentMain extends TestCase {
+public final class TestPOIDocumentMain extends TestCase {
 	// The POI Documents to work on
 	private POIDocument doc;
 	private POIDocument doc2;
-	// POIFS primed on the test (two different hssf) data
-	private POIFSFileSystem pfs;
-	private POIFSFileSystem pfs2;
 
 	/**
-	 * Set things up, using a PowerPoint document and 
-	 *  a Word Document for our testing
+	 * Set things up, two spreadsheets for our testing
 	 */
-    public void setUp() throws Exception {
-		String dirnameHSSF = System.getProperty("HSSF.testdata.path");
-		String filenameHSSF = dirnameHSSF + "/DateFormats.xls";
-		String filenameHSSF2 = dirnameHSSF + "/StringFormulas.xls";
-		
-		FileInputStream fisHSSF = new FileInputStream(filenameHSSF);
-		pfs = new POIFSFileSystem(fisHSSF);
-		doc = new HSSFWorkbook(pfs);
-		
-		FileInputStream fisHSSF2 = new FileInputStream(filenameHSSF2);
-		pfs2 = new POIFSFileSystem(fisHSSF2);
-		doc2 = new HSSFWorkbook(pfs2);
+	public void setUp() {
+		
+		doc = HSSFTestDataSamples.openSampleWorkbook("DateFormats.xls");
+		doc2 = HSSFTestDataSamples.openSampleWorkbook("StringFormulas.xls");
+	}
+	
+	public void testReadProperties() throws Exception {
+		// We should have both sets
+		assertNotNull(doc.getDocumentSummaryInformation());
+		assertNotNull(doc.getSummaryInformation());
+		
+		// Check they are as expected for the test doc
+		assertEquals("Administrator", doc.getSummaryInformation().getAuthor());
+		assertEquals(0, doc.getDocumentSummaryInformation().getByteCount());
+	}
+		
+	public void testReadProperties2() throws Exception {	
+		// Check again on the word one
+		assertNotNull(doc2.getDocumentSummaryInformation());
+		assertNotNull(doc2.getSummaryInformation());
+		
+		assertEquals("Avik Sengupta", doc2.getSummaryInformation().getAuthor());
+		assertEquals(null, doc2.getSummaryInformation().getKeywords());
+		assertEquals(0, doc2.getDocumentSummaryInformation().getByteCount());
 	}
-    
-    public void testReadProperties() throws Exception {
-    	// We should have both sets
-    	assertNotNull(doc.getDocumentSummaryInformation());
-    	assertNotNull(doc.getSummaryInformation());
-    	
-    	// Check they are as expected for the test doc
-    	assertEquals("Administrator", doc.getSummaryInformation().getAuthor());
-    	assertEquals(0, doc.getDocumentSummaryInformation().getByteCount());
-    }
-    	
-    public void testReadProperties2() throws Exception {	
-    	// Check again on the word one
-    	assertNotNull(doc2.getDocumentSummaryInformation());
-    	assertNotNull(doc2.getSummaryInformation());
-    	
-    	assertEquals("Avik Sengupta", doc2.getSummaryInformation().getAuthor());
-    	assertEquals(null, doc2.getSummaryInformation().getKeywords());
-    	assertEquals(0, doc2.getDocumentSummaryInformation().getByteCount());
-    }
-
-    public void testWriteProperties() throws Exception {
-    	// Just check we can write them back out into a filesystem
-    	POIFSFileSystem outFS = new POIFSFileSystem();
-    	doc.readProperties();
-        doc.writeProperties(outFS);
-    	
-    	// Should now hold them
-    	assertNotNull(
-    			outFS.createDocumentInputStream("\005SummaryInformation")
-    	);
-    	assertNotNull(
-    			outFS.createDocumentInputStream("\005DocumentSummaryInformation")
-    	);
-    }
 
-    public void testWriteReadProperties() throws Exception {
+	public void testWriteProperties() throws Exception {
+		// Just check we can write them back out into a filesystem
+		POIFSFileSystem outFS = new POIFSFileSystem();
+		doc.readProperties();
+		doc.writeProperties(outFS);
+		
+		// Should now hold them
+		assertNotNull(
+				outFS.createDocumentInputStream("\005SummaryInformation")
+		);
+		assertNotNull(
+				outFS.createDocumentInputStream("\005DocumentSummaryInformation")
+		);
+	}
+
+	public void testWriteReadProperties() throws Exception {
 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
 		
-    	// Write them out
-    	POIFSFileSystem outFS = new POIFSFileSystem();
-    	doc.readProperties();
-        doc.writeProperties(outFS);
-    	outFS.writeFilesystem(baos);
-    	
-    	// Create a new version
-    	ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-    	POIFSFileSystem inFS = new POIFSFileSystem(bais);
-    	
-    	// Check they're still there
-    	doc.filesystem = inFS;
-    	doc.readProperties();
-    	
-    	// Delegate test
-    	testReadProperties();
-    }
+		// Write them out
+		POIFSFileSystem outFS = new POIFSFileSystem();
+		doc.readProperties();
+		doc.writeProperties(outFS);
+		outFS.writeFilesystem(baos);
+		
+		// Create a new version
+		ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+		POIFSFileSystem inFS = new POIFSFileSystem(bais);
+		
+		// Check they're still there
+		doc.filesystem = inFS;
+		doc.readProperties();
+		
+		// Delegate test
+		testReadProperties();
+	}
 }

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java?rev=645483&r1=645482&r2=645483&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java Mon Apr  7 05:51:50 2008
@@ -16,109 +16,108 @@
 ==================================================================== */
 
 package org.apache.poi.hssf.eventusermodel;
-import org.apache.poi.hssf.eventusermodel.HSSFEventFactory;
-import org.apache.poi.hssf.eventusermodel.HSSFListener;
-
-import java.io.File;
-import java.io.FileInputStream;
+import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
 
+import org.apache.poi.hssf.HSSFTestDataSamples;
+import org.apache.poi.hssf.record.ContinueRecord;
 import org.apache.poi.hssf.record.DVALRecord;
 import org.apache.poi.hssf.record.DVRecord;
 import org.apache.poi.hssf.record.EOFRecord;
 import org.apache.poi.hssf.record.Record;
-import org.apache.poi.hssf.record.ContinueRecord;
 import org.apache.poi.hssf.record.SelectionRecord;
 import org.apache.poi.hssf.record.WindowTwoRecord;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
-
-import junit.framework.TestCase;
-
-public class TestHSSFEventFactory extends TestCase {
-	private String dirname;
+/**
+ * 
+ */
+public final class TestHSSFEventFactory extends TestCase {
 	
-	public TestHSSFEventFactory() {
-		dirname = System.getProperty("HSSF.testdata.path");
+	private static final InputStream openSample(String sampleFileName) {
+		return HSSFTestDataSamples.openSampleFileStream(sampleFileName);
 	}
 
 	public void testWithMissingRecords() throws Exception {
-		File f = new File(dirname + "/SimpleWithSkip.xls");
 
 		HSSFRequest req = new HSSFRequest();
 		MockHSSFListener mockListen = new MockHSSFListener();
 		req.addListenerForAllRecords(mockListen);
 		
-		POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(f));
+		POIFSFileSystem fs = new POIFSFileSystem(openSample("SimpleWithSkip.xls"));
 		HSSFEventFactory factory = new HSSFEventFactory();
 		factory.processWorkbookEvents(req, fs);
 
+		Record[] recs = mockListen.getRecords();
 		// Check we got the records
-		System.out.println("Processed, found " + mockListen.records.size() + " records");
-		assertTrue( mockListen.records.size() > 100 );
+		assertTrue( recs.length > 100 );
 		
 		// Check that the last few records are as we expect
 		// (Makes sure we don't accidently skip the end ones)
-		int numRec = mockListen.records.size();
-		assertEquals(WindowTwoRecord.class, mockListen.records.get(numRec-3).getClass());
-		assertEquals(SelectionRecord.class, mockListen.records.get(numRec-2).getClass());
-		assertEquals(EOFRecord.class,       mockListen.records.get(numRec-1).getClass());
+		int numRec = recs.length;
+		assertEquals(WindowTwoRecord.class, recs[numRec-3].getClass());
+		assertEquals(SelectionRecord.class, recs[numRec-2].getClass());
+		assertEquals(EOFRecord.class,	   recs[numRec-1].getClass());
 	}
 
 	public void testWithCrazyContinueRecords() throws Exception {
 		// Some files have crazy ordering of their continue records
 		// Check that we don't break on them (bug #42844)
-
-		File f = new File(dirname + "/ContinueRecordProblem.xls");
 		
 		HSSFRequest req = new HSSFRequest();
 		MockHSSFListener mockListen = new MockHSSFListener();
 		req.addListenerForAllRecords(mockListen);
 		
-		POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(f));
+		POIFSFileSystem fs = new POIFSFileSystem(openSample("ContinueRecordProblem.xls"));
 		HSSFEventFactory factory = new HSSFEventFactory();
 		factory.processWorkbookEvents(req, fs);
 
+		Record[] recs = mockListen.getRecords();
 		// Check we got the records
-		System.out.println("Processed, found " + mockListen.records.size() + " records");
-		assertTrue( mockListen.records.size() > 100 );
+		assertTrue( recs.length > 100 );
 
 		// And none of them are continue ones
-		Record[] r = (Record[])mockListen.records.toArray( 
-							new Record[mockListen.records.size()] );
-		for(int i=0; i<r.length; i++) {
-			assertFalse( r[i] instanceof ContinueRecord );
+		for(int i=0; i<recs.length; i++) {
+			assertFalse( recs[i] instanceof ContinueRecord );
 		}
 		
 		// Check that the last few records are as we expect
 		// (Makes sure we don't accidently skip the end ones)
-		int numRec = mockListen.records.size();
-		assertEquals(DVALRecord.class, mockListen.records.get(numRec-3).getClass());
-		assertEquals(DVRecord.class, mockListen.records.get(numRec-2).getClass());
-		assertEquals(EOFRecord.class,       mockListen.records.get(numRec-1).getClass());
+		int numRec = recs.length;
+		assertEquals(DVALRecord.class, recs[numRec-3].getClass());
+		assertEquals(DVRecord.class,  recs[numRec-2].getClass());
+		assertEquals(EOFRecord.class, recs[numRec-1].getClass());
 	}
 
-    /**
-     * Unknown records can be continued.
-     * Check that HSSFEventFactory doesn't break on them.
-     * (the test file was provided in a reopen of bug #42844)
-     */
-    public void testUnknownContinueRecords() throws Exception {
-         File f = new File(dirname + "/42844.xls");
-
-        HSSFRequest req = new HSSFRequest();
-        MockHSSFListener mockListen = new MockHSSFListener();
-        req.addListenerForAllRecords(mockListen);
-
-        POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(f));
-        HSSFEventFactory factory = new HSSFEventFactory();
-        factory.processWorkbookEvents(req, fs);
+	/**
+	 * Unknown records can be continued.
+	 * Check that HSSFEventFactory doesn't break on them.
+	 * (the test file was provided in a reopen of bug #42844)
+	 */
+	public void testUnknownContinueRecords() throws Exception {
 
-        assertTrue("no errors while processing the file", true);
-    }
+		HSSFRequest req = new HSSFRequest();
+		MockHSSFListener mockListen = new MockHSSFListener();
+		req.addListenerForAllRecords(mockListen);
+
+		POIFSFileSystem fs = new POIFSFileSystem(openSample("42844.xls"));
+		HSSFEventFactory factory = new HSSFEventFactory();
+		factory.processWorkbookEvents(req, fs);
+
+		assertTrue("no errors while processing the file", true);
+	}
 
 	private static class MockHSSFListener implements HSSFListener {
-		private MockHSSFListener() {}
-		private ArrayList records = new ArrayList();
+		private final List records = new ArrayList();
+
+		public MockHSSFListener() {}
+		public Record[] getRecords() {
+			Record[] result = new Record[records.size()];
+			records.toArray(result);
+			return result;
+		}
 
 		public void processRecord(Record record) {
 			records.add(record);

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java?rev=645483&r1=645482&r2=645483&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java Mon Apr  7 05:51:50 2008
@@ -19,11 +19,13 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
 
 import junit.framework.TestCase;
 
+import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.eventusermodel.dummyrecord.LastCellOfRowDummyRecord;
 import org.apache.poi.hssf.eventusermodel.dummyrecord.MissingCellDummyRecord;
 import org.apache.poi.hssf.eventusermodel.dummyrecord.MissingRowDummyRecord;
@@ -39,8 +41,6 @@
 	private Record[] r;
 
 	public void setUp() {
-		String dirname = System.getProperty("HSSF.testdata.path");
-		File f = new File(dirname + "/MissingBits.xls");
 
 		HSSFRequest req = new HSSFRequest();
 		MockHSSFListener mockListen = new MockHSSFListener();
@@ -49,7 +49,8 @@
 		
 		HSSFEventFactory factory = new HSSFEventFactory();
 		try {
-			POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(f));
+			InputStream is = HSSFTestDataSamples.openSampleFileStream("MissingBits.xls");
+			POIFSFileSystem fs = new POIFSFileSystem(is);
 			factory.processWorkbookEvents(req, fs);
 		} catch (IOException e) {
 			throw new RuntimeException(e);

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/extractor/TestExcelExtractor.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/extractor/TestExcelExtractor.java?rev=645483&r1=645482&r2=645483&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/extractor/TestExcelExtractor.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/extractor/TestExcelExtractor.java Mon Apr  7 05:51:50 2008
@@ -14,21 +14,36 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-package org.apache.poi.hssf.extractor;
 
-import java.io.File;
-import java.io.FileInputStream;
+package org.apache.poi.hssf.extractor;
 
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import java.io.IOException;
+import java.io.InputStream;
 
 import junit.framework.TestCase;
 
-public class TestExcelExtractor extends TestCase {
-	public void testSimple() throws Exception {
-		String path = System.getProperty("HSSF.testdata.path");
-		FileInputStream fin = new FileInputStream(path + File.separator + "Simple.xls");
+import org.apache.poi.hssf.HSSFTestDataSamples;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+/**
+ * 
+ */
+public final class TestExcelExtractor extends TestCase {
+
+	private static final ExcelExtractor createExtractor(String sampleFileName) {
+		
+		InputStream is = HSSFTestDataSamples.openSampleFileStream(sampleFileName);
+		
+		try {
+			return new ExcelExtractor(new POIFSFileSystem(is));
+		} catch (IOException e) {
+			throw new RuntimeException(e);
+		}
+	}
+	
+	
+	public void testSimple() {
 		
-		ExcelExtractor extractor = new ExcelExtractor(new POIFSFileSystem(fin));
+		ExcelExtractor extractor = createExtractor("Simple.xls");
 		
 		assertEquals("Sheet1\nreplaceMe\nSheet2\nSheet3\n", extractor.getText());
 		
@@ -37,11 +52,9 @@
 		assertEquals("replaceMe\n", extractor.getText());
 	}
 	
-	public void testNumericFormula() throws Exception {
-		String path = System.getProperty("HSSF.testdata.path");
-		FileInputStream fin = new FileInputStream(path + File.separator + "sumifformula.xls");
+	public void testNumericFormula() {
 		
-		ExcelExtractor extractor = new ExcelExtractor(new POIFSFileSystem(fin));
+		ExcelExtractor extractor = createExtractor("sumifformula.xls");
 		
 		assertEquals(
 				"Sheet1\n" +
@@ -68,11 +81,9 @@
 		);
 	}
 	
-	public void testwithContinueRecords() throws Exception {
-		String path = System.getProperty("HSSF.testdata.path");
-		FileInputStream fin = new FileInputStream(path + File.separator + "StringContinueRecords.xls");
+	public void testwithContinueRecords() {
 		
-		ExcelExtractor extractor = new ExcelExtractor(new POIFSFileSystem(fin));
+		ExcelExtractor extractor = createExtractor("StringContinueRecords.xls");
 		
 		extractor.getText();
 		
@@ -82,11 +93,9 @@
 		assertTrue(extractor.getText().length() > 40960);
 	}
 	
-	public void testStringConcat() throws Exception {
-		String path = System.getProperty("HSSF.testdata.path");
-		FileInputStream fin = new FileInputStream(path + File.separator + "SimpleWithFormula.xls");
+	public void testStringConcat() {
 		
-		ExcelExtractor extractor = new ExcelExtractor(new POIFSFileSystem(fin));
+		ExcelExtractor extractor = createExtractor("SimpleWithFormula.xls");
 		
 		// Comes out as NaN if treated as a number
 		// And as XYZ if treated as a string
@@ -97,11 +106,9 @@
 		assertEquals("Sheet1\nreplaceme\nreplaceme\nCONCATENATE(A1,A2)\nSheet2\nSheet3\n", extractor.getText());
 	}
 	
-	public void testStringFormula() throws Exception {
-		String path = System.getProperty("HSSF.testdata.path");
-		FileInputStream fin = new FileInputStream(path + File.separator + "StringFormulas.xls");
+	public void testStringFormula() {
 		
-		ExcelExtractor extractor = new ExcelExtractor(new POIFSFileSystem(fin));
+		ExcelExtractor extractor = createExtractor("StringFormulas.xls");
 		
 		// Comes out as NaN if treated as a number
 		// And as XYZ if treated as a string

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestBOFRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestBOFRecord.java?rev=645483&r1=645482&r2=645483&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestBOFRecord.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestBOFRecord.java Mon Apr  7 05:51:50 2008
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,36 +14,28 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.hssf.record;
 
-import java.io.File;
-import java.io.FileInputStream;
-
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import java.io.InputStream;
 
+import junit.framework.AssertionFailedError;
 import junit.framework.TestCase;
 
-public class TestBOFRecord extends TestCase
-{
-    private String _test_file_path;
-    private static final String _test_file_path_property = "HSSF.testdata.path";
-
-    public TestBOFRecord()
-    {
-        super();
-        _test_file_path = System.getProperty( _test_file_path_property ) +
-        	File.separator + "bug_42794.xls";
-    }
-
+import org.apache.poi.hssf.HSSFTestDataSamples;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+/**
+ * 
+ */
+public final class TestBOFRecord extends TestCase {
     public void testBOFRecord() throws Exception {
-    	POIFSFileSystem fs = new POIFSFileSystem(
-    			new FileInputStream(_test_file_path)
-    	);
-    	
-    	// This used to throw an error before
-    	HSSFWorkbook hssf = new HSSFWorkbook(fs);
+        InputStream is = HSSFTestDataSamples.openSampleFileStream("bug_42794.xls");
+        
+        // This used to throw an error before
+        try {
+            new HSSFWorkbook(is);
+        } catch (ArrayIndexOutOfBoundsException e) {
+            throw new AssertionFailedError("Identified bug 42794");
+        }
     }
 }

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestCFRuleRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestCFRuleRecord.java?rev=645483&r1=645482&r2=645483&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestCFRuleRecord.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestCFRuleRecord.java Mon Apr  7 05:51:50 2008
@@ -182,14 +182,13 @@
 		// Check for defaults
 		assertFalse(fontFormatting.isEscapementTypeModified());
 		assertFalse(fontFormatting.isFontCancellationModified());
-		assertFalse(fontFormatting.isFontCondenseModified());
 		assertFalse(fontFormatting.isFontOutlineModified());
 		assertFalse(fontFormatting.isFontShadowModified());
 		assertFalse(fontFormatting.isFontStyleModified());
 		assertFalse(fontFormatting.isUnderlineTypeModified());
+		assertFalse(fontFormatting.isFontWeightModified());
 
 		assertFalse(fontFormatting.isBold());
-		assertFalse(fontFormatting.isCondenseOn());
 		assertFalse(fontFormatting.isItalic());
 		assertFalse(fontFormatting.isOutlineOn());
 		assertFalse(fontFormatting.isShadowOn());
@@ -198,7 +197,7 @@
 		assertEquals(0, fontFormatting.getEscapementType());
 		assertEquals(-1, fontFormatting.getFontColorIndex());
 		assertEquals(-1, fontFormatting.getFontHeight());
-		assertEquals(400, fontFormatting.getFontWeight());
+		assertEquals(0, fontFormatting.getFontWeight());
 		assertEquals(0, fontFormatting.getUnderlineType());
 
 		fontFormatting.setBold(true);
@@ -206,11 +205,6 @@
 		fontFormatting.setBold(false);
 		assertFalse(fontFormatting.isBold());
 
-		fontFormatting.setCondense(true);
-		assertTrue(fontFormatting.isCondenseOn());
-		fontFormatting.setCondense(false);
-		assertFalse(fontFormatting.isCondenseOn());
-
 		fontFormatting.setEscapementType(FontFormatting.SS_SUB);
 		assertEquals(FontFormatting.SS_SUB, fontFormatting.getEscapementType());
 		fontFormatting.setEscapementType(FontFormatting.SS_SUPER);
@@ -223,6 +217,11 @@
 		fontFormatting.setEscapementTypeModified(true);
 		assertTrue(fontFormatting.isEscapementTypeModified());
 
+		fontFormatting.setFontWieghtModified(false);
+		assertFalse(fontFormatting.isFontWeightModified());
+		fontFormatting.setFontWieghtModified(true);
+		assertTrue(fontFormatting.isFontWeightModified());
+
 		fontFormatting.setFontCancellationModified(false);
 		assertFalse(fontFormatting.isFontCancellationModified());
 		fontFormatting.setFontCancellationModified(true);
@@ -230,11 +229,6 @@
 
 		fontFormatting.setFontColorIndex((short)10);
 		assertEquals(10,fontFormatting.getFontColorIndex());
-
-		fontFormatting.setFontCondenseModified(false);
-		assertFalse(fontFormatting.isFontCondenseModified());
-		fontFormatting.setFontCondenseModified(true);
-		assertTrue(fontFormatting.isFontCondenseModified());
 
 		fontFormatting.setFontHeight((short)100);
 		assertEquals(100,fontFormatting.getFontHeight());

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestChartTitleFormatRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestChartTitleFormatRecord.java?rev=645483&r1=645482&r2=645483&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestChartTitleFormatRecord.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestChartTitleFormatRecord.java Mon Apr  7 05:51:50 2008
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,65 +14,57 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.hssf.record;
 
-import java.io.File;
-import java.io.FileInputStream;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
 
+import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.eventusermodel.HSSFEventFactory;
 import org.apache.poi.hssf.eventusermodel.HSSFListener;
 import org.apache.poi.hssf.eventusermodel.HSSFRequest;
-import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
-
-import junit.framework.TestCase;
-
-public class TestChartTitleFormatRecord extends TestCase
-{
-    private String _test_file_path;
-    private static final String _test_file_path_property = "HSSF.testdata.path";
-
-    public TestChartTitleFormatRecord()
-    {
-        super();
-        _test_file_path = System.getProperty( _test_file_path_property ) +
-        	File.separator + "WithFormattedGraphTitle.xls";
-    }
-
-    public void testRecord() throws Exception {
-    	POIFSFileSystem fs = new POIFSFileSystem(
-    			new FileInputStream(_test_file_path)
-    	);
-    	
-    	// Check we can open the file via usermodel
-    	HSSFWorkbook hssf = new HSSFWorkbook(fs);
-    	
-    	// Now process it through eventusermodel, and
-    	//  look out for the title records
-    	ChartTitleFormatRecordGrabber grabber =
-    		new ChartTitleFormatRecordGrabber();
-    	InputStream din = fs.createDocumentInputStream("Workbook");
-        HSSFRequest req = new HSSFRequest();
-        req.addListenerForAllRecords(grabber);
-        HSSFEventFactory factory = new HSSFEventFactory();
-        factory.processEvents(req, din);
-        din.close();
-        
-        // Should've found one
-        assertEquals(1, grabber.chartTitleFormatRecords.size());
-        // And it should be of something interesting
-        ChartTitleFormatRecord r =
-        	(ChartTitleFormatRecord)grabber.chartTitleFormatRecords.get(0);
-        assertEquals(3, r.getFormatCount());
-    }
-    
-    public static class ChartTitleFormatRecordGrabber implements HSSFListener {
-    	private ArrayList chartTitleFormatRecords = new ArrayList();
+/**
+ * 
+ */
+public final class TestChartTitleFormatRecord extends TestCase {
+
+	public void testRecord() throws Exception {
+		POIFSFileSystem fs = new POIFSFileSystem(
+				HSSFTestDataSamples.openSampleFileStream("WithFormattedGraphTitle.xls"));
+		
+		// Check we can open the file via usermodel
+		HSSFWorkbook hssf = new HSSFWorkbook(fs);
+		
+		// Now process it through eventusermodel, and
+		//  look out for the title records
+		ChartTitleFormatRecordGrabber grabber = new ChartTitleFormatRecordGrabber();
+		InputStream din = fs.createDocumentInputStream("Workbook");
+		HSSFRequest req = new HSSFRequest();
+		req.addListenerForAllRecords(grabber);
+		HSSFEventFactory factory = new HSSFEventFactory();
+		factory.processEvents(req, din);
+		din.close();
+		
+		// Should've found one
+		assertEquals(1, grabber.chartTitleFormatRecords.size());
+		// And it should be of something interesting
+		ChartTitleFormatRecord r =
+			(ChartTitleFormatRecord)grabber.chartTitleFormatRecords.get(0);
+		assertEquals(3, r.getFormatCount());
+	}
+	
+	private static final class ChartTitleFormatRecordGrabber implements HSSFListener {
+		private final List chartTitleFormatRecords;
+		
+		public ChartTitleFormatRecordGrabber() {
+			chartTitleFormatRecords = new ArrayList();
+		}
 
 		public void processRecord(Record record) {
 			if(record instanceof ChartTitleFormatRecord) {
@@ -82,6 +73,6 @@
 				);
 			}
 		}
-    	
-    }
+		
+	}
 }

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestFormulaRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestFormulaRecord.java?rev=645483&r1=645482&r2=645483&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestFormulaRecord.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestFormulaRecord.java Mon Apr  7 05:51:50 2008
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,8 +14,6 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
-
 
 package org.apache.poi.hssf.record;
 
@@ -39,36 +36,29 @@
  *
  * @author Andrew C. Oliver 
  */
-public class TestFormulaRecord
-        extends TestCase
-{
-
-    public TestFormulaRecord(String name)
-    {
-        super(name);
-    }
-
-    public void testCreateFormulaRecord () {
-        FormulaRecord record = new FormulaRecord();
-        record.setColumn((short)0);
-        //record.setRow((short)1);
-        record.setRow(1);
-        record.setXFIndex((short)4);
-        
-        assertEquals(record.getColumn(),(short)0);
-        //assertEquals(record.getRow(),(short)1);
-        assertEquals((short)record.getRow(),(short)1);
-        assertEquals(record.getXFIndex(),(short)4);
-    }
-    
-    /**
-     * Make sure a NAN value is preserved
-     * This formula record is a representation of =1/0 at row 0, column 0 
-     */
-    public void testCheckNanPreserve() {
-    	byte[] formulaByte = new byte[29];
-    	for (int i = 0; i < formulaByte.length; i++) formulaByte[i] = (byte)0;
-    	formulaByte[4] = (byte)0x0F;
+public final class TestFormulaRecord extends TestCase {
+
+	public void testCreateFormulaRecord () {
+		FormulaRecord record = new FormulaRecord();
+		record.setColumn((short)0);
+		//record.setRow((short)1);
+		record.setRow(1);
+		record.setXFIndex((short)4);
+		
+		assertEquals(record.getColumn(),(short)0);
+		//assertEquals(record.getRow(),(short)1);
+		assertEquals((short)record.getRow(),(short)1);
+		assertEquals(record.getXFIndex(),(short)4);
+	}
+	
+	/**
+	 * Make sure a NAN value is preserved
+	 * This formula record is a representation of =1/0 at row 0, column 0 
+	 */
+	public void testCheckNanPreserve() {
+		byte[] formulaByte = new byte[29];
+		for (int i = 0; i < formulaByte.length; i++) formulaByte[i] = (byte)0;
+		formulaByte[4] = (byte)0x0F;
 		formulaByte[6] = (byte)0x02;
 		formulaByte[8] = (byte)0x07;
 		formulaByte[12] = (byte)0xFF;
@@ -80,7 +70,7 @@
 		formulaByte[23] = (byte)0x01;
 		formulaByte[25] = (byte)0x1E;
 		formulaByte[28] = (byte)0x06;
-    	
+		
 		FormulaRecord record = new FormulaRecord(new TestcaseRecordInputStream(FormulaRecord.sid, (short)29, formulaByte));
 		assertEquals("Row", 0, record.getRow());
 		assertEquals("Column", 0, record.getColumn());		
@@ -92,19 +82,18 @@
 		for (int i = 5; i < 13;i++) {
 			assertEquals("FormulaByte NaN doesn't match", formulaByte[i], output[i+4]);
 		}
+	}
+	
+	/**
+	 * Tests to see if the shared formula cells properly reserialize the expPtg
+	 *
+	 */
+	public void testExpFormula() {
+		byte[] formulaByte = new byte[27];
 		
-    }
-    
-    /**
-     * Tests to see if the shared formula cells properly reserialize the expPtg
-     *
-     */
-    public void testExpFormula() {
-    	byte[] formulaByte = new byte[27];
-    	
 		for (int i = 0; i < formulaByte.length; i++) formulaByte[i] = (byte)0;
-    	
-    	formulaByte[4] =(byte)0x0F;
+		
+		formulaByte[4] =(byte)0x0F;
 		formulaByte[14]=(byte)0x08;
 		formulaByte[18]=(byte)0xE0;
 		formulaByte[19]=(byte)0xFD;
@@ -115,19 +104,19 @@
 		assertEquals("Column", 0, record.getColumn());
 		byte[] output = record.serialize();
 		assertEquals("Output size", 31, output.length); //includes sid+recordlength
-    	assertEquals("Offset 22", 1, output[26]);
-    }
-    
-    public void testWithConcat()  throws Exception {
-    	// =CHOOSE(2,A2,A3,A4)
-    	byte[] data = new byte[] {
-    			6, 0, 68, 0,
-    			1, 0, 1, 0, 15, 0, 0, 0, 0, 0, 0, 0, 57,
+		assertEquals("Offset 22", 1, output[26]);
+	}
+	
+	public void testWithConcat()  throws Exception {
+		// =CHOOSE(2,A2,A3,A4)
+		byte[] data = new byte[] {
+				6, 0, 68, 0,
+				1, 0, 1, 0, 15, 0, 0, 0, 0, 0, 0, 0, 57,
 				64, 0, 0, 12, 0, 12, -4, 46, 0, 
-				30, 2, 0,    // Int - 2
+				30, 2, 0,	// Int - 2
 				25, 4, 3, 0, // Attr
-				8, 0,        // Concat 
-				17, 0,       // Range 
+				8, 0,		// Concat 
+				17, 0,	   // Range 
 				26, 0, 35, 0, // Bit like an attr
 				36, 1, 0, 0, -64, // Ref - A2
 				25, 8, 21, 0, // Attr
@@ -136,43 +125,35 @@
 				36, 3, 0, 0, -64, // Ref - A4
 				25, 8, 3, 0,  // Attr 
 				66, 4, 100, 0 // CHOOSE
-    	};
-    	RecordInputStream inp = new RecordInputStream(
-    			new ByteArrayInputStream(data)
-    	);
-    	inp.nextRecord();
-    	
-    	FormulaRecord fr = new FormulaRecord(inp);
-    	
-    	assertEquals(14, fr.getNumberOfExpressionTokens());
-    	assertEquals(IntPtg.class,       fr.getParsedExpression().get(0).getClass());
-    	assertEquals(AttrPtg.class,      fr.getParsedExpression().get(1).getClass());
-    	assertEquals(ConcatPtg.class,    fr.getParsedExpression().get(2).getClass());
-    	assertEquals(UnknownPtg.class,   fr.getParsedExpression().get(3).getClass());
-    	assertEquals(RangePtg.class,     fr.getParsedExpression().get(4).getClass());
-    	assertEquals(UnknownPtg.class,   fr.getParsedExpression().get(5).getClass());
-    	assertEquals(AttrPtg.class,      fr.getParsedExpression().get(6).getClass());
-    	assertEquals(ReferencePtg.class, fr.getParsedExpression().get(7).getClass());
-    	assertEquals(AttrPtg.class,      fr.getParsedExpression().get(8).getClass());
-    	assertEquals(ReferencePtg.class, fr.getParsedExpression().get(9).getClass());
-    	assertEquals(AttrPtg.class,      fr.getParsedExpression().get(10).getClass());
-    	assertEquals(ReferencePtg.class, fr.getParsedExpression().get(11).getClass());
-    	assertEquals(AttrPtg.class,      fr.getParsedExpression().get(12).getClass());
-    	assertEquals(FuncVarPtg.class,   fr.getParsedExpression().get(13).getClass());
-    	
-    	FuncVarPtg choose = (FuncVarPtg)fr.getParsedExpression().get(13);
-    	assertEquals("CHOOSE", choose.getName());
-    }
-    
-    
-    public static void main(String [] ignored_args)
-    {
-        String filename = System.getProperty("HSSF.testdata.path");
-
-        System.out
-            .println("Testing org.apache.poi.hssf.record.FormulaRecord");
-        junit.textui.TestRunner.run(TestFormulaRecord.class);
-    }
-    
-    
+		};
+		RecordInputStream inp = new RecordInputStream(
+				new ByteArrayInputStream(data)
+		);
+		inp.nextRecord();
+		
+		FormulaRecord fr = new FormulaRecord(inp);
+		
+		assertEquals(14, fr.getNumberOfExpressionTokens());
+		assertEquals(IntPtg.class,	   fr.getParsedExpression().get(0).getClass());
+		assertEquals(AttrPtg.class,	  fr.getParsedExpression().get(1).getClass());
+		assertEquals(ConcatPtg.class,	fr.getParsedExpression().get(2).getClass());
+		assertEquals(UnknownPtg.class,   fr.getParsedExpression().get(3).getClass());
+		assertEquals(RangePtg.class,	 fr.getParsedExpression().get(4).getClass());
+		assertEquals(UnknownPtg.class,   fr.getParsedExpression().get(5).getClass());
+		assertEquals(AttrPtg.class,	  fr.getParsedExpression().get(6).getClass());
+		assertEquals(ReferencePtg.class, fr.getParsedExpression().get(7).getClass());
+		assertEquals(AttrPtg.class,	  fr.getParsedExpression().get(8).getClass());
+		assertEquals(ReferencePtg.class, fr.getParsedExpression().get(9).getClass());
+		assertEquals(AttrPtg.class,	  fr.getParsedExpression().get(10).getClass());
+		assertEquals(ReferencePtg.class, fr.getParsedExpression().get(11).getClass());
+		assertEquals(AttrPtg.class,	  fr.getParsedExpression().get(12).getClass());
+		assertEquals(FuncVarPtg.class,   fr.getParsedExpression().get(13).getClass());
+		
+		FuncVarPtg choose = (FuncVarPtg)fr.getParsedExpression().get(13);
+		assertEquals("CHOOSE", choose.getName());
+	}
+	
+	public static void main(String [] ignored_args) {
+		junit.textui.TestRunner.run(TestFormulaRecord.class);
+	}
 }

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestRecordFactory.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestRecordFactory.java?rev=645483&r1=645482&r2=645483&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestRecordFactory.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestRecordFactory.java Mon Apr  7 05:51:50 2008
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
@@ -15,7 +14,6 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
 
 package org.apache.poi.hssf.record;
 
@@ -34,20 +32,8 @@
  * @author Andrew C. Oliver (acoliver at apache dot org)
  * @author Csaba Nagy (ncsaba at yahoo dot com)
  */
+public final class TestRecordFactory extends TestCase {
 
-public class TestRecordFactory
-    extends TestCase
-{
-
-    /**
-     * Creates new TestRecordFactory
-     * @param testCaseName
-     */
-
-    public TestRecordFactory(String testCaseName)
-    {
-        super(testCaseName);
-    }
 
     /**
      * TEST NAME:  Test Basic Record Construction <P>
@@ -57,13 +43,9 @@
      * FAILURE:    The wrong records are creates or contain the wrong values <P>
      *
      */
-
-    public void testBasicRecordConstruction()
-        throws Exception
-    {
+    public void testBasicRecordConstruction() {
         short    recType = BOFRecord.sid;
-        byte[]   data    = new byte[]
-        {
+        byte[]   data    = {
             0, 6, 5, 0, -2, 28, -51, 7, -55, 64, 0, 0, 6, 1, 0, 0
         };
         short    size    = 16;
@@ -106,13 +88,9 @@
      * FAILURE:    The wrong records are created or contain the wrong values <P>
      *
      */
-
-    public void testSpecial()
-        throws Exception
-    {
+    public void testSpecial() {
         short    recType = RKRecord.sid;
-        byte[]   data    = new byte[]
-        {
+        byte[]   data    = {
             0, 0, 0, 0, 21, 0, 0, 0, 0, 0
         };
         short    size    = 10;
@@ -138,10 +116,8 @@
      * FAILURE:    The wrong records are created or contain the wrong values <P>
      *
      */
-    public void testContinuedUnknownRecord()
-    {
-        byte[]   data    = new byte[]
-        {
+    public void testContinuedUnknownRecord() {
+        byte[]   data    = {
             0, -1, 0, 0, // an unknown record with 0 length
             0x3C , 0, 3, 0, 1, 2, 3, // a continuation record with 3 bytes of data
             0x3C , 0, 1, 0, 4 // one more continuation record with 1 byte of data
@@ -178,7 +154,7 @@
      */
     public void testMixedContinue() throws Exception {
         /**
-         *  Taken from a real file $HSSF.testdata.path/39512.xls. See Bug 39512 for details.
+         *  Taken from a real test sample file 39512.xls. See Bug 39512 for details.
          */
         String dump =
                 //OBJ
@@ -228,10 +204,7 @@
         assertTrue(Arrays.equals(data, ser));
     }
 
-    public static void main(String [] ignored_args)
-    {
-        System.out
-            .println("Testing org.apache.poi.hssf.record.TestRecordFactory");
+    public static void main(String [] ignored_args) {
         junit.textui.TestRunner.run(TestRecordFactory.class);
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message