@@ -783,39 +783,67 @@ public void Test_CORRUPTEDDOC_BUG36_SHOULD_THROW_CORRUPTED_FILE_EXCEPTION()
783
783
784
784
}
785
785
786
- //[TestMethod]
787
- //public void Test_CORRUPTED_CYCLIC_DIFAT_VALIDATION_CHECK()
788
- //{
789
-
790
- // CompoundFile cf = null;
791
- // try
792
- // {
793
- // cf = new CompoundFile("CiclycDFAT.cfs");
794
- // CFStorage s = cf.RootStorage.GetStorage("MyStorage");
795
- // CFStream st = s.GetStream("MyStream");
796
- // Assert.IsTrue(st.Size > 0);
797
- // }
798
- // catch (Exception ex)
799
- // {
800
- // Assert.IsTrue(ex is CFCorruptedFileException);
801
- // }
802
- // finally
803
- // {
804
- // if (cf != null)
805
- // {
806
- // cf.Close();
807
- // }
808
- // }
809
- //}
810
- //[TestMethod]
811
- //public void Test_REM()
812
- //{
813
- // var f = new CompoundFile();
814
-
815
- // byte[] bB = Helpers.GetBuffer(5 * 1024, 0x0B);
816
- // f.RootStorage.AddStream("Test").AppendData(bB);
817
- // f.Save("Astorage.cfs");
818
- //}
819
-
820
- }
786
+ [ TestMethod ]
787
+ public void Test_ISSUE_2_WRONG_CUTOFF_SIZE ( )
788
+ {
789
+ FileStream fs = null ;
790
+ try
791
+ {
792
+ if ( File . Exists ( "TEST_ISSUE_2" ) )
793
+ {
794
+ File . Delete ( "TEST_ISSUE_2" ) ;
795
+ }
796
+
797
+ CompoundFile cf = new CompoundFile ( CFSVersion . Ver_3 , CFSConfiguration . Default ) ;
798
+ var s = cf . RootStorage . AddStream ( "miniToNormal" ) ;
799
+ s . Append ( Helpers . GetBuffer ( 4090 , 0xAA ) ) ;
800
+
801
+ cf . Save ( "TEST_ISSUE_2" ) ;
802
+ cf . Close ( ) ;
803
+ var cf2 = new CompoundFile ( "TEST_ISSUE_2" , CFSUpdateMode . Update , CFSConfiguration . Default ) ;
804
+ cf2 . RootStorage . GetStream ( "miniToNormal" ) . Append ( Helpers . GetBuffer ( 6 , 0xBB ) ) ;
805
+ cf2 . Commit ( ) ;
806
+ cf2 . Close ( ) ;
807
+ }
808
+ catch ( Exception ex )
809
+ {
810
+ Assert . IsTrue ( fs . CanRead && fs . CanSeek && fs . CanWrite ) ;
811
+ }
812
+ }
813
+
814
+ //[TestMethod]
815
+ //public void Test_CORRUPTED_CYCLIC_DIFAT_VALIDATION_CHECK()
816
+ //{
817
+
818
+ // CompoundFile cf = null;
819
+ // try
820
+ // {
821
+ // cf = new CompoundFile("CiclycDFAT.cfs");
822
+ // CFStorage s = cf.RootStorage.GetStorage("MyStorage");
823
+ // CFStream st = s.GetStream("MyStream");
824
+ // Assert.IsTrue(st.Size > 0);
825
+ // }
826
+ // catch (Exception ex)
827
+ // {
828
+ // Assert.IsTrue(ex is CFCorruptedFileException);
829
+ // }
830
+ // finally
831
+ // {
832
+ // if (cf != null)
833
+ // {
834
+ // cf.Close();
835
+ // }
836
+ // }
837
+ //}
838
+ //[TestMethod]
839
+ //public void Test_REM()
840
+ //{
841
+ // var f = new CompoundFile();
842
+
843
+ // byte[] bB = Helpers.GetBuffer(5 * 1024, 0x0B);
844
+ // f.RootStorage.AddStream("Test").AppendData(bB);
845
+ // f.Save("Astorage.cfs");
846
+ //}
847
+
848
+ }
821
849
}
0 commit comments