fixed re-serialization of tAttrChoose
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@707481 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9f1ad85e0e
commit
1369bb9314
@ -221,15 +221,12 @@ public final class AttrPtg extends ControlPtg {
|
||||
int[] jt = _jumpTable;
|
||||
if (jt != null) {
|
||||
int joff = offset+4;
|
||||
LittleEndian.putUShort(array, joff, _chooseFuncOffset);
|
||||
joff+=2;
|
||||
for (int i = 0; i < jt.length; i++) {
|
||||
LittleEndian.putUShort(array, joff, jt[i]);
|
||||
joff+=2;
|
||||
}
|
||||
LittleEndian.putUShort(array, joff, _chooseFuncOffset);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getSize()
|
||||
|
@ -41,6 +41,7 @@ public final class AllFormulaTests {
|
||||
result.addTestSuite(TestAreaErrPtg.class);
|
||||
result.addTestSuite(TestAreaPtg.class);
|
||||
result.addTestSuite(TestArrayPtg.class);
|
||||
result.addTestSuite(TestAttrPtg.class);
|
||||
result.addTestSuite(TestErrPtg.class);
|
||||
result.addTestSuite(TestExternalFunctionFormulas.class);
|
||||
result.addTestSuite(TestFormulaShifter.class);
|
||||
|
@ -0,0 +1,50 @@
|
||||
/* ====================================================================
|
||||
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.hssf.record.formula;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
|
||||
import org.apache.poi.hssf.record.RecordInputStream;
|
||||
import org.apache.poi.hssf.record.TestcaseRecordInputStream;
|
||||
import org.apache.poi.util.HexRead;
|
||||
|
||||
/**
|
||||
* Tests for {@link AttrPtg}.
|
||||
*
|
||||
* @author Josh Micich
|
||||
*/
|
||||
public final class TestAttrPtg extends AbstractPtgTestCase {
|
||||
|
||||
/**
|
||||
* Fix for bug visible around svn r706772.
|
||||
*/
|
||||
public void testReserializeAttrChoose() {
|
||||
byte[] data = HexRead.readFromString("19, 04, 03, 00, 08, 00, 11, 00, 1A, 00, 23, 00");
|
||||
RecordInputStream in = TestcaseRecordInputStream.createWithFakeSid(data);
|
||||
Ptg[] ptgs = Ptg.readTokens(data.length, in);
|
||||
byte[] data2 = new byte[data.length];
|
||||
try {
|
||||
Ptg.serializePtgs(ptgs, data2, 0);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new AssertionFailedError("incorrect re-serialization of tAttrChoose");
|
||||
}
|
||||
assertTrue(Arrays.equals(data, data2));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user