fix reopen of bug 42999: incorrect AnchorHeight calculations in HSSFClientAnchor.getAnchorHeightInPoints
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@606684 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
76b94fc202
commit
d151b35bc8
@ -82,8 +82,8 @@ public class HSSFClientAnchor
|
||||
*/
|
||||
public float getAnchorHeightInPoints(HSSFSheet sheet )
|
||||
{
|
||||
int y1 = Math.min( getDy1(), getDy2() );
|
||||
int y2 = Math.max( getDy1(), getDy2() );
|
||||
int y1 = getDy1();
|
||||
int y2 = getDy2();
|
||||
int row1 = Math.min( getRow1(), getRow2() );
|
||||
int row2 = Math.max( getRow1(), getRow2() );
|
||||
|
||||
|
@ -85,4 +85,23 @@ public class TestHSSFClientAnchor extends TestCase
|
||||
assertEquals(anchor[i].getRow2(), record.getRow2());
|
||||
}
|
||||
}
|
||||
|
||||
public void testAnchorHeightInPoints(){
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet();
|
||||
|
||||
HSSFClientAnchor[] anchor = {
|
||||
new HSSFClientAnchor( 0 , 0, 0 , 0 ,(short)0, 1,(short)1, 3),
|
||||
new HSSFClientAnchor( 0 , 254 , 0 , 126 ,(short)0, 1,(short)1, 3),
|
||||
new HSSFClientAnchor( 0 , 128 , 0 , 128 ,(short)0, 1,(short)1, 3),
|
||||
new HSSFClientAnchor( 0 , 0 , 0 , 128 ,(short)0, 1,(short)1, 3),
|
||||
};
|
||||
float[] ref = {24.0f, 18.0f, 24.0f, 30.0f};
|
||||
for (int i = 0; i < anchor.length; i++) {
|
||||
float height = anchor[i].getAnchorHeightInPoints(sheet);
|
||||
assertEquals(ref[i], height, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user