Struggling with LayerTabBar in unit test

Regina Henschel rb.henschel at t-online.de
Mon Sep 24 14:28:19 UTC 2018


Hi Stephan, hi Michael,

thank you. I have wondered about DLLPUBLIC, but never ask about it. 
Another piece learned.

I will try the SD_DLLPUBLIC approach. First I need to know, whether my 
idea for a test will work at all. Second step can be to find a better 
integration of the test.

Kind regards
Regina

Stephan Bergmann schrieb am 24-Sep-18 um 14:45:
> On 24/09/2018 14:24, Regina Henschel wrote:
>> void SdMiscTest::testTdf119956()
>> {
>>      sd::DrawDocShellRef xDocShRef =
>> Load(m_directories.getURLFromSrc("/sd/qa/unit/data/tdf119956.odg"), ODG);
>>      CPPUNIT_ASSERT_MESSAGE( "Failed to load file.", xDocShRef.is());
>>
>>      sd::DrawViewShell* pDrawViewShell =
>> dynamic_cast<sd::DrawViewShell*  >(xDocShRef->GetViewShell());
>>      CPPUNIT_ASSERT_MESSAGE( "No dynamic_cast to sd::DrawViewShell",
>> pDrawViewShell);
>>
>>      pDrawViewShell->ChangeEditMode(EditMode::MasterPage,true);
>>      pDrawViewShell->ResetActualLayer();
>> }
>>
>> The line pDrawViewShell->ResetActualLayer(); does not work. On make
>> sd.check I get the error:
>>
>> [build LNK] CppunitTest/test_sd_misc_tests.dll
>>     Creating library
>> D:/Build_localizedLayernames/core/workdir/LinkTarget/CppunitTest/itest_sd_misc_tests.lib
>> and object
>> D:/Build_localizedLayernames/core/workdir/LinkTarget/CppunitTest/itest_sd_misc_tests.exp
>>
>> misc-tests.o : error LNK2019: unresolved external symbol "public: void
>> __cdecl sd::DrawViewShell::ResetActualLayer(void)"
>> (?ResetActualLayer at DrawViewShell@sd@@QEAAXXZ) referenced in function
>> "public: void __cdecl SdMiscTest::testTdf119956(void)"
>> (?testTdf119956 at SdMiscTest@@QEAAXXZ)
>> D:/Build_localizedLayernames/core/workdir/LinkTarget/CppunitTest/test_sd_misc_tests.dll
>> : fatal error LNK1120: 1 unresolved externals
>> make[1]: ***
>> [D:/Build_localizedLayernames/core/solenv/gbuild/LinkTarget.mk:636:
>> D:/Build_localizedLayernames/core/workdir/LinkTarget/CppunitTest/test_sd_misc_tests.dll]
>> Error 96
>>
>> Similar for other methods, that use the LayerTabBar, e.g.
>> GetLayerTabControl() or GetTabLayerCount(). There are no problems in
>> the other lines, when I remove ResetActualLayer().
>
> sd::DrawViewShell::ResetActualLayer is not exported from Library_sd,
> hence the test code can't call it.  One hacky solution is to mark that
> function as SD_DLLPUBLIC in sd/source/ui/inc/DrawViewShell.hxx (probably
> with a comment that it is only exported for the needs of test code).
>
> (pDrawViewShell->ChangeEditMode calls a virtual method via vtable, so
> doesn't care if the called function isn't actually exported.)
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/libreoffice



More information about the LibreOffice mailing list