poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From one...@apache.org
Subject svn commit: r1716053 - in /poi/trunk: ./ src/examples/src/org/apache/poi/hssf/usermodel/examples/ src/examples/src/org/apache/poi/ss/examples/ src/java/org/apache/poi/hssf/usermodel/ src/ooxml/testcases/org/apache/poi/xssf/usermodel/ src/testcases/org/...
Date Tue, 24 Nov 2015 08:04:43 GMT
Author: onealj
Date: Tue Nov 24 08:04:42 2015
New Revision: 1716053

URL: http://svn.apache.org/viewvc?rev=1716053&view=rev
Log:
bug 58644: fix HSSFSheet.setZoom(int); update documentation to use non-deprecated method

Modified:
    poi/trunk/.project
    poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/ZoomSheet.java
    poi/trunk/src/examples/src/org/apache/poi/ss/examples/BusinessPlan.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java

Modified: poi/trunk/.project
URL: http://svn.apache.org/viewvc/poi/trunk/.project?rev=1716053&r1=1716052&r2=1716053&view=diff
==============================================================================
--- poi/trunk/.project (original)
+++ poi/trunk/.project Tue Nov 24 08:04:42 2015
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-	<name>ApachePOI</name>
+	<name>ApachePOI-bug58365</name>
 	<comment></comment>
 	<projects>
 	</projects>

Modified: poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/ZoomSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/ZoomSheet.java?rev=1716053&r1=1716052&r2=1716053&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/ZoomSheet.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/ZoomSheet.java Tue Nov
24 08:04:42 2015
@@ -37,9 +37,10 @@ public class ZoomSheet
     {
         HSSFWorkbook wb = new HSSFWorkbook();
         HSSFSheet sheet1 = wb.createSheet("new sheet");
-        sheet1.setZoom(3,4);   // 75 percent magnification
+        sheet1.setZoom(75);   // 75 percent magnification
         FileOutputStream fileOut = new FileOutputStream("workbook.xls");
         wb.write(fileOut);
         fileOut.close();
+        wb.close();
     }
 }

Modified: poi/trunk/src/examples/src/org/apache/poi/ss/examples/BusinessPlan.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/ss/examples/BusinessPlan.java?rev=1716053&r1=1716052&r2=1716053&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/ss/examples/BusinessPlan.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/ss/examples/BusinessPlan.java Tue Nov 24 08:04:42
2015
@@ -192,7 +192,7 @@ public class BusinessPlan {
         sheet.setColumnWidth(0, 256*6);
         sheet.setColumnWidth(1, 256*33);
         sheet.setColumnWidth(2, 256*20);
-        sheet.setZoom(3, 4);
+        sheet.setZoom(75); //75% scale
 
 
         // Write the output to a file

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java?rev=1716053&r1=1716052&r2=1716053&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java Tue Nov 24 08:04:42 2015
@@ -1267,7 +1267,7 @@ public final class HSSFSheet implements
      */
     @Override
     public void setZoom(int scale) {
-        setZoom(scale*100, 100);
+        setZoom(scale, 100);
     }
 
     /**

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java?rev=1716053&r1=1716052&r2=1716053&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java Tue Nov
24 08:04:42 2015
@@ -408,12 +408,11 @@ public final class TestXSSFSheet extends
         workbook.close();
     }
 
-    @SuppressWarnings("deprecation")
     @Test(expected=IllegalArgumentException.class)
     public void setZoom() throws IOException {
         XSSFWorkbook workBook = new XSSFWorkbook();
         XSSFSheet sheet1 = workBook.createSheet("new sheet");
-        sheet1.setZoom(3, 4);   // 75 percent magnification
+        sheet1.setZoom(75);   // 75 percent magnification
         long zoom = sheet1.getCTWorksheet().getSheetViews().getSheetViewArray(0).getZoomScale();
         assertEquals(zoom, 75);
 

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java?rev=1716053&r1=1716052&r2=1716053&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java Tue Nov 24 08:04:42
2015
@@ -523,11 +523,10 @@ public final class TestHSSFSheet extends
         HSSFWorkbook wb = new HSSFWorkbook();
         HSSFSheet sheet = wb.createSheet();
         assertEquals(-1, sheet.getSheet().findFirstRecordLocBySid(SCLRecord.sid));
-        sheet.setZoom(3,4);
+        sheet.setZoom(75);
         assertTrue(sheet.getSheet().findFirstRecordLocBySid(SCLRecord.sid) > 0);
         SCLRecord sclRecord = (SCLRecord) sheet.getSheet().findFirstRecordBySid(SCLRecord.sid);
-        assertEquals(3, sclRecord.getNumerator());
-        assertEquals(4, sclRecord.getDenominator());
+        assertEquals(75, 100*sclRecord.getNumerator()/sclRecord.getDenominator());
 
         int sclLoc = sheet.getSheet().findFirstRecordLocBySid(SCLRecord.sid);
         int window2Loc = sheet.getSheet().findFirstRecordLocBySid(WindowTwoRecord.sid);
@@ -535,13 +534,13 @@ public final class TestHSSFSheet extends
         
         // verify limits
         try {
-            sheet.setZoom(0, 2);
+            sheet.setZoom(0);
             fail("Should catch Exception here");
         } catch (IllegalArgumentException e) {
             assertEquals("Numerator must be greater than 0 and less than 65536", e.getMessage());
         }
         try {
-            sheet.setZoom(65536, 2);
+            sheet.setZoom(65536);
             fail("Should catch Exception here");
         } catch (IllegalArgumentException e) {
             assertEquals("Numerator must be greater than 0 and less than 65536", e.getMessage());

Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java?rev=1716053&r1=1716052&r2=1716053&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java Tue Nov 24 08:04:42
2015
@@ -933,7 +933,7 @@ public abstract class BaseTestSheet {
         Sheet sheet = wb.createSheet();
         
         // here we can only verify that setting some zoom values works, range-checking is
different between the implementations
-        sheet.setZoom(3,4);
+        sheet.setZoom(75);
         wb.close();
     }
     



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


Mime
View raw message