@@ -1132,29 +1132,21 @@ public virtual void StampingTestWithTaggedStructure() {
1132
1132
1133
1133
[ NUnit . Framework . Test ]
1134
1134
public virtual void StampingTestWithFullCompression01 ( ) {
1135
- String outPdf = destinationFolder + "stampingTestWithFullCompression01 .pdf" ;
1136
- String cmpPdf = sourceFolder + "cmp_stampingTestWithFullCompression01 .pdf" ;
1135
+ String compressedOutPdf = destinationFolder + "stampingTestWithFullCompression01Compressed .pdf" ;
1136
+ String decompressedOutPdf = destinationFolder + "stampingTestWithFullCompression01Decompressed .pdf" ;
1137
1137
PdfDocument pdfDoc = new PdfDocument ( new PdfReader ( sourceFolder + "fullCompressedDocument.pdf" ) , new PdfWriter
1138
- ( outPdf ) ) ;
1138
+ ( compressedOutPdf ) ) ;
1139
1139
pdfDoc . Close ( ) ;
1140
- float result = new FileInfo ( outPdf ) . Length ;
1141
- float expected = new FileInfo ( cmpPdf ) . Length ;
1142
- float coef = Math . Abs ( ( expected - result ) / expected ) ;
1143
- String compareRes = new CompareTool ( ) . CompareByContent ( outPdf , cmpPdf , destinationFolder ) ;
1144
- NUnit . Framework . Assert . IsTrue ( coef < 0.01 ) ;
1145
- NUnit . Framework . Assert . IsNull ( compareRes ) ;
1146
- }
1147
-
1148
- [ NUnit . Framework . Test ]
1149
- public virtual void StampingTestWithFullCompression02 ( ) {
1150
- PdfDocument pdfDoc = new PdfDocument ( new PdfReader ( sourceFolder + "fullCompressedDocument.pdf" ) , new PdfWriter
1151
- ( destinationFolder + "stampingTestWithFullCompression02.pdf" , new WriterProperties ( ) . SetFullCompressionMode
1152
- ( false ) ) ) ;
1140
+ float compressedLength = new FileInfo ( compressedOutPdf ) . Length ;
1141
+ pdfDoc = new PdfDocument ( new PdfReader ( sourceFolder + "fullCompressedDocument.pdf" ) , new PdfWriter ( decompressedOutPdf
1142
+ , new WriterProperties ( ) . SetFullCompressionMode ( false ) ) ) ;
1153
1143
pdfDoc . Close ( ) ;
1154
- float result = new FileInfo ( destinationFolder + "stampingTestWithFullCompression02.pdf" ) . Length ;
1155
- float expected = new FileInfo ( sourceFolder + "cmp_stampingTestWithFullCompression02.pdf" ) . Length ;
1156
- float coef = Math . Abs ( ( expected - result ) / expected ) ;
1157
- NUnit . Framework . Assert . IsTrue ( coef < 0.01 ) ;
1144
+ float decompressedLength = new FileInfo ( decompressedOutPdf ) . Length ;
1145
+ float coef = compressedLength / decompressedLength ;
1146
+ String compareRes = new CompareTool ( ) . CompareByContent ( compressedOutPdf , decompressedOutPdf , destinationFolder
1147
+ ) ;
1148
+ NUnit . Framework . Assert . IsTrue ( coef < 0.7 ) ;
1149
+ NUnit . Framework . Assert . IsNull ( compareRes ) ;
1158
1150
}
1159
1151
1160
1152
[ NUnit . Framework . Test ]
0 commit comments