You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TestSXSSFBugs.java 3.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* ====================================================================
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. package org.apache.poi.xssf.usermodel;
  16. import static org.junit.Assert.assertEquals;
  17. import org.apache.poi.ss.usermodel.BaseTestBugzillaIssues;
  18. import org.apache.poi.ss.usermodel.PrintSetup;
  19. import org.apache.poi.ss.usermodel.Sheet;
  20. import org.apache.poi.ss.usermodel.Workbook;
  21. import org.apache.poi.ss.util.CellRangeAddress;
  22. import org.apache.poi.xssf.SXSSFITestDataProvider;
  23. import org.apache.poi.xssf.streaming.SXSSFWorkbook;
  24. import org.junit.Ignore;
  25. import org.junit.Test;
  26. public final class TestSXSSFBugs extends BaseTestBugzillaIssues {
  27. public TestSXSSFBugs() {
  28. super(SXSSFITestDataProvider.instance);
  29. }
  30. // override some tests which do not work for SXSSF
  31. @Override @Ignore("cloneSheet() not implemented") @Test public void bug18800() { /* cloneSheet() not implemented */ }
  32. @Override @Ignore("cloneSheet() not implemented") @Test public void bug22720() { /* cloneSheet() not implemented */ }
  33. @Override @Ignore("Evaluation is not fully supported") @Test public void bug47815() { /* Evaluation is not supported */ }
  34. @Override @Ignore("Evaluation is not fully supported") @Test public void test58113() { /* Evaluation is not supported */ }
  35. @Override @Ignore("Evaluation is not fully supported") @Test public void bug46729_testMaxFunctionArguments() { /* Evaluation is not supported */ }
  36. @Override @Ignore("Reading data is not supported") @Test public void bug57798() { /* Reading data is not supported */ }
  37. /**
  38. * Setting repeating rows and columns shouldn't break
  39. * any print settings that were there before
  40. */
  41. @Test
  42. public void bug49253() throws Exception {
  43. Workbook wb1 = new SXSSFWorkbook();
  44. Workbook wb2 = new SXSSFWorkbook();
  45. CellRangeAddress cra = CellRangeAddress.valueOf("C2:D3");
  46. // No print settings before repeating
  47. Sheet s1 = wb1.createSheet();
  48. s1.setRepeatingColumns(cra);
  49. s1.setRepeatingRows(cra);
  50. PrintSetup ps1 = s1.getPrintSetup();
  51. assertEquals(false, ps1.getValidSettings());
  52. assertEquals(false, ps1.getLandscape());
  53. // Had valid print settings before repeating
  54. Sheet s2 = wb2.createSheet();
  55. PrintSetup ps2 = s2.getPrintSetup();
  56. ps2.setLandscape(false);
  57. assertEquals(true, ps2.getValidSettings());
  58. assertEquals(false, ps2.getLandscape());
  59. s2.setRepeatingColumns(cra);
  60. s2.setRepeatingRows(cra);
  61. ps2 = s2.getPrintSetup();
  62. assertEquals(true, ps2.getValidSettings());
  63. assertEquals(false, ps2.getLandscape());
  64. wb1.close();
  65. wb2.close();
  66. }
  67. }