aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/hssf/model
diff options
context:
space:
mode:
authorEvgeniy Berlog <berlog@apache.org>2012-07-06 17:00:20 +0000
committerEvgeniy Berlog <berlog@apache.org>2012-07-06 17:00:20 +0000
commit06df547a594c30a10d9d25eb82fcd107c2f42ae4 (patch)
tree282a5d2aa4afba1221bced5ef0ae2b9b3219a483 /src/testcases/org/apache/poi/hssf/model
parent5f543636b754773ab470a104ae6acd36102c7cb9 (diff)
downloadpoi-06df547a594c30a10d9d25eb82fcd107c2f42ae4.tar.gz
poi-06df547a594c30a10d9d25eb82fcd107c2f42ae4.zip
implemented creating shapes in new file using new model
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/gsoc2012@1358301 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/hssf/model')
-rw-r--r--src/testcases/org/apache/poi/hssf/model/TestDrawingAggregate.java29
-rw-r--r--src/testcases/org/apache/poi/hssf/model/TestDrawingShapes.java10
2 files changed, 34 insertions, 5 deletions
diff --git a/src/testcases/org/apache/poi/hssf/model/TestDrawingAggregate.java b/src/testcases/org/apache/poi/hssf/model/TestDrawingAggregate.java
index 1f058c06da..b497212518 100644
--- a/src/testcases/org/apache/poi/hssf/model/TestDrawingAggregate.java
+++ b/src/testcases/org/apache/poi/hssf/model/TestDrawingAggregate.java
@@ -195,16 +195,35 @@ public class TestDrawingAggregate extends TestCase {
}
public void testBuildBaseTree(){
- EscherAggregate agg = new EscherAggregate();
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet();
-
- HSSFPatriarch drawing = sheet.createDrawingPatriarch();
- EscherAggregate agg1 = HSSFTestHelper.getEscherAggregate(drawing);
+ HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
+ EscherAggregate agg = HSSFTestHelper.getEscherAggregate(patriarch);
+ EscherAggregate agg1 = new EscherAggregate(new HSSFTestHelper.MockDrawingManager());
+ EscherSpgrRecord spgr = new EscherSpgrRecord();
+ spgr.setRectY1(0);
+ spgr.setRectY2(255);
+ spgr.setRectX1(0);
+ spgr.setRectX2(1023);
+ EscherContainerRecord spContainer = new EscherContainerRecord();
+ spContainer.addChildRecord(spgr);
+ EscherContainerRecord spgrContainer = new EscherContainerRecord();
+ spgrContainer.addChildRecord(spContainer);
+ EscherContainerRecord dgContainer = new EscherContainerRecord();
+ dgContainer.addChildRecord(spgrContainer);
+ agg1.addEscherRecord(dgContainer);
+ agg1.setPatriarch(HSSFTestHelper.createTestPatriarch(sheet, agg1));
+ agg1.clear();
HSSFTestHelper.callConvertPatriarch(agg1);
agg1.setPatriarch(null);
-
+
agg.setPatriarch(null);
+//
+ EscherSpRecord sp = (EscherSpRecord) agg.getEscherContainer().getChildContainers().get(0).getChild(0).getChild(1);
+ sp.setShapeId(1025);
+ EscherDgRecord dg = (EscherDgRecord) agg.getEscherContainer().getChild(0);
+ dg.setNumShapes(1);
+ dg.setOptions((short) (1 << 4));
byte[] aggS = agg.serialize();
byte []agg1S = agg1.serialize();
diff --git a/src/testcases/org/apache/poi/hssf/model/TestDrawingShapes.java b/src/testcases/org/apache/poi/hssf/model/TestDrawingShapes.java
index 4e120a7cb8..e50aa47adf 100644
--- a/src/testcases/org/apache/poi/hssf/model/TestDrawingShapes.java
+++ b/src/testcases/org/apache/poi/hssf/model/TestDrawingShapes.java
@@ -324,4 +324,14 @@ public class TestDrawingShapes extends TestCase {
textbox.setLineStyleColor(textbox.getLineStyleColor());
assertEquals(opt1Str, textbox.getEscherContainer().getChildById(EscherOptRecord.RECORD_ID).toXml());
}
+
+ public void testDgRecordNumShapes(){
+ HSSFWorkbook wb = new HSSFWorkbook();
+ HSSFSheet sheet = wb.createSheet();
+ HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
+
+ EscherAggregate aggregate = HSSFTestHelper.getEscherAggregate(patriarch);
+ EscherDgRecord dgRecord = (EscherDgRecord) aggregate.getEscherRecord(0).getChild(0);
+ assertEquals(dgRecord.getNumShapes(), 1);
+ }
}