diff options
author | Evgeniy Berlog <berlog@apache.org> | 2012-08-01 19:34:08 +0000 |
---|---|---|
committer | Evgeniy Berlog <berlog@apache.org> | 2012-08-01 19:34:08 +0000 |
commit | 3c170100d769742e076580e7e52054b28ea7f546 (patch) | |
tree | 300fee8a93e2c58f28dbea96efd682519d6cfcfc /src/testcases | |
parent | 7305869f20f551d0c71309a465a7a914670b4842 (diff) | |
download | poi-3c170100d769742e076580e7e52054b28ea7f546.tar.gz poi-3c170100d769742e076580e7e52054b28ea7f546.zip |
code refactoring
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/gsoc2012@1368211 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
-rw-r--r-- | src/testcases/org/apache/poi/hssf/usermodel/TestPatriarch.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestPatriarch.java b/src/testcases/org/apache/poi/hssf/usermodel/TestPatriarch.java new file mode 100644 index 0000000000..be5dc51594 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestPatriarch.java @@ -0,0 +1,40 @@ +package org.apache.poi.hssf.usermodel;
+
+import junit.framework.TestCase;
+import org.apache.poi.ddf.EscherDgRecord;
+import org.apache.poi.hssf.HSSFTestDataSamples;
+import org.apache.poi.hssf.record.EscherAggregate;
+
+/**
+ * @author Evgeniy Berlog
+ * @date 01.08.12
+ */
+public class TestPatriarch extends TestCase {
+
+ public void testGetPatriarch(){
+ HSSFWorkbook wb = new HSSFWorkbook();
+ HSSFSheet sh = wb.createSheet();
+ assertNull(sh.getDrawingPatriarch());
+
+ HSSFPatriarch patriarch = sh.createDrawingPatriarch();
+ assertNotNull(patriarch);
+ patriarch.createSimpleShape(new HSSFClientAnchor());
+ patriarch.createSimpleShape(new HSSFClientAnchor());
+
+ assertSame(patriarch, sh.getDrawingPatriarch());
+
+ EscherAggregate agg = patriarch._getBoundAggregate();
+
+ EscherDgRecord dg = agg.getEscherContainer().getChildById(EscherDgRecord.RECORD_ID);
+ int lastId = dg.getLastMSOSPID();
+
+ assertSame(patriarch, sh.createDrawingPatriarch());
+
+ wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
+ sh = wb.getSheetAt(0);
+ patriarch = sh.createDrawingPatriarch();
+ dg = patriarch._getBoundAggregate().getEscherContainer().getChildById(EscherDgRecord.RECORD_ID);
+
+ assertEquals(lastId, dg.getLastMSOSPID());
+ }
+}
|