2007-01-01 16:02:22 -05:00
|
|
|
/* ====================================================================
|
|
|
|
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.usermodel;
|
|
|
|
|
2009-11-27 12:39:17 -05:00
|
|
|
import org.apache.poi.hssf.HSSFITestDataProvider;
|
2009-12-25 21:17:34 -05:00
|
|
|
import org.apache.poi.hssf.HSSFTestDataSamples;
|
2009-11-27 12:39:17 -05:00
|
|
|
import org.apache.poi.ss.usermodel.BaseTestCellComment;
|
Merged revisions 638786-638802,638805-638811,638813-638814,638816-639230,639233-639241,639243-639253,639255-639486,639488-639601,639603-639835,639837-639917,639919-640056,640058-640710,640712-641156,641158-641184,641186-641795,641797-641798,641800-641933,641935-641963,641965-641966,641968-641995,641997-642230,642232-642562,642564-642565,642568-642570,642572-642573,642576-642736,642739-642877,642879,642881-642890,642892-642903,642905-642945,642947-643624,643626-643653,643655-643669,643671,643673-643830,643832-643833,643835-644342,644344-644472,644474-644508,644510-645478 via svnmerge from
https://svn.apache.org:443/repos/asf/poi/trunk
........
r645348 | josh | 2008-04-07 04:02:03 +0100 (Mon, 07 Apr 2008) | 1 line
refactored all hssf junits to get test sample data in the in one place
........
r645352 | josh | 2008-04-07 04:23:04 +0100 (Mon, 07 Apr 2008) | 2 lines
30311 - More work on Conditional Formatting - patch from Dmitriy
........
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@645483 13f79535-47bb-0310-9956-ffa450edef68
2008-04-07 08:51:50 -04:00
|
|
|
|
2007-01-01 16:02:22 -05:00
|
|
|
/**
|
|
|
|
* Tests TestHSSFCellComment.
|
|
|
|
*
|
|
|
|
* @author Yegor Kozlov
|
|
|
|
*/
|
2009-11-27 12:39:17 -05:00
|
|
|
public final class TestHSSFComment extends BaseTestCellComment {
|
2007-01-01 16:02:22 -05:00
|
|
|
|
2009-12-25 21:17:34 -05:00
|
|
|
public TestHSSFComment() {
|
|
|
|
super(HSSFITestDataProvider.instance);
|
2009-11-27 12:39:17 -05:00
|
|
|
}
|
2008-04-02 20:23:59 -04:00
|
|
|
|
2009-12-25 21:17:34 -05:00
|
|
|
public void testDefaultShapeType() {
|
2009-11-27 12:39:17 -05:00
|
|
|
HSSFComment comment = new HSSFComment((HSSFShape)null, (HSSFAnchor)null);
|
2008-04-02 20:23:59 -04:00
|
|
|
assertEquals(HSSFSimpleShape.OBJECT_TYPE_COMMENT, comment.getShapeType());
|
2007-01-01 16:02:22 -05:00
|
|
|
}
|
|
|
|
|
2009-10-29 12:43:24 -04:00
|
|
|
/**
|
|
|
|
* HSSFCell#findCellComment should NOT rely on the order of records
|
|
|
|
* when matching cells and their cell comments. The correct algorithm is to map
|
|
|
|
*/
|
2009-12-25 21:17:34 -05:00
|
|
|
public void test47924() {
|
2009-10-29 12:43:24 -04:00
|
|
|
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("47924.xls");
|
|
|
|
HSSFSheet sheet = wb.getSheetAt(0);
|
|
|
|
HSSFCell cell;
|
|
|
|
HSSFComment comment;
|
|
|
|
|
|
|
|
cell = sheet.getRow(0).getCell(0);
|
|
|
|
comment = cell.getCellComment();
|
|
|
|
assertEquals("a1", comment.getString().getString());
|
|
|
|
|
|
|
|
cell = sheet.getRow(1).getCell(0);
|
|
|
|
comment = cell.getCellComment();
|
|
|
|
assertEquals("a2", comment.getString().getString());
|
|
|
|
|
|
|
|
cell = sheet.getRow(2).getCell(0);
|
|
|
|
comment = cell.getCellComment();
|
|
|
|
assertEquals("a3", comment.getString().getString());
|
|
|
|
|
|
|
|
cell = sheet.getRow(2).getCell(2);
|
|
|
|
comment = cell.getCellComment();
|
|
|
|
assertEquals("c3", comment.getString().getString());
|
|
|
|
|
|
|
|
cell = sheet.getRow(4).getCell(1);
|
|
|
|
comment = cell.getCellComment();
|
|
|
|
assertEquals("b5", comment.getString().getString());
|
|
|
|
|
|
|
|
cell = sheet.getRow(5).getCell(2);
|
|
|
|
comment = cell.getCellComment();
|
|
|
|
assertEquals("c6", comment.getString().getString());
|
|
|
|
}
|
2007-01-01 16:02:22 -05:00
|
|
|
}
|