poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sack...@apache.org
Subject cvs commit: jakarta-poi/src/scratchpad/testcases/org/apache/poi/hwpf/model TestListTables.java TestSectionTable.java
Date Thu, 08 Apr 2004 11:51:09 GMT
sackley     2004/04/08 04:51:09

  Modified:    src/scratchpad/testcases/org/apache/poi/hwpf/model
                        TestListTables.java TestSectionTable.java
  Log:
  patch and latest bug fixes
  
  Revision  Changes    Path
  1.2       +14 -8     jakarta-poi/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestListTables.java
  
  Index: TestListTables.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestListTables.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestListTables.java	2 Mar 2004 06:26:04 -0000	1.1
  +++ TestListTables.java	8 Apr 2004 11:51:09 -0000	1.2
  @@ -22,19 +22,25 @@
       FileInformationBlock fib = _hWPFDocFixture._fib;
       byte[] tableStream = _hWPFDocFixture._tableStream;
   
  -    ListTables listTables = new ListTables(tableStream, fib.getFcPlcfLst(), fib.getFcPlfLfo());
  +    int listOffset = fib.getFcPlcfLst();
  +    int lfoOffset = fib.getFcPlfLfo();
  +    if (listOffset != 0 && fib.getLcbPlcfLst() != 0)
  +    {
  +      ListTables listTables = new ListTables (tableStream, fib.getFcPlcfLst (),
  +                                              fib.getFcPlfLfo ());
  +      HWPFFileSystem fileSys = new HWPFFileSystem ();
   
  -    HWPFFileSystem fileSys = new HWPFFileSystem();
  +      HWPFOutputStream tableOut = fileSys.getStream ("1Table");
   
  -    HWPFOutputStream  tableOut = fileSys.getStream("1Table");
  +      listTables.writeListDataTo (tableOut);
  +      int offset = tableOut.getOffset ();
  +      listTables.writeListOverridesTo (tableOut);
   
  -    listTables.writeListDataTo(tableOut);
  -    int offset = tableOut.getOffset();
  -    listTables.writeListOverridesTo(tableOut);
  +      ListTables newTables = new ListTables (tableOut.toByteArray (), 0, offset);
   
  -    ListTables newTables = new ListTables(tableOut.toByteArray(), 0, offset);
  +      assertEquals(listTables, newTables);
   
  -    assertEquals(listTables, newTables);
  +    }
     }
   
   }
  
  
  
  1.2       +18 -2     jakarta-poi/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestSectionTable.java
  
  Index: TestSectionTable.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestSectionTable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestSectionTable.java	2 Mar 2004 06:23:44 -0000	1.1
  +++ TestSectionTable.java	8 Apr 2004 11:51:09 -0000	1.2
  @@ -80,10 +80,13 @@
       byte[] tableStream = _hWPFDocFixture._tableStream;
       int fcMin = fib.getFcMin();
   
  +    ComplexFileTable cft = new ComplexFileTable(mainStream, tableStream, fib.getFcClx(),
fcMin);
  +    TextPieceTable tpt = cft.getTextPieceTable();
  +
       SectionTable sectionTable = new SectionTable(mainStream, tableStream,
                                                    fib.getFcPlcfsed(),
                                                    fib.getLcbPlcfsed(),
  -                                                 fcMin);
  +                                                 fcMin, tpt.getTextPieces());
       HWPFFileSystem fileSys = new HWPFFileSystem();
   
       sectionTable.writeTo(fileSys, 0);
  @@ -93,12 +96,25 @@
       byte[] newTableStream = tableOut.toByteArray();
       byte[] newMainStream = mainOut.toByteArray();
   
  -    SectionTable newSectionTable = new SectionTable(newMainStream, newTableStream, 0, newTableStream.length,
0);
  +    SectionTable newSectionTable = new SectionTable(newMainStream, newTableStream, 0, newTableStream.length,
0, tpt.getTextPieces());
   
       ArrayList oldSections = sectionTable.getSections();
       ArrayList newSections = newSectionTable.getSections();
   
       assertEquals(oldSections.size(), newSections.size());
  +
  +    //test for proper char offset conversions
  +    PlexOfCps oldSedPlex = new PlexOfCps(tableStream, fib.getFcPlcfsed(),
  +                                                      fib.getLcbPlcfsed(), 12);
  +    PlexOfCps newSedPlex = new PlexOfCps(newTableStream, 0,
  +                                         newTableStream.length, 12);
  +    assertEquals(oldSedPlex.length(), newSedPlex.length());
  +
  +    for (int x = 0; x < oldSedPlex.length(); x++)
  +    {
  +      assertEquals(oldSedPlex.getProperty(x).getStart(), newSedPlex.getProperty(x).getStart());
  +      assertEquals(oldSedPlex.getProperty(x).getEnd(), newSedPlex.getProperty(x).getEnd());
  +    }
   
       int size = oldSections.size();
       for (int x = 0; x < size; x++)
  
  
  

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


Mime
View raw message