2009-05-20 20:55:56 -04: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.xssf.usermodel;
|
|
|
|
|
2013-08-26 16:09:19 -04:00
|
|
|
import java.io.IOException;
|
|
|
|
|
2009-05-20 20:55:56 -04:00
|
|
|
import org.apache.poi.ss.usermodel.BaseTestSheetShiftRows;
|
2013-08-26 16:09:19 -04:00
|
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
|
|
import org.apache.poi.ss.util.CellUtil;
|
2009-05-20 20:55:56 -04:00
|
|
|
import org.apache.poi.xssf.XSSFITestDataProvider;
|
2013-08-26 16:09:19 -04:00
|
|
|
import org.apache.poi.xssf.XSSFTestDataSamples;
|
2009-05-20 20:55:56 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Yegor Kozlov
|
|
|
|
*/
|
2009-12-25 19:25:59 -05:00
|
|
|
public final class TestXSSFSheetShiftRows extends BaseTestSheetShiftRows {
|
2009-05-20 20:55:56 -04:00
|
|
|
|
2009-12-25 19:25:59 -05:00
|
|
|
public TestXSSFSheetShiftRows(){
|
|
|
|
super(XSSFITestDataProvider.instance);
|
2009-05-20 20:55:56 -04:00
|
|
|
}
|
|
|
|
|
2009-12-25 19:25:59 -05:00
|
|
|
public void testShiftRowBreaks() { // disabled test from superclass
|
|
|
|
// TODO - support shifting of page breaks
|
2009-05-20 20:55:56 -04:00
|
|
|
}
|
|
|
|
|
2009-12-25 19:25:59 -05:00
|
|
|
public void testShiftWithComments() { // disabled test from superclass
|
|
|
|
// TODO - support shifting of comments.
|
2009-05-20 20:55:56 -04:00
|
|
|
}
|
2013-08-26 16:09:19 -04:00
|
|
|
|
|
|
|
public void testBug54524() throws IOException {
|
|
|
|
XSSFWorkbook workbook = XSSFTestDataSamples.openSampleWorkbook("54524.xlsx");
|
|
|
|
XSSFSheet sheet = workbook.getSheetAt(0);
|
|
|
|
sheet.shiftRows(3, 5, -1);
|
|
|
|
|
|
|
|
Cell cell = CellUtil.getCell(sheet.getRow(1), 0);
|
|
|
|
assertEquals(1.0, cell.getNumericCellValue());
|
|
|
|
cell = CellUtil.getCell(sheet.getRow(2), 0);
|
|
|
|
assertEquals("SUM(A2:A2)", cell.getCellFormula());
|
|
|
|
cell = CellUtil.getCell(sheet.getRow(3), 0);
|
|
|
|
assertEquals("X", cell.getStringCellValue());
|
|
|
|
}
|
2009-05-20 20:55:56 -04:00
|
|
|
}
|