KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > hssf > usermodel > TestHSSFClientAnchor


1 /* ====================================================================
2    Copyright 2003-2004 Apache Software Foundation
3
4    Licensed under the Apache License, Version 2.0 (the "License");
5    you may not use this file except in compliance with the License.
6    You may obtain a copy of the License at
7
8        http://www.apache.org/licenses/LICENSE-2.0
9
10    Unless required by applicable law or agreed to in writing, software
11    distributed under the License is distributed on an "AS IS" BASIS,
12    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    See the License for the specific language governing permissions and
14    limitations under the License.
15 ==================================================================== */

16
17 package org.apache.poi.hssf.usermodel;
18
19 import junit.framework.TestCase;
20
21 /**
22  * Various tests for HSSFClientAnchor.
23  *
24  * @author Glen Stampoultzis (glens at apache.org)
25  */

26 public class TestHSSFClientAnchor extends TestCase
27 {
28     public void testGetAnchorHeightInPoints() throws Exception JavaDoc
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