From e2c39b0598e4fe6c81cebfd01156b14754ede5de Mon Sep 17 00:00:00 2001 From: ABykiev Date: Thu, 16 May 2024 20:56:57 +0300 Subject: [PATCH 1/3] Update ExtendedNumerics.BigDecimal Fixes https://github.com/AdamWhiteHat/BigDecimal/issues/45 --- main/NPOI.Core.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/NPOI.Core.csproj b/main/NPOI.Core.csproj index 93aefb7ea..54cc21d1e 100644 --- a/main/NPOI.Core.csproj +++ b/main/NPOI.Core.csproj @@ -15,7 +15,7 @@ - + From 684a42cdadac28c5e8f9ecc1163c95be480b641e Mon Sep 17 00:00:00 2001 From: ABykiev Date: Wed, 12 Jun 2024 10:31:27 +0300 Subject: [PATCH 2/3] Attempt to fix test --- .../ooxml/XSSF/UserModel/TestXSSFWorkbook.cs | 46 +++++++++---------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/testcases/ooxml/XSSF/UserModel/TestXSSFWorkbook.cs b/testcases/ooxml/XSSF/UserModel/TestXSSFWorkbook.cs index 8d15d514f..afb296050 100644 --- a/testcases/ooxml/XSSF/UserModel/TestXSSFWorkbook.cs +++ b/testcases/ooxml/XSSF/UserModel/TestXSSFWorkbook.cs @@ -1027,7 +1027,6 @@ public void TestBug56957CloseWorkbook() FileInfo file = TempFile.CreateTempFile("TestBug56957_", ".xlsx"); //String dateExp = "Sun Nov 09 00:00:00 CET 2014"; DateTime dateExp = LocaleUtil.GetLocaleCalendar(2014, 11, 9); - IWorkbook workbook = null; try { // as the file is written to, we make a copy before actually working on it @@ -1036,38 +1035,35 @@ public void TestBug56957CloseWorkbook() Assert.IsTrue(file.Exists); // read-only mode works! - workbook = WorkbookFactory.Create(OPCPackage.Open(file, PackageAccess.READ)); - var dateAct = workbook.GetSheetAt(0).GetRow(0).GetCell(0, MissingCellPolicy.CREATE_NULL_AS_BLANK).DateCellValue; - Assert.AreEqual(dateExp, dateAct); - workbook.Close(); - workbook = null; + using(var workbook = WorkbookFactory.Create(OPCPackage.Open(file, PackageAccess.READ))) + { + var dateAct = workbook.GetSheetAt(0).GetRow(0).GetCell(0, MissingCellPolicy.CREATE_NULL_AS_BLANK).DateCellValue; + Assert.AreEqual(dateExp, dateAct); + } - workbook = WorkbookFactory.Create(OPCPackage.Open(file, PackageAccess.READ)); - dateAct = workbook.GetSheetAt(0).GetRow(0).GetCell(0, MissingCellPolicy.CREATE_NULL_AS_BLANK).DateCellValue; - Assert.AreEqual(dateExp, dateAct); - workbook.Close(); - workbook = null; + using(var workbook = WorkbookFactory.Create(OPCPackage.Open(file, PackageAccess.READ))) + { + var dateAct = workbook.GetSheetAt(0).GetRow(0).GetCell(0, MissingCellPolicy.CREATE_NULL_AS_BLANK).DateCellValue; + Assert.AreEqual(dateExp, dateAct); + } // now check read/write mode - workbook = WorkbookFactory.Create(OPCPackage.Open(file, PackageAccess.READ_WRITE)); - dateAct = workbook.GetSheetAt(0).GetRow(0).GetCell(0, MissingCellPolicy.CREATE_NULL_AS_BLANK).DateCellValue; - Assert.AreEqual(dateExp, dateAct); - workbook.Close(); - workbook = null; + using(var workbook = WorkbookFactory.Create(OPCPackage.Open(file, PackageAccess.READ_WRITE))) + { + var dateAct = workbook.GetSheetAt(0).GetRow(0).GetCell(0, MissingCellPolicy.CREATE_NULL_AS_BLANK).DateCellValue; + Assert.AreEqual(dateExp, dateAct); + } - workbook = WorkbookFactory.Create(OPCPackage.Open(file, PackageAccess.READ_WRITE)); - dateAct = workbook.GetSheetAt(0).GetRow(0).GetCell(0, MissingCellPolicy.CREATE_NULL_AS_BLANK).DateCellValue; - Assert.AreEqual(dateExp, dateAct); - workbook.Close(); - workbook = null; + using(var workbook = WorkbookFactory.Create(OPCPackage.Open(file, PackageAccess.READ_WRITE))) + { + var dateAct = workbook.GetSheetAt(0).GetRow(0).GetCell(0, MissingCellPolicy.CREATE_NULL_AS_BLANK).DateCellValue; + Assert.AreEqual(dateExp, dateAct); + } } finally { - if (workbook != null) - { - workbook.Close(); - } Assert.IsTrue(file.Exists); + file.Delete(); file.Refresh(); Assert.IsTrue(!file.Exists); From 84671bc73572aa7462456eb743f9e0ddc6274f35 Mon Sep 17 00:00:00 2001 From: ABykiev Date: Wed, 12 Jun 2024 10:38:58 +0300 Subject: [PATCH 3/3] Update TestXSSFWorkbook.cs --- testcases/ooxml/XSSF/UserModel/TestXSSFWorkbook.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testcases/ooxml/XSSF/UserModel/TestXSSFWorkbook.cs b/testcases/ooxml/XSSF/UserModel/TestXSSFWorkbook.cs index afb296050..ddafe36d3 100644 --- a/testcases/ooxml/XSSF/UserModel/TestXSSFWorkbook.cs +++ b/testcases/ooxml/XSSF/UserModel/TestXSSFWorkbook.cs @@ -1066,7 +1066,8 @@ public void TestBug56957CloseWorkbook() file.Delete(); file.Refresh(); - Assert.IsTrue(!file.Exists); + + Assert.IsFalse(file.Exists); } }