poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1849047 - in /poi/trunk/src/scratchpad/testcases/org/apache/poi/hemf: hemfplus/extractor/HemfPlusExtractorTest.java usermodel/HemfPictureTest.java
Date Sun, 16 Dec 2018 21:25:57 GMT
Author: kiwiwings
Date: Sun Dec 16 21:25:57 2018
New Revision: 1849047

URL: http://svn.apache.org/viewvc?rev=1849047&view=rev
Log:
fix junit tests

Modified:
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hemf/hemfplus/extractor/HemfPlusExtractorTest.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hemf/usermodel/HemfPictureTest.java

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hemf/hemfplus/extractor/HemfPlusExtractorTest.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hemf/hemfplus/extractor/HemfPlusExtractorTest.java?rev=1849047&r1=1849046&r2=1849047&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hemf/hemfplus/extractor/HemfPlusExtractorTest.java
(original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hemf/hemfplus/extractor/HemfPlusExtractorTest.java
Sun Dec 16 21:25:57 2018
@@ -73,20 +73,16 @@ public class HemfPlusExtractorTest {
 
 
     private EmfCommentDataPlus getCommentRecord(String testFileName, int recordIndex) throws
Exception {
-        EmfCommentDataPlus returnRecord = null;
-
         try (InputStream is = POIDataSamples.getSpreadSheetInstance().openResourceAsStream(testFileName))
{
             HemfPicture ex = new HemfPicture(is);
             int i = 0;
             for (HemfRecord record : ex) {
-                if (i == recordIndex) {
-                    EmfComment commentRecord = ((EmfComment) record);
-                    returnRecord = (EmfCommentDataPlus) commentRecord.getCommentData();
-                    break;
+                if (record instanceof EmfComment && i++ == recordIndex) {
+                    EmfComment commentRecord = (EmfComment)record;
+                    return (EmfCommentDataPlus) commentRecord.getCommentData();
                 }
-                i++;
             }
         }
-        return returnRecord;
+        return null;
     }
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hemf/usermodel/HemfPictureTest.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hemf/usermodel/HemfPictureTest.java?rev=1849047&r1=1849046&r2=1849047&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hemf/usermodel/HemfPictureTest.java
(original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hemf/usermodel/HemfPictureTest.java
Sun Dec 16 21:25:57 2018
@@ -207,8 +207,8 @@ public class HemfPictureTest {
             assertEquals(27864, header.getBytes());
             assertEquals(31, header.getRecords());
             assertEquals(3, header.getHandles());
-            assertEquals(346000, header.getMicroDimension().getWidth());
-            assertEquals(194000, header.getMicroDimension().getHeight());
+            assertEquals(346000, header.getMicroDimension().getWidth(), 0);
+            assertEquals(194000, header.getMicroDimension().getHeight(), 0);
 
             List<HemfRecord> records = pic.getRecords();
 



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


Mime
View raw message