From 529a1b36e4b23d77286a90ec2dcacbe327f4ab38 Mon Sep 17 00:00:00 2001 From: Sergey Vladimirov Date: Sun, 24 Jul 2011 18:40:42 +0000 Subject: [PATCH] Bug 44431 - HWPFDocument.write destroys fields - seems to be fixed some time ago, but other bugs prevented to see it. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1150461 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/status.xml | 1 + .../poi/hwpf/usermodel/TestProblems.java | 28 ++++++++----------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 7a874d208a..62fb95d3c4 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 44431 - HWPFDocument.write destroys fields 50401 - fixed EscherProperty to return property name instead of 'unknown' for complex properties Initial support for endnotes and footnotes in HWPF 51470 - avoid exception when cloning XSSF sheets with background images diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java index 84feac0994..a93db00ec5 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java @@ -458,26 +458,22 @@ public final class TestProblems extends HWPFTestCase { } /** - * [FAILING] Bug 44331 - Output is corrupted + * Bug 44331 - HWPFDocument.write destroys fields */ - public void test44431() { - HWPFDocument doc1 = HWPFTestDataSamples.openSampleFile("Bug44431.doc"); - WordExtractor extractor1 = new WordExtractor(doc1); + public void test44431() + { + HWPFDocument doc1 = HWPFTestDataSamples.openSampleFile( "Bug44431.doc" ); + WordExtractor extractor1 = new WordExtractor( doc1 ); - HWPFDocument doc2 = HWPFTestDataSamples.writeOutAndReadBack(doc1); - WordExtractor extractor2 = new WordExtractor(doc2); - try { - assertEquals(extractor1.getFooterText(), extractor2.getFooterText()); - assertEquals(extractor1.getHeaderText(), extractor2.getHeaderText()); - assertEquals( Arrays.toString( extractor1.getParagraphText() ), - Arrays.toString( extractor2.getParagraphText() ) ); + HWPFDocument doc2 = HWPFTestDataSamples.writeOutAndReadBack( doc1 ); + WordExtractor extractor2 = new WordExtractor( doc2 ); - assertEquals(extractor1.getText(), extractor2.getText()); + assertEquals( extractor1.getFooterText(), extractor2.getFooterText() ); + assertEquals( extractor1.getHeaderText(), extractor2.getHeaderText() ); + assertEquals( Arrays.toString( extractor1.getParagraphText() ), + Arrays.toString( extractor2.getParagraphText() ) ); - fixed("44431"); - } catch (AssertionFailedError e) { - // expected exception - } + assertEquals( extractor1.getText(), extractor2.getText() ); } /** -- 2.39.5