Tests to ensure that RecordTypes.java is behaving as expected

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353741 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2005-07-08 12:37:56 +00:00
parent 1332c0186a
commit fdb11ab3cc

View File

@ -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));
}
}