Apache OpenOffice (AOO) Bugzilla – Issue 60116
StandaloneDocumentInfo unit test.
Last modified: 2013-02-24 21:07:44 UTC
Hi, as one can read, i still have problems using XStandaloneDocumentInfo ... using the code snippet to read and write the documentinfo from different files causes the following problems: *.sdw *.sxw *.odt read write read write read write oo 1.1.5 ok ok ok fails fails fails oo 2.0.1 fails fails ok fails ok fails regards Oliver REM ***** BASIC ***** Option Explicit Sub Main On Local Error Goto ErrorHandler Dim oSM, oDesk, oInfo As Object Dim sFile as String Dim sTitle as String sFile = "E:\test.sdw" ' sFile = "E:\test.sxw" ' sFile = "E:\test.odt" oSM = CreateObject("com.sun.star.ServiceManager") oInfo = oSM.createInstance("com.sun.star.document.StandaloneDocumentInfo") oInfo.loadFromURL(ConvertToUrl(sFile)) sTitle = oInfo.getPropertyValue("Title") msgBox sTitle oInfo.setPropertyValue("Title", "Hello World") oInfo.storeIntoURL(ConvertToUrl(sFile)) Exit Sub ErrorHandler: MsgBox Error() & Chr(13) & Erl() & Chr(13) & Err() End Sub
Created attachment 32950 [details] 3 test files zipped (*.sdw, *.sxw, *.odt)
sw->as: the problem with the sdw-files is most likely issue 36993 ... but the fact that we can't store document info in the other files looks like a new issue to me.
setting target
Hi, just noticed, that instantiating the service "com.sun.star.document.XStandaloneDocumentInfo" via OO 2.0.3 RC 5 causes a crash :-( SO 8.0 PU 3 is also affected ... so please change target milestone/priority ... Oliver
AS->brinzing: The last described problem is not realy a problem the StandaloneDocumentInfo service. It's a problem of the introspection of basic. Because basic tries to call the new created service before it was realy initialized ... because this service must be called within its method loadFromURL() first. Calling any other method before will throw an exception or produce a crash. Reason: without a related document this service cant work. see #i59538# for further informations.
.
Created attachment 49137 [details] The unit test for StandaloneDocumentInfo
The tests show that the scenario works well now for all the mentioned types of the documents. So the original problem was solved by the reimplementation of the service that was done some time ago. Since the problem is not reproducible, I am changing the title and use the bug to integrate the provided unit test in one of the next framework cws.
The unit test will be integrated for OOo2.4.
The patch has been integrated into fwk79 cws.
The test is integrated into fwk79.
Development issue, verified by myself.
Closing.