aboutsummaryrefslogtreecommitdiffstats
path: root/src/scratchpad/testcases
diff options
context:
space:
mode:
Diffstat (limited to 'src/scratchpad/testcases')
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hslf/data/headers_footers.pptbin0 -> 12800 bytes
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hslf/model/TestHeadersFooters.java118
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hslf/record/TestCString.java10
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java115
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hslf/record/TestHeadersFootersAtom.java95
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hslf/record/TestHeadersFootersContainer.java171
6 files changed, 504 insertions, 5 deletions
diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/data/headers_footers.ppt b/src/scratchpad/testcases/org/apache/poi/hslf/data/headers_footers.ppt
new file mode 100644
index 0000000000..891d73f95e
--- /dev/null
+++ b/src/scratchpad/testcases/org/apache/poi/hslf/data/headers_footers.ppt
Binary files differ
diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestHeadersFooters.java b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestHeadersFooters.java
new file mode 100644
index 0000000000..8b1cdbe09e
--- /dev/null
+++ b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestHeadersFooters.java
@@ -0,0 +1,118 @@
+
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+
+
+package org.apache.poi.hslf.model;
+
+import java.io.*;
+import org.apache.poi.hslf.usermodel.SlideShow;
+
+import junit.framework.TestCase;
+
+/**
+ * Test {@link org.apache.poi.hslf.model.HeadersFooters} object
+ */
+public class TestHeadersFooters extends TestCase
+{
+
+ public static final String cwd = System.getProperty("HSLF.testdata.path");
+
+ public void testRead() throws Exception
+ {
+ File file = new File(cwd, "headers_footers.ppt");
+ FileInputStream is = new FileInputStream(file);
+ SlideShow ppt = new SlideShow(is);
+ is.close();
+
+ HeadersFooters slideHdd = ppt.getSlideHeadersFooters();
+ assertTrue(slideHdd.isFooterVisible());
+ assertEquals("Global Slide Footer", slideHdd.getFooterText());
+ assertTrue(slideHdd.isSlideNumberVisible());
+ assertFalse(slideHdd.isHeaderVisible());
+ assertNull(slideHdd.getHeaderText());
+ assertFalse(slideHdd.isUserDateVisible());
+ assertNull(slideHdd.getDateTimeText());
+
+
+ HeadersFooters notesHdd = ppt.getNotesHeadersFooters();
+ assertTrue(notesHdd.isFooterVisible());
+ assertEquals("Notes Footer", notesHdd.getFooterText());
+ assertTrue(notesHdd.isHeaderVisible());
+ assertEquals("Notes Header", notesHdd.getHeaderText());
+ assertTrue(notesHdd.isUserDateVisible());
+ assertNull(notesHdd.getDateTimeText());
+
+ Slide[] slide = ppt.getSlides();
+ //the first slide uses presentation-scope headers / footers
+ HeadersFooters hd1 = slide[0].getHeadersFooters();
+ assertEquals(slideHdd.isFooterVisible(), hd1.isFooterVisible());
+ assertEquals(slideHdd.getFooterText(), hd1.getFooterText());
+ assertEquals(slideHdd.isSlideNumberVisible(), hd1.isSlideNumberVisible());
+ assertEquals(slideHdd.isHeaderVisible(), hd1.isHeaderVisible());
+ assertEquals(slideHdd.getHeaderText(), hd1.getHeaderText());
+ assertEquals(slideHdd.isUserDateVisible(), hd1.isUserDateVisible());
+ assertEquals(slideHdd.getDateTimeText(), hd1.getDateTimeText());
+
+ //the first slide uses per-slide headers / footers
+ HeadersFooters hd2 = slide[1].getHeadersFooters();
+ assertEquals(true, hd2.isFooterVisible());
+ assertEquals("per-slide footer", hd2.getFooterText());
+ assertEquals(true, hd2.isUserDateVisible());
+ assertEquals("custom date format", hd2.getDateTimeText());
+ }
+
+ public void testCreateSlideFooters() throws Exception
+ {
+ SlideShow ppt = new SlideShow();
+ HeadersFooters hdd = ppt.getSlideHeadersFooters();
+ hdd.setFootersText("My slide footer");
+ hdd.setSlideNumberVisible(true);
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ppt.write(out);
+ byte[] b = out.toByteArray();
+
+ SlideShow ppt2 = new SlideShow(new ByteArrayInputStream(b));
+ HeadersFooters hdd2 = ppt2.getSlideHeadersFooters();
+ assertTrue(hdd2.isSlideNumberVisible());
+ assertTrue(hdd2.isFooterVisible());
+ assertEquals("My slide footer", hdd2.getFooterText());
+ }
+
+ public void testCreateNotesFooters() throws Exception
+ {
+ SlideShow ppt = new SlideShow();
+ HeadersFooters hdd = ppt.getNotesHeadersFooters();
+ hdd.setFootersText("My notes footer");
+ hdd.setHeaderText("My notes header");
+ hdd.setSlideNumberVisible(true);
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ppt.write(out);
+ byte[] b = out.toByteArray();
+
+ SlideShow ppt2 = new SlideShow(new ByteArrayInputStream(b));
+ HeadersFooters hdd2 = ppt2.getNotesHeadersFooters();
+ assertTrue(hdd2.isSlideNumberVisible());
+ assertTrue(hdd2.isFooterVisible());
+ assertEquals("My notes footer", hdd2.getFooterText());
+ assertTrue(hdd2.isHeaderVisible());
+ assertEquals("My notes header", hdd2.getHeaderText());
+ }
+} \ No newline at end of file
diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCString.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCString.java
index 3f3d1a1447..df8e1a3dae 100644
--- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCString.java
+++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCString.java
@@ -46,12 +46,12 @@ public class TestCString extends TestCase {
}
public void testCount() throws Exception {
CString ca = new CString(data_a, 0, data_a.length);
- assertEquals(0, ca.getCount());
+ assertEquals(0, ca.getOptions());
CString cb = new CString(data_b, 0, data_a.length);
- assertEquals(0x10, cb.getCount());
+ assertEquals(0x10, cb.getOptions());
- ca.setCount(28);
- assertEquals(28, ca.getCount());
+ ca.setOptions(28);
+ assertEquals(28, ca.getOptions());
}
public void testText() throws Exception {
@@ -90,7 +90,7 @@ public class TestCString extends TestCase {
public void testChange() throws Exception {
CString ca = new CString(data_a, 0, data_a.length);
ca.setText("Comments");
- ca.setCount(0x10);
+ ca.setOptions(0x10);
try {
for(int i=0; i<data_a.length; i++) {
diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java
new file mode 100644
index 0000000000..e92998eabf
--- /dev/null
+++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java
@@ -0,0 +1,115 @@
+
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+
+
+package org.apache.poi.hslf.record;
+
+
+import junit.framework.TestCase;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import javax.imageio.stream.FileImageInputStream;
+
+import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
+import org.apache.poi.hslf.exceptions.EncryptedPowerPointFileException;
+import org.apache.poi.poifs.filesystem.DocumentEntry;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+
+/**
+ * Tests that CurrentUserAtom works properly.
+ *
+ * @author Nick Burch (nick at torchbox dot com)
+ */
+public class TestCurrentUserAtom extends TestCase {
+ /** Not encrypted */
+ private String normalFile;
+ /** Encrypted */
+ private String encFile;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ String dirname = System.getProperty("HSLF.testdata.path");
+ normalFile = dirname + "/basic_test_ppt_file.ppt";
+ encFile = dirname + "/Password_Protected-hello.ppt";
+ }
+
+ public void testReadNormal() throws Exception {
+ POIFSFileSystem fs = new POIFSFileSystem(
+ new FileInputStream(normalFile)
+ );
+
+ CurrentUserAtom cu = new CurrentUserAtom(fs);
+
+ // Check the contents
+ assertEquals("Hogwarts", cu.getLastEditUsername());
+ assertEquals(0x2942, cu.getCurrentEditOffset());
+
+ // Round trip
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ cu.writeOut(baos);
+
+ CurrentUserAtom cu2 = new CurrentUserAtom(baos.toByteArray());
+ assertEquals("Hogwarts", cu2.getLastEditUsername());
+ assertEquals(0x2942, cu2.getCurrentEditOffset());
+ }
+
+ public void testReadEnc() throws Exception {
+ POIFSFileSystem fs = new POIFSFileSystem(
+ new FileInputStream(encFile)
+ );
+
+ try {
+ new CurrentUserAtom(fs);
+ fail();
+ } catch(EncryptedPowerPointFileException e) {
+ // Good
+ }
+ }
+
+ public void testWriteNormal() throws Exception {
+ // Get raw contents from a known file
+ POIFSFileSystem fs = new POIFSFileSystem(
+ new FileInputStream(normalFile)
+ );
+ DocumentEntry docProps = (DocumentEntry)fs.getRoot().getEntry("Current User");
+ byte[] contents = new byte[docProps.getSize()];
+ InputStream in = fs.getRoot().createDocumentInputStream("Current User");
+ in.read(contents);
+
+ // Now build up a new one
+ CurrentUserAtom cu = new CurrentUserAtom();
+ cu.setLastEditUsername("Hogwarts");
+ cu.setCurrentEditOffset(0x2942);
+
+ // Check it matches
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ cu.writeOut(baos);
+ byte[] out = baos.toByteArray();
+
+ assertEquals(contents.length, out.length);
+ for(int i=0; i<contents.length; i++) {
+ assertEquals("Byte " + i, contents[i], out[i]);
+ }
+ }
+}
diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestHeadersFootersAtom.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestHeadersFootersAtom.java
new file mode 100644
index 0000000000..8c6972c6a5
--- /dev/null
+++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestHeadersFootersAtom.java
@@ -0,0 +1,95 @@
+
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+
+
+package org.apache.poi.hslf.record;
+
+
+import junit.framework.TestCase;
+import java.io.ByteArrayOutputStream;
+import java.util.Arrays;
+
+/**
+ * Tests that {@link HeadersFootersAtom} works properly
+ *
+ * @author Yegor Kozlov
+ */
+public class TestHeadersFootersAtom extends TestCase {
+ // From a real file
+ private byte[] data = new byte[] {
+ 0x00, 0x00, (byte)0xDA, 0x0F, 0x04, 0x00, 0x00, 00,
+ 0x00, 0x00, 0x23, 0x00 };
+
+ public void testRead() throws Exception {
+ HeadersFootersAtom record = new HeadersFootersAtom(data, 0, data.length);
+ assertEquals(RecordTypes.HeadersFootersAtom.typeID, record.getRecordType());
+
+ assertEquals(0, record.getFormatId());
+ assertEquals(0x23, record.getMask());
+
+ assertTrue(record.getFlag(HeadersFootersAtom.fHasDate));
+ assertTrue(record.getFlag(HeadersFootersAtom.fHasTodayDate));
+ assertFalse(record.getFlag(HeadersFootersAtom.fHasUserDate));
+ assertFalse(record.getFlag(HeadersFootersAtom.fHasSlideNumber));
+ assertFalse(record.getFlag(HeadersFootersAtom.fHasHeader));
+ assertTrue(record.getFlag(HeadersFootersAtom.fHasFooter));
+ }
+
+ public void testWrite() throws Exception {
+ HeadersFootersAtom record = new HeadersFootersAtom(data, 0, data.length);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ record.writeOut(baos);
+ byte[] b = baos.toByteArray();
+
+ assertTrue(Arrays.equals(data, b));
+ }
+
+ public void testNewRecord() throws Exception {
+ HeadersFootersAtom record = new HeadersFootersAtom();
+ record.setFlag(HeadersFootersAtom.fHasDate, true);
+ record.setFlag(HeadersFootersAtom.fHasTodayDate, true);
+ record.setFlag(HeadersFootersAtom.fHasFooter, true);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ record.writeOut(baos);
+ byte[] b = baos.toByteArray();
+
+ assertTrue(Arrays.equals(data, b));
+ }
+
+ public void testFlags() throws Exception {
+ HeadersFootersAtom record = new HeadersFootersAtom();
+
+ //in a new record all the bits are 0
+ for(int i = 0; i < 6; i++) assertFalse(record.getFlag(1 << i));
+
+ record.setFlag(HeadersFootersAtom.fHasTodayDate, true);
+ assertTrue(record.getFlag(HeadersFootersAtom.fHasTodayDate));
+
+ record.setFlag(HeadersFootersAtom.fHasTodayDate, true);
+ assertTrue(record.getFlag(HeadersFootersAtom.fHasTodayDate));
+
+ record.setFlag(HeadersFootersAtom.fHasTodayDate, false);
+ assertFalse(record.getFlag(HeadersFootersAtom.fHasTodayDate));
+
+ record.setFlag(HeadersFootersAtom.fHasTodayDate, false);
+ assertFalse(record.getFlag(HeadersFootersAtom.fHasTodayDate));
+
+ }
+} \ No newline at end of file
diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestHeadersFootersContainer.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestHeadersFootersContainer.java
new file mode 100644
index 0000000000..d24ca05f65
--- /dev/null
+++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestHeadersFootersContainer.java
@@ -0,0 +1,171 @@
+
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+
+
+package org.apache.poi.hslf.record;
+
+
+import junit.framework.TestCase;
+import java.io.ByteArrayOutputStream;
+import java.util.Arrays;
+
+/**
+ * Tests that {@link HeadersFootersContainer} works properly
+ *
+ * @author Yegor Kozlov
+ */
+public class TestHeadersFootersContainer extends TestCase {
+ // SlideHeadersFootersContainer
+ private byte[] slideData = new byte[] {
+ 0x3F, 0x00, (byte)0xD9, 0x0F, 0x2E, 0x00, 0x00, 0x00,
+ 0x00, 0x00, (byte)0xDA, 0x0F, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00,
+ 0x20, 0x00, (byte)0xBA, 0x0F, 0x1A, 0x00, 0x00, 0x00,
+ 0x4D, 0x00, 0x79, 0x00, 0x20, 0x00, 0x46, 0x00, 0x6F, 0x00, 0x6F, 0x00, 0x74,
+ 0x00, 0x65, 0x00, 0x72, 0x00, 0x20, 0x00, 0x2D, 0x00, 0x20, 0x00, 0x31, 0x00
+
+ };
+
+ // NotesHeadersFootersContainer
+ private byte[] notesData = new byte[] {
+ 0x4F, 0x00, (byte)0xD9, 0x0F, 0x48, 0x00, 0x00, 0x00,
+ 0x00, 0x00, (byte)0xDA, 0x0F, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3D, 0x00,
+ 0x10, 0x00, (byte)0xBA, 0x0F, 0x16, 0x00, 0x00, 0x00,
+ 0x4E, 0x00, 0x6F, 0x00, 0x74, 0x00, 0x65, 0x00, 0x20, 0x00, 0x48, 0x00,
+ 0x65, 0x00, 0x61, 0x00, 0x64, 0x00, 0x65, 0x00, 0x72, 0x00,
+ 0x20, 0x00, (byte)0xBA, 0x0F, 0x16, 0x00, 0x00, 0x00,
+ 0x4E, 0x00, 0x6F, 0x00, 0x74, 0x00, 0x65, 0x00, 0x20, 0x00, 0x46, 0x00,
+ 0x6F, 0x00, 0x6F, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00
+ };
+
+ public void testReadSlideHeadersFootersContainer() throws Exception {
+ HeadersFootersContainer record = new HeadersFootersContainer(slideData, 0, slideData.length);
+ assertEquals(RecordTypes.HeadersFooters.typeID, record.getRecordType());
+ assertEquals(HeadersFootersContainer.SlideHeadersFootersContainer, record.getOptions());
+ assertEquals(2, record.getChildRecords().length);
+
+ HeadersFootersAtom hdd = record.getHeadersFootersAtom();
+ assertNotNull(hdd);
+
+ CString csFooter = record.getFooterAtom();
+ assertNotNull(csFooter);
+ assertEquals(HeadersFootersContainer.FOOTERATOM, csFooter.getOptions() >> 4);
+
+ assertEquals("My Footer - 1", csFooter.getText());
+
+ assertNull(record.getUserDateAtom());
+ assertNull(record.getHeaderAtom());
+ }
+
+ public void testWriteSlideHeadersFootersContainer() throws Exception {
+ HeadersFootersContainer record = new HeadersFootersContainer(slideData, 0, slideData.length);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ record.writeOut(baos);
+ byte[] b = baos.toByteArray();
+
+ assertTrue(Arrays.equals(slideData, b));
+ }
+
+ public void testNewSlideHeadersFootersContainer() throws Exception {
+ HeadersFootersContainer record = new HeadersFootersContainer(HeadersFootersContainer.SlideHeadersFootersContainer);
+
+ assertNotNull(record.getHeadersFootersAtom());
+ assertNull(record.getUserDateAtom());
+ assertNull(record.getHeaderAtom());
+ assertNull(record.getFooterAtom());
+
+ HeadersFootersAtom hd = record.getHeadersFootersAtom();
+ hd.setFlag(HeadersFootersAtom.fHasDate, true);
+ hd.setFlag(HeadersFootersAtom.fHasTodayDate, true);
+ hd.setFlag(HeadersFootersAtom.fHasFooter, true);
+
+ CString csFooter = record.addFooterAtom();
+ assertNotNull(csFooter);
+ assertEquals(HeadersFootersContainer.FOOTERATOM, csFooter.getOptions() >> 4);
+ csFooter.setText("My Footer - 1");
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ record.writeOut(baos);
+ byte[] b = baos.toByteArray();
+
+ assertTrue(Arrays.equals(slideData, b));
+ }
+
+ public void testReadNotesHeadersFootersContainer() throws Exception {
+ HeadersFootersContainer record = new HeadersFootersContainer(notesData, 0, notesData.length);
+ assertEquals(RecordTypes.HeadersFooters.typeID, record.getRecordType());
+ assertEquals(HeadersFootersContainer.NotesHeadersFootersContainer, record.getOptions());
+ assertEquals(3, record.getChildRecords().length);
+
+ HeadersFootersAtom hdd = record.getHeadersFootersAtom();
+ assertNotNull(hdd);
+
+ CString csHeader = record.getHeaderAtom();
+ assertNotNull(csHeader);
+ assertEquals(HeadersFootersContainer.HEADERATOM, csHeader.getOptions() >> 4);
+ assertEquals("Note Header", csHeader.getText());
+
+ CString csFooter = record.getFooterAtom();
+ assertNotNull(csFooter);
+ assertEquals(HeadersFootersContainer.FOOTERATOM, csFooter.getOptions() >> 4);
+ assertEquals("Note Footer", csFooter.getText());
+ }
+
+ public void testWriteNotesHeadersFootersContainer() throws Exception {
+ HeadersFootersContainer record = new HeadersFootersContainer(notesData, 0, notesData.length);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ record.writeOut(baos);
+ byte[] b = baos.toByteArray();
+
+ assertTrue(Arrays.equals(notesData, b));
+ }
+
+ public void testNewNotesHeadersFootersContainer() throws Exception {
+ HeadersFootersContainer record = new HeadersFootersContainer(HeadersFootersContainer.NotesHeadersFootersContainer);
+
+ assertNotNull(record.getHeadersFootersAtom());
+ assertNull(record.getUserDateAtom());
+ assertNull(record.getHeaderAtom());
+ assertNull(record.getFooterAtom());
+
+ HeadersFootersAtom hd = record.getHeadersFootersAtom();
+ hd.setFlag(HeadersFootersAtom.fHasDate, true);
+ hd.setFlag(HeadersFootersAtom.fHasTodayDate, false);
+ hd.setFlag(HeadersFootersAtom.fHasUserDate, true);
+ hd.setFlag(HeadersFootersAtom.fHasSlideNumber, true);
+ hd.setFlag(HeadersFootersAtom.fHasHeader, true);
+ hd.setFlag(HeadersFootersAtom.fHasFooter, true);
+
+ CString csHeader = record.addHeaderAtom();
+ assertNotNull(csHeader);
+ assertEquals(HeadersFootersContainer.HEADERATOM, csHeader.getOptions() >> 4);
+ csHeader.setText("Note Header");
+
+ CString csFooter = record.addFooterAtom();
+ assertNotNull(csFooter);
+ assertEquals(HeadersFootersContainer.FOOTERATOM, csFooter.getOptions() >> 4);
+ csFooter.setText("Note Footer");
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ record.writeOut(baos);
+ byte[] b = baos.toByteArray();
+
+ assertTrue(Arrays.equals(notesData, b));
+ }
+
+} \ No newline at end of file