]> source.dussan.org Git - poi.git/commitdiff
Tests to ensure that RecordTypes.java is behaving as expected
authorNick Burch <nick@apache.org>
Fri, 8 Jul 2005 12:37:56 +0000 (12:37 +0000)
committerNick Burch <nick@apache.org>
Fri, 8 Jul 2005 12:37:56 +0000 (12:37 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353741 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordTypes.java [new file with mode: 0644]

diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordTypes.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordTypes.java
new file mode 100644 (file)
index 0000000..1f5f9e3
--- /dev/null
@@ -0,0 +1,59 @@
+
+/* ====================================================================
+   Copyright 2002-2004   Apache Software Foundation
+
+   Licensed 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;
+
+/**
+ * Tests that RecordTypes returns the right records and classes when asked
+ *
+ * @author Nick Burch (nick at torchbox dot com)
+ */
+public class TestRecordTypes extends TestCase {
+    public void testPPTNameLookups() throws Exception {
+               assertEquals("MainMaster", RecordTypes.recordName(1016));
+               assertEquals("TextBytesAtom", RecordTypes.recordName(4008));
+               assertEquals("VBAInfo", RecordTypes.recordName(1023));
+       }
+
+    public void testEscherNameLookups() throws Exception {
+               assertEquals("EscherDggContainer", RecordTypes.recordName(0xf000));
+               assertEquals("EscherClientTextbox", RecordTypes.recordName(0xf00d));
+               assertEquals("EscherSelection", RecordTypes.recordName(0xf119));
+       }
+
+       public void testPPTClassLookups() throws Exception {
+               assertEquals(Slide.class, RecordTypes.recordHandlingClass(1006));
+               assertEquals(TextCharsAtom.class, RecordTypes.recordHandlingClass(4000));
+               assertEquals(TextBytesAtom.class, RecordTypes.recordHandlingClass(4008));
+               assertEquals(SlideListWithText.class, RecordTypes.recordHandlingClass(4080));
+
+               // If this record is ever implemented, change to one that isn't!
+               // This is checking the "unhandled default" stuff works
+               assertEquals(UnknownRecordPlaceholder.class, RecordTypes.recordHandlingClass(2019));
+       }
+
+       public void testEscherClassLookups() throws Exception {
+               // Should all come back with null, as DDF handles them
+               assertEquals(null, RecordTypes.recordHandlingClass(0xf000));
+               assertEquals(null, RecordTypes.recordHandlingClass(0xf001));
+       }
+}