aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache
diff options
context:
space:
mode:
Diffstat (limited to 'src/testcases/org/apache')
-rwxr-xr-xsrc/testcases/org/apache/poi/hssf/record/AllRecordTests.java1
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestStyleRecord.java33
-rw-r--r--src/testcases/org/apache/poi/util/TestStringUtil.java91
3 files changed, 34 insertions, 91 deletions
diff --git a/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java b/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java
index 5fb6f4aa03..edf62a9ad1 100755
--- a/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java
+++ b/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java
@@ -100,6 +100,7 @@ public final class AllRecordTests {
result.addTestSuite(TestSheetPropertiesRecord.class);
result.addTestSuite(TestSharedFormulaRecord.class);
result.addTestSuite(TestStringRecord.class);
+ result.addTestSuite(TestStyleRecord.class);
result.addTestSuite(TestSubRecord.class);
result.addTestSuite(TestSupBookRecord.class);
result.addTestSuite(TestTableRecord.class);
diff --git a/src/testcases/org/apache/poi/hssf/record/TestStyleRecord.java b/src/testcases/org/apache/poi/hssf/record/TestStyleRecord.java
new file mode 100644
index 0000000000..bfe11dd3a8
--- /dev/null
+++ b/src/testcases/org/apache/poi/hssf/record/TestStyleRecord.java
@@ -0,0 +1,33 @@
+/* ====================================================================
+ 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;
+
+import junit.framework.TestCase;
+/**
+ *
+ */
+public final class TestStyleRecord extends TestCase {
+ public void testUnicodeReadName() {
+ byte[] data = {
+ 17, 0, 9, 0, 1, 56, 94, -60, -119, 95, 0, 83, 0, 104, 0, 101, 0, 101, 0, 116, 0, 49, 0, 92, 40, //92, 36
+ };
+ RecordInputStream in = TestcaseRecordInputStream.create(StyleRecord.sid, data);
+ StyleRecord sr = new StyleRecord(in);
+ assertEquals("\u5E38\u89C4_Sheet1", sr.getName()); // "<Conventional>_Sheet1"
+ }
+}
diff --git a/src/testcases/org/apache/poi/util/TestStringUtil.java b/src/testcases/org/apache/poi/util/TestStringUtil.java
index b22439cd09..f1b5cfd954 100644
--- a/src/testcases/org/apache/poi/util/TestStringUtil.java
+++ b/src/testcases/org/apache/poi/util/TestStringUtil.java
@@ -42,43 +42,7 @@ public class TestStringUtil
super( name );
}
- /**
- * test simple form of getFromUnicode
- */
- public void testSimpleGetFromUnicode()
- {
- byte[] test_data = new byte[32];
- int index = 0;
-
- for ( int k = 0; k < 16; k++ )
- {
- test_data[index++] = (byte) 0;
- test_data[index++] = (byte) ( 'a' + k );
- }
-
- assertEquals( "abcdefghijklmnop",
- StringUtil.getFromUnicodeBE( test_data ) );
- }
-
- /**
- * test simple form of getFromUnicode with symbols with code below and more 127
- */
- public void testGetFromUnicodeSymbolsWithCodesMoreThan127()
- {
- byte[] test_data = new byte[]{0x04, 0x22,
- 0x04, 0x35,
- 0x04, 0x41,
- 0x04, 0x42,
- 0x00, 0x20,
- 0x00, 0x74,
- 0x00, 0x65,
- 0x00, 0x73,
- 0x00, 0x74,
- };
- assertEquals( "\u0422\u0435\u0441\u0442 test",
- StringUtil.getFromUnicodeBE( test_data ) );
- }
/**
* test getFromUnicodeHigh for symbols with code below and more 127
@@ -101,62 +65,7 @@ public class TestStringUtil
StringUtil.getFromUnicodeLE( test_data ) );
}
- /**
- * Test more complex form of getFromUnicode
- */
- public void testComplexGetFromUnicode()
- {
- byte[] test_data = new byte[32];
- int index = 0;
- for ( int k = 0; k < 16; k++ )
- {
- test_data[index++] = (byte) 0;
- test_data[index++] = (byte) ( 'a' + k );
- }
- assertEquals( "abcdefghijklmno",
- StringUtil.getFromUnicodeBE( test_data, 0, 15 ) );
- assertEquals( "bcdefghijklmnop",
- StringUtil.getFromUnicodeBE( test_data, 2, 15 ) );
- try
- {
- StringUtil.getFromUnicodeBE( test_data, -1, 16 );
- fail( "Should have caught ArrayIndexOutOfBoundsException" );
- }
- catch ( ArrayIndexOutOfBoundsException ignored )
- {
- // as expected
- }
- try
- {
- StringUtil.getFromUnicodeBE( test_data, 32, 16 );
- fail( "Should have caught ArrayIndexOutOfBoundsException" );
- }
- catch ( ArrayIndexOutOfBoundsException ignored )
- {
- // as expected
- }
-
- try
- {
- StringUtil.getFromUnicodeBE( test_data, 1, 16 );
- fail( "Should have caught IllegalArgumentException" );
- }
- catch ( IllegalArgumentException ignored )
- {
- // as expected
- }
-
- try
- {
- StringUtil.getFromUnicodeBE( test_data, 1, -1 );
- fail( "Should have caught IllegalArgumentException" );
- }
- catch ( IllegalArgumentException ignored )
- {
- // as expected
- }
- }
/**
* Test putCompressedUnicode