[PATCH] SwDocStub now prints out parameters

Markus Mohrhard markus.mohrhard at googlemail.com
Sat Feb 18 09:25:41 PST 2012

Hello Daniel,

> It is, :)


> but i don't understand something.
> If it is about creating a child class then why is that we have to have
> not only virtual methods?

We don't want to create a child class but replace a class with another
class having exactly the same interface. This would allow us to break
dependencies during testing and make it possible that we don't need to
start a whole Libreoffice instance for tests.

There is first the ieda Cedric and I had in Brussels that we should
create stubs for some central sw classes and monitor the input into
them during file loading. This idea would make it much more easy to
test that the content is imported correctly. We have nice concepts for
such tests in calc and to some degree in impress/draw but we are
missing one for writer.

And then there is another great opportunity that it would make it
possible to write real unit tests. I hope that with this script it
might be possible to break nearly all dependencies and bring a class
under test control. My idea for this is that every time you need to
mock a class you create a test class with the same interface but with
all methods virtual and returning default values. If you now need a
special value for a class you can easily create a subclass overriding
just one method.

I know that both concepts are still in an early stage and we don't yet
know if they work or good but we will not know without trying.


More information about the LibreOffice mailing list