Skip to content

Some patches from poi 3.17#1520

Merged
tonyqus merged 9 commits into
nissl-lab:masterfrom
antony-liu:poi/v3.17-patch1
Apr 2, 2025
Merged

Some patches from poi 3.17#1520
tonyqus merged 9 commits into
nissl-lab:masterfrom
antony-liu:poi/v3.17-patch1

Conversation

@antony-liu
Copy link
Copy Markdown
Collaborator

@antony-liu antony-liu commented Mar 22, 2025

Main changes:
Use assertContains instead of assertTrue(text.contains) for better error messages on failure
POI 61007, use CellFormat for all format strings containing multiple parts (";" delimited) and update unit test to expect the same values as Excel. Also added tests for the failing formats.
bug 61049 fix ordering of builtin formulas

…parts (";" delimited) and update unit test to expect the same values as Excel. Also added tests for the failing formats.
# Conflicts:
#	testcases/main/HPSF/Extractor/TestHPSFPropertiesExtractor.cs
#	testcases/main/HSSF/EventUserModel/TestFormatTrackingHSSFListener.cs
#	testcases/main/HSSF/Extractor/TestExcelExtractor.cs
#	testcases/main/HSSF/UserModel/TestBugs.cs
#	testcases/main/POIFS/FileSystem/TestNPOIFSFileSystem.cs
#	testcases/main/SS/UserModel/TestDataFormatter.cs
#	testcases/ooxml/TestXMLPropertiesTextExtractor.cs
#	testcases/ooxml/XSSF/Streaming/TestSXSSFWorkbook.cs
#	testcases/ooxml/XWPF/Extractor/TestXWPFWordExtractor.cs
#	testcases/ooxml/XWPF/UserModel/TestXWPFSDT.cs
#	testcases/ooxml/XWPF/UserModel/TestXWPFSmartTag.cs
@tonyqus tonyqus added this to the NPOI 2.7.4 milestone Mar 22, 2025
@tonyqus
Copy link
Copy Markdown
Member

tonyqus commented Mar 29, 2025

Please list the poi bug id in the description

@tonyqus
Copy link
Copy Markdown
Member

tonyqus commented Mar 30, 2025

Can you help solve the conflict?

@antony-liu
Copy link
Copy Markdown
Collaborator Author

Conflict was resolved.

@tonyqus
Copy link
Copy Markdown
Member

tonyqus commented Apr 1, 2025

你这一大早就开始修bug啦,可以啊

@tonyqus tonyqus requested a review from Copilot April 1, 2025 23:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR applies several patches from poi 3.17 aimed at modernizing the test assertions, enhancing test coverage, and refining formatting logic. Key changes include:

  • Replacing ClassicAssert calls with POITestCase assertion methods across multiple test files.
  • Adjusting naming (e.g. renaming bug51675 to Bug51675) and adding new tests such as for conditional ranges and large file handling.
  • Improving locale handling and conditional format detection in DataFormatter, plus minor documentation updates.

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
testcases/ooxml/XWPF/UserModel/TestXWPFSmartTag.cs Updated assertion methods to POITestCase.AssertContains.
testcases/ooxml/XWPF/UserModel/TestXWPFSDT.cs Replaced ClassicAssert calls with POITestCase assertions.
testcases/ooxml/XWPF/Extractor/TestXWPFWordExtractor.cs Refined text extraction assertions with POITestCase.AssertStarts/EndsWith.
testcases/ooxml/TestXMLPropertiesTextExtractor.cs Updated assertions to use POITestCase.
testcases/main/SS/UserModel/TestDataFormatter.cs Added TestConditionalRanges and updated fraction formatting assertions.
testcases/main/SS/UserModel/BaseTestWorkbook.cs Made base test class inherit from POITestCase.
testcases/main/POIFS/FileSystem/TestNPOIFSFileSystem.cs Adjusted free block assertions and removed unused using directives.
testcases/main/HSSF/UserModel/TestBugs.cs Renamed test method to adhere to naming conventions and updated assertions.
testcases/main/HSSF/Extractor/TestExcelExtractor.cs Added extractor.Close() calls for resource cleanup.
testcases/main/HSSF/EventUserModel/TestFormatTrackingHSSFListener.cs Swapped expected format strings order to match intended outputs.
testcases/main/HPSF/Extractor/TestHPSFPropertiesExtractor.cs Refined assertions using AssertContains for property extraction tests.
ooxml/XSSF/Streaming/SXSSFWorkbook.cs Enhanced documentation regarding compression of temporary files.
main/SS/UserModel/DataFormatter.cs Improved conditional format logic and locale pattern handling.
main/SS/UserModel/BuiltinFormats.cs Adjusted built-in format ordering for consistency.
Comments suppressed due to low confidence (2)

testcases/main/HSSF/EventUserModel/TestFormatTrackingHSSFListener.cs:63

  • The expected format string for index 42 appears to have been swapped with the one for index 41. Please verify that the change is intentional.
ClassicAssert.AreEqual("_(\"$\"* #,##0_);_(\"$\"* (#,##0);_(\"$\"* "-"_);_(@_)", listener.GetFormatString(42));

main/SS/UserModel/DataFormatter.cs:329

  • The condition for handling conditional data formats has been altered from checking for 3+ parts to 2+ parts; please confirm that this change aligns with Excel's behavior and does not inadvertently affect the processing of formats.
if (formatStr.IndexOf(';') != -1 && (formatStr.IndexOf(';') != formatStr.LastIndexOf(';') || rangeConditionalPattern.IsMatch(formatStr)))

@tonyqus
Copy link
Copy Markdown
Member

tonyqus commented Apr 1, 2025

我去。。。copilot review 牛逼啊~~

@antony-liu
Copy link
Copy Markdown
Collaborator Author

出差,事不多,就搞搞代码

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants