From 106166949d47fc28666939ea2519e6700a2aef2e Mon Sep 17 00:00:00 2001 From: Shawn Laubach Date: Wed, 9 Jul 2003 20:18:56 +0000 Subject: [PATCH] Test case to check that the correct header and footer is found (reference bug #21439). git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353198 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/hssf/data/EmbeddedChartHeaderTest.xls | Bin 0 -> 15360 bytes .../hssf/usermodel/TestHSSFHeaderFooter.java | 126 ++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 src/testcases/org/apache/poi/hssf/data/EmbeddedChartHeaderTest.xls create mode 100644 src/testcases/org/apache/poi/hssf/usermodel/TestHSSFHeaderFooter.java diff --git a/src/testcases/org/apache/poi/hssf/data/EmbeddedChartHeaderTest.xls b/src/testcases/org/apache/poi/hssf/data/EmbeddedChartHeaderTest.xls new file mode 100644 index 0000000000000000000000000000000000000000..af0cb2276e743bb6048ecd497d74e667777f38e5 GIT binary patch literal 15360 zcmeHOYiwLc75?tsN7hc7T*uC%c{m$8^($`V*pNmItvAm$$WBtXB^9`GoOn}5N#n@b ziXtIpOB;zFMbJhn{0M?d`~ZPMDqep|(2K^%|zRyAi|N#Tq2baEI|VVcG-pi$x{F za5dwEBKJQeftnO2GMT_%TdywoQHD`Y@@sH$F@Bjo@LSR#PT>~d{?Xx&pG@}+KX!Qd z$Y^?=-45%+u%kXquupe6NjSt}I8T2uZnfSmHNW2cZ(7+G&A$sv@i>;C@586Nx3UGW z?n7?I%6-QCCi555ckn%{^D9F(V->EjeDTcZr0#SHXFJAm48u5q`OSTa+^X}fp4%8- zg9KIpO&gk;JDZ!khT69cwuOno_Qv>nu4As;5Mutv2C^d$R~Bl*0<0|++SFCq4%2F? z6)7}LFEy>Tpy(awKsPX?u5_fso(0LlHUkFRw*^4c?M>|0P+Mk*TsEPd5382f>qwVZ z>PT1A=tU>)tYqeoppu_;t&C-FZ;9y^Y~&1=n1=PI_=c5@b*bhg8cb9EUQAo)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aa*{l`ytcHQ6gd%f=c zy5rZ8^qar(^`Vo#qS0Mn?*sHr_pPK=B;~(FQW&}a9tjL!j86_}?8Zrkgib zD4$^)`(8@nsP#!mj{o}`BU0V9k-yfE*3WGD>lKtO9tH{QB8MZ^hpf%O-1@Wi-x$B% I$%Xv?1xz42. + */ + +package org.apache.poi.hssf.usermodel; + +import junit.framework.TestCase; +import org.apache.poi.hssf.usermodel.HSSFHeader; +import org.apache.poi.hssf.usermodel.HSSFFooter; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; + +/** + * Tests row shifting capabilities. + * + * + * @author Shawn Laubach (slaubach at apache dot com) + */ + +public class TestHSSFHeaderFooter extends TestCase { + + /** + * Constructor for TestHeaderFooter. + * @param arg0 + */ + public TestHSSFHeaderFooter(String arg0) { + super(arg0); + } + + /** + * Tests that get header retreives the proper values. + * + * @author Shawn Laubach (slaubach at apache dot org) + */ + public void testRetrieveCorrectHeader() throws Exception + { + // Read initial file in + String filename = System.getProperty( "HSSF.testdata.path" ); + filename = filename + "/EmbeddedChartHeaderTest.xls"; + FileInputStream fin = new FileInputStream( filename ); + HSSFWorkbook wb = new HSSFWorkbook( fin ); + fin.close(); + HSSFSheet s = wb.getSheetAt( 0 ); + HSSFHeader head = s.getHeader(); + + assertEquals("Top Left", head.getLeft()); + assertEquals("Top Center", head.getCenter()); + assertEquals("Top Right", head.getRight()); + } + + /** + * Tests that get header retreives the proper values. + * + * @author Shawn Laubach (slaubach at apache dot org) + */ + public void testRetrieveCorrectFooter() throws Exception + { + // Read initial file in + String filename = System.getProperty( "HSSF.testdata.path" ); + filename = filename + "/EmbeddedChartHeaderTest.xls"; + FileInputStream fin = new FileInputStream( filename ); + HSSFWorkbook wb = new HSSFWorkbook( fin ); + fin.close(); + HSSFSheet s = wb.getSheetAt( 0 ); + HSSFFooter foot = s.getFooter(); + + assertEquals("Bottom Left", foot.getLeft()); + assertEquals("Bottom Center", foot.getCenter()); + assertEquals("Bottom Right", foot.getRight()); + } +} +