core.git: sw/CppunitTest_sw_ww8export.mk sw/qa

Michael Stahl mstahl at redhat.com
Wed Oct 21 06:18:08 PDT 2015


On 13.10.2015 11:09, Jan Holesovsky wrote:
>  sw/CppunitTest_sw_ww8export.mk       |    5 ++++-
>  sw/qa/extras/ww8export/ww8export.cxx |   32 ++++++++++++++++++++++++++++++++
>  2 files changed, 36 insertions(+), 1 deletion(-)
> 
> New commits:
> commit b630f9a36a844f46757abb6ce16fa7cd527a4341
> Author: Jan Holesovsky <kendy at collabora.com>
> Date:   Tue Oct 13 11:00:43 2015 +0200
> 
>     tdf#94386: Unit test stub - emulates the steps to trigger the bug.
>     

> @@ -53,6 +62,23 @@ protected:
>          }
>          return false;
>      }
> +
> +    virtual void postLoad(const char* pFilename) SAL_OVERRIDE

i don't appreciate this attempt to obfuscate the test with an obscure
event handler that contains half of the test logic.

if the test does something more than just load and store and verify,
then it would be better to define it in e.g. uiwriter.cxx with 5 lines
of explicit and copy-pasted load-store code wrapped around the code that
modifies the document model.

> +    {
> +        if (OString(pFilename) == "tdf94386.odt")
> +        {
> +            SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
> +            CPPUNIT_ASSERT(pTextDoc);
> +            SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
> +
> +            // emulate the behavior from tdf#94386 - insert an envelope to the
> +            // document
> +            SfxItemSet aSet(pWrtShell->GetView().GetCurShell()->GetPool(), FN_ENVELOP, FN_ENVELOP);
> +            aSet.Put(SwEnvItem());
> +            SfxRequest aRequest(FN_ENVELOP, SfxCallMode::SYNCHRON, aSet);
> +            SW_MOD()->ExecOther(aRequest);
> +        }
> +    }
>  };




More information about the LibreOffice mailing list