1 16 17 package org.apache.poi.hssf.usermodel; 18 19 import junit.framework.TestCase; 20 21 26 public class TestHSSFClientAnchor extends TestCase 27 { 28 public void testGetAnchorHeightInPoints() throws Exception 29 { 30 HSSFWorkbook wb = new HSSFWorkbook(); 31 HSSFSheet sheet = wb.createSheet("test"); 32 HSSFClientAnchor a = new HSSFClientAnchor(0,0,1023,255,(short)0,0,(short)0,0); 33 float p = a.getAnchorHeightInPoints(sheet); 34 assertEquals(11.953,p,0.001); 35 36 sheet.createRow(0).setHeightInPoints(14); 37 a = new HSSFClientAnchor(0,0,1023,255,(short)0,0,(short)0,0); 38 p = a.getAnchorHeightInPoints(sheet); 39 assertEquals(13.945,p,0.001); 40 41 a = new HSSFClientAnchor(0,0,1023,127,(short)0,0,(short)0,0); 42 p = a.getAnchorHeightInPoints(sheet); 43 assertEquals(6.945,p,0.001); 44 45 a = new HSSFClientAnchor(0,126,1023,127,(short)0,0,(short)0,0); 46 p = a.getAnchorHeightInPoints(sheet); 47 assertEquals(0.054,p,0.001); 48 49 a = new HSSFClientAnchor(0,0,1023,0,(short)0,0,(short)0,1); 50 p = a.getAnchorHeightInPoints(sheet); 51 assertEquals(14.0,p,0.001); 52 53 sheet.createRow(0).setHeightInPoints(12); 54 a = new HSSFClientAnchor(0,127,1023,127,(short)0,0,(short)0,1); 55 p = a.getAnchorHeightInPoints(sheet); 56 assertEquals(12.0,p,0.001); 57 58 } 59 60 } 61 | Popular Tags |