Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B3183200BA9 for ; Sun, 9 Oct 2016 01:41:16 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B1D49160AEF; Sat, 8 Oct 2016 23:41:16 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id EE250160ADF for ; Sun, 9 Oct 2016 01:41:15 +0200 (CEST) Received: (qmail 75247 invoked by uid 500); 8 Oct 2016 23:41:13 -0000 Mailing-List: contact commits-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@poi.apache.org Delivered-To: mailing list commits@poi.apache.org Received: (qmail 75194 invoked by uid 99); 8 Oct 2016 23:41:13 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Oct 2016 23:41:13 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 56118C0405 for ; Sat, 8 Oct 2016 23:41:13 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.999 X-Spam-Level: X-Spam-Status: No, score=-1.999 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 2LH_DcgKkgQu for ; Sat, 8 Oct 2016 23:41:12 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTP id 6A0A35F233 for ; Sat, 8 Oct 2016 23:41:11 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 1C62FE002B for ; Sat, 8 Oct 2016 23:41:09 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 2200F3A0233 for ; Sat, 8 Oct 2016 23:41:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1763937 - /poi/trunk/src/ooxml/testcases/org/apache/poi/ss/formula/TestFormulaParser.java Date: Sat, 08 Oct 2016 23:41:08 -0000 To: commits@poi.apache.org From: onealj@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20161008234109.2200F3A0233@svn01-us-west.apache.org> archived-at: Sat, 08 Oct 2016 23:41:16 -0000 Author: onealj Date: Sat Oct 8 23:41:08 2016 New Revision: 1763937 URL: http://svn.apache.org/viewvc?rev=1763937&view=rev Log: bug 60219: add disabled unit test for parsing formulas containing external workbook references with a quoted sheet name Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/ss/formula/TestFormulaParser.java Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/ss/formula/TestFormulaParser.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/ss/formula/TestFormulaParser.java?rev=1763937&r1=1763936&r2=1763937&view=diff ============================================================================== --- poi/trunk/src/ooxml/testcases/org/apache/poi/ss/formula/TestFormulaParser.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/ss/formula/TestFormulaParser.java Sat Oct 8 23:41:08 2016 @@ -28,11 +28,12 @@ import org.apache.poi.hssf.usermodel.HSS import org.apache.poi.ss.formula.ptg.AbstractFunctionPtg; import org.apache.poi.ss.formula.ptg.NameXPxg; import org.apache.poi.ss.formula.ptg.Ptg; +import org.apache.poi.ss.formula.ptg.Ref3DPxg; import org.apache.poi.ss.formula.ptg.StringPtg; import org.apache.poi.xssf.XSSFTestDataSamples; import org.apache.poi.xssf.usermodel.XSSFEvaluationWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; - +import org.junit.Ignore; import org.junit.Test; /** @@ -169,4 +170,39 @@ public class TestFormulaParser { assertNotNull(e.getMessage()); } } + + // trivial case for bug 60219: FormulaParser can't parse external references when sheet name is quoted + @Test + public void testParseExternalReferencesWithUnquotedSheetName() throws Exception { + XSSFWorkbook wb = new XSSFWorkbook(); + XSSFEvaluationWorkbook fpwb = XSSFEvaluationWorkbook.create(wb); + Ptg[] ptgs = FormulaParser.parse("[1]Sheet1!A1", fpwb, FormulaType.CELL, -1); + // org.apache.poi.ss.formula.ptg.Ref3DPxg [ [workbook=1] sheet=Sheet 1 ! A1] + assertEquals("Ptgs length", 1, ptgs.length); + assertTrue("Ptg class", ptgs[0] instanceof Ref3DPxg); + Ref3DPxg pxg = (Ref3DPxg) ptgs[0]; + assertEquals("External workbook number", 1, pxg.getExternalWorkbookNumber()); + assertEquals("Sheet name", "Sheet1", pxg.getSheetName()); + assertEquals("Row", 0, pxg.getRow()); + assertEquals("Column", 0, pxg.getColumn()); + wb.close(); + } + + // bug 60219: FormulaParser can't parse external references when sheet name is quoted + @Ignore + @Test + public void testParseExternalReferencesWithQuotedSheetName() throws Exception { + XSSFWorkbook wb = new XSSFWorkbook(); + XSSFEvaluationWorkbook fpwb = XSSFEvaluationWorkbook.create(wb); + Ptg[] ptgs = FormulaParser.parse("'[1]Sheet 1'!A1", fpwb, FormulaType.CELL, -1); + // org.apache.poi.ss.formula.ptg.Ref3DPxg [ [workbook=1] sheet=Sheet 1 ! A1] + assertEquals("Ptgs length", 1, ptgs.length); + assertTrue("Ptg class", ptgs[0] instanceof Ref3DPxg); + Ref3DPxg pxg = (Ref3DPxg) ptgs[0]; + assertEquals("External workbook number", 1, pxg.getExternalWorkbookNumber()); + assertEquals("Sheet name", "Sheet 1", pxg.getSheetName()); + assertEquals("Row", 0, pxg.getRow()); + assertEquals("Column", 0, pxg.getColumn()); + wb.close(); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org For additional commands, e-mail: commits-help@poi.apache.org