Struggling with LayerTabBar in unit test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I try to write a unit test for tdf#119956, but fail to work with LayerTabBar.

My start is:

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@DrawViewShell@sd@@QEAAXXZ) referenced in function "public: void __cdecl SdMiscTest::testTdf119956(void)" (?testTdf119956@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().


I have already changed sd/source/ui/view/ViewShellBase.cxx to use
sRequestedView = FrameworkHelper::msDrawViewURL; (see below) and as far as I can see in Visual Studio, I really get a Draw document and ShellType ST_DRAW.

Any idea?

Kind regards
Regina


diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index a01519d09661..0d510ef87e81 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -878,6 +878,19 @@ OUString ViewShellBase::GetInitialViewShellType()
         if ( ! (aAny >>= aProperties))
             break;

+ // Since OOo2 Draw has always IsLayerMode true, Impress always IsLayerMode false
+        // Use it to distinguish between Draw and Impress
+        bool bIsDraw = false;
+        for (sal_Int32 n=0; n<aProperties.getLength(); n++)
+        {
+            const beans::PropertyValue& rProperty (aProperties[n]);
+            if (rProperty.Name == sUNO_View_IsLayerMode)
+            {
+                rProperty.Value >>= bIsDraw;
+                break;
+            }
+        }
+
// Search the properties for the one that tells us what page kind to
         // use.
         for (sal_Int32 n=0; n<aProperties.getLength(); n++)
@@ -890,7 +903,11 @@ OUString ViewShellBase::GetInitialViewShellType()
                 switch (static_cast<PageKind>(nPageKind))
                 {
                     case PageKind::Standard:
-                        sRequestedView = FrameworkHelper::msImpressViewURL;
+                        if (bIsDraw)
+                        {
+ sRequestedView = FrameworkHelper::msDrawViewURL;
+                        }
+ // else sRequestedView = FrameworkHelper::msImpressViewURL, as initialized
                         break;

                     case PageKind::Handout:
_______________________________________________
LibreOffice mailing list
LibreOffice@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/libreoffice




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux