Return-Path: Delivered-To: apmail-jakarta-poi-dev-archive@www.apache.org Received: (qmail 40751 invoked from network); 2 Aug 2005 17:17:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 2 Aug 2005 17:17:02 -0000 Received: (qmail 2586 invoked by uid 500); 2 Aug 2005 17:17:00 -0000 Delivered-To: apmail-jakarta-poi-dev-archive@jakarta.apache.org Received: (qmail 2509 invoked by uid 500); 2 Aug 2005 17:17:00 -0000 Mailing-List: contact poi-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "POI Developers List" Reply-To: "POI Developers List" Delivered-To: mailing list poi-dev@jakarta.apache.org Received: (qmail 2460 invoked by uid 500); 2 Aug 2005 17:16:59 -0000 Received: (qmail 2439 invoked by uid 99); 2 Aug 2005 17:16:59 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 02 Aug 2005 10:16:48 -0700 Received: (qmail 40540 invoked by uid 2084); 2 Aug 2005 17:16:46 -0000 Date: 2 Aug 2005 17:16:46 -0000 Message-ID: <20050802171646.40538.qmail@minotaur.apache.org> From: nick@apache.org To: jakarta-poi-cvs@apache.org Subject: cvs commit: jakarta-poi/src/scratchpad/testcases/org/apache/poi/hslf/record TestFontCollection.java X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N nick 2005/08/02 10:16:46 Added: src/scratchpad/testcases/org/apache/poi/hslf/record TestFontCollection.java Log: Tests for Font support from Yegor, from Bug #35972 Revision Changes Path 1.1 jakarta-poi/src/scratchpad/testcases/org/apache/poi/hslf/record/TestFontCollection.java Index: TestFontCollection.java =================================================================== /* ==================================================================== 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; import java.io.ByteArrayOutputStream; import java.util.Arrays; /** * Tests FontCollection and FontEntityAtom records * * @author Yegor Kozlov */ public class TestFontCollection extends TestCase { // From a real file private byte[] data = new byte[] { 0x0F, 0x00, 0xD5-256, 0x07, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB7-256, 0x0F, 0x44, 0x00, 0x00, 0x00, 0x54, 0x00, 0x69, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x73, 0x00, 0x20, 0x00, 0x4E, 0x00, 0x65, 0x00, 0x77, 0x00, 0x20, 0x00, 0x52, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x74, 0x34, 0xB8-256, 0x00, 0x7C, 0xDA-256, 0x12, 0x00, 0x64, 0xDA-256, 0x12, 0x00, 0x76, 0xC7-256, 0x0B, 0x30, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xDA-256, 0x12, 0x00, 0x28, 0xDD-256, 0x0D, 0x30, 0x00, 0x00, 0x04, 0x00 }; public void testFonts() throws Exception { FontCollection fonts = new FontCollection(data, 0, data.length); Record[] child = fonts.getChildRecords(); assertEquals(child.length, 1); FontEntityAtom fnt = (FontEntityAtom)child[0]; assertEquals(fnt.getFontName(), "Times New Roman"); } public void testAddFont() throws Exception { FontCollection fonts = new FontCollection(data, 0, data.length); int idx = fonts.addFont("Times New Roman"); assertEquals(idx, 0); idx = fonts.addFont("Helvetica"); assertEquals(idx, 1); idx = fonts.addFont("Arial"); assertEquals(idx, 2); idx = fonts.addFont("Arial"); //the font being added twice assertEquals(idx, 2); //font collection should contain 3 fonts Record[] child = fonts.getChildRecords(); assertEquals(child.length, 3); } public void testWrite() throws Exception { FontCollection fonts = new FontCollection(data, 0, data.length); ByteArrayOutputStream out = new ByteArrayOutputStream(); fonts.writeOut(out); byte[] recdata = out.toByteArray(); assertTrue(Arrays.equals(recdata, data)); } } --------------------------------------------------------------------- To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta POI Project: http://jakarta.apache.org/poi/