incubator-odf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ian Cunningham (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ODFTOOLKIT-372) Simple API not setting heading style
Date Sat, 31 Aug 2013 04:17:51 GMT

    [ https://issues.apache.org/jira/browse/ODFTOOLKIT-372?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13755399#comment-13755399
] 

Ian Cunningham commented on ODFTOOLKIT-372:
-------------------------------------------

Added attachment for test case.
And one for the case of adding a paragraph to a section and then changing it to a Heading.
Which works in the document but the test fails to read the style name correctly.
                
> Simple API not setting heading style
> ------------------------------------
>
>                 Key: ODFTOOLKIT-372
>                 URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-372
>             Project: ODF Toolkit
>          Issue Type: Bug
>          Components: simple api
>    Affects Versions: 0.7-incubating
>            Reporter: Ian Cunningham
>         Attachments: 372.diff
>
>
> I created the following test in response to a recent email
> public class TextPropertiesTest { ...
> 	@Test
> 	public void testTextGetSetName() {
> 		try {
> 			TextDocument document = TextDocument.newTextDocument();
> 			Paragraph firstPara = document.getParagraphByIndex(0, false);
> 			firstPara.setTextContent("I am alive and should be a heading");
> 			firstPara.applyHeading();
> 			firstPara.setStyleName("Heading_20_1");
> 			String styleName = firstPara.getStyleName();
> 			
> 			Assert.assertEquals("Heading_20_1", styleName);
> 			
> 			//save
> 			document.save(ResourceUtilities.newTestOutputFile("testGetSetStyleName.odt"));
> 			
> 			TextDocument loadedDocument =  TextDocument.loadDocument(ResourceUtilities.newTestOutputFile("testGetSetStyleName.odt"));
> 			Paragraph loadedFirstPara = loadedDocument.getParagraphByIndex(0, false);
> 			String loadedStyleName = loadedFirstPara.getStyleName();
> 			
> 			Assert.assertEquals("Heading_20_1", loadedStyleName);
> 			
> 		} catch (Exception e) {
> 			LOGGER.log(Level.SEVERE, e.getMessage(), e);
> 			Assert.fail(e.getMessage());
> 		}
> 	}
> The Style Name returned is an empty string. 
> But I don't really understand the design well enough to figure out a solution.... just
yet.
> I can see the style is left at Standard 
>       <text:h text:outline-level="1" text:style-name="Standard">I am alive and
should be a heading</text:h>
> A work around is to get the underlying ODFElement and change its style. But that kind
of defeats the purpose of the API?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message