[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - 4 commits - officecfg/registry sc/qa sd/qa sw/qa

Zolnai Tamás tamas.zolnai at collabora.com
Sun Dec 7 07:36:23 PST 2014


 officecfg/registry/schema/org/openoffice/Office/Common.xcs      |    2 
 sc/qa/unit/data/ods/document_with_linked_graphic.ods            |binary
 sc/qa/unit/data/ods/linked_graphic.jpg                          |binary
 sc/qa/unit/subsequent_export-test.cxx                           |   42 ++++++
 sd/qa/unit/data/odp/document_with_linked_graphic.odp            |binary
 sd/qa/unit/data/odp/linked_graphic.jpg                          |binary
 sd/qa/unit/export-tests.cxx                                     |   48 +++++++
 sw/qa/extras/globalfilter/data/document_with_linked_graphic.odt |binary
 sw/qa/extras/globalfilter/data/linked_graphic.jpg               |binary
 sw/qa/extras/globalfilter/globalfilter.cxx                      |   63 ++++++++++
 10 files changed, 154 insertions(+), 1 deletion(-)

New commits:
commit 3b89e351c128cb3d6eea6061d1a4e4a0bffdc9da
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri Dec 5 18:07:26 2014 +0100

    Test for linked graphic export / import of Writer
    
    Change-Id: Ib41921e9ceed30a05e16ace298d9c5dc87cc5458
    (cherry picked from commit 3f28f67084f12fd806e05020ed8bac8d5a05c025)

diff --git a/sw/qa/extras/globalfilter/data/document_with_linked_graphic.odt b/sw/qa/extras/globalfilter/data/document_with_linked_graphic.odt
new file mode 100644
index 0000000..e7aeda6
Binary files /dev/null and b/sw/qa/extras/globalfilter/data/document_with_linked_graphic.odt differ
diff --git a/sw/qa/extras/globalfilter/data/linked_graphic.jpg b/sw/qa/extras/globalfilter/data/linked_graphic.jpg
new file mode 100644
index 0000000..2218cdd
Binary files /dev/null and b/sw/qa/extras/globalfilter/data/linked_graphic.jpg differ
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx
index a08c916..7478753 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -25,9 +25,11 @@ public:
     Test() : SwModelTestBase() {}
 
     void testSwappedOutImageExport();
+    void testLinkedGraphicRT();
 
     CPPUNIT_TEST_SUITE(Test);
     CPPUNIT_TEST(testSwappedOutImageExport);
+    CPPUNIT_TEST(testLinkedGraphicRT);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -114,6 +116,67 @@ void Test::testSwappedOutImageExport()
     }
 }
 
+void Test::testLinkedGraphicRT()
+{
+    const std::vector<OUString> aFilterNames = {
+        "writer8",
+//        "Rich Text Format",  Note: picture is there, but SwGrfNode is not found?
+        "MS Word 97",
+        "Office Open XML Text",
+    };
+
+    for( size_t nFilter = 0; nFilter < aFilterNames.size(); ++nFilter )
+    {
+        if (mxComponent.is())
+            mxComponent->dispose();
+        mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/globalfilter/data/document_with_linked_graphic.odt"), "com.sun.star.text.TextDocument");
+
+        const OString sFailedMessage = OString("Failed on filter: ")
+            + OUStringToOString(aFilterNames[nFilter], RTL_TEXTENCODING_ASCII_US);
+
+
+        // Export the document and import again for a check
+        uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+
+        utl::MediaDescriptor aMediaDescriptor;
+        aMediaDescriptor["FilterName"] <<= aFilterNames[nFilter];
+
+        utl::TempFile aTempFile;
+        aTempFile.EnableKillingFile();
+        xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
+        uno::Reference< lang::XComponent > xComponent(xStorable, uno::UNO_QUERY);
+        xComponent->dispose();
+        mxComponent = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.text.TextDocument");
+
+        SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pTxtDoc);
+        SwDoc* pDoc = pTxtDoc->GetDocShell()->GetDoc();
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pDoc);
+        SwNodes& aNodes = pDoc->GetNodes();
+
+        // Find the image
+        bool bImageFound = false;
+        for( sal_uLong nIndex = 0; nIndex < aNodes.Count(); ++nIndex)
+        {
+            if( aNodes[nIndex]->IsGrfNode() )
+            {
+                SwGrfNode* pGrfNode = aNodes[nIndex]->GetGrfNode();
+                // RT via DOCX makes linked graphic embedded?!
+                if( aFilterNames[nFilter] != "Office Open XML Text" )
+                {
+                    CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pGrfNode->IsGrfLink());
+                }
+                const GraphicObject& rGraphicObj = pGrfNode->GetGrfObj(true);
+                CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), !rGraphicObj.IsSwappedOut());
+                CPPUNIT_ASSERT_EQUAL_MESSAGE( sFailedMessage.getStr(), GRAPHIC_BITMAP, rGraphicObj.GetType());
+                CPPUNIT_ASSERT_EQUAL_MESSAGE( sFailedMessage.getStr(), sal_uLong(864900), rGraphicObj.GetSizeBytes());
+                bImageFound = true;
+            }
+        }
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), bImageFound);
+    }
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 3bebda6335340e6bc15f1bf8427ed95813340d80
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri Dec 5 00:40:55 2014 +0100

    Test for linked graphic export / import of Calc
    
    To avoid regression fixed by:
    02b17c1bbdd19a978b9de646c0dacdad179c60de
    
    Change-Id: Iaf2dea0cf221cb0e53debe4c1c611aab86dc29ff
    (cherry picked from commit ff8f2cb8ebde75cce65bb715fefcad778d568fe4)

diff --git a/sc/qa/unit/data/ods/document_with_linked_graphic.ods b/sc/qa/unit/data/ods/document_with_linked_graphic.ods
new file mode 100644
index 0000000..14cad8c
Binary files /dev/null and b/sc/qa/unit/data/ods/document_with_linked_graphic.ods differ
diff --git a/sc/qa/unit/data/ods/linked_graphic.jpg b/sc/qa/unit/data/ods/linked_graphic.jpg
new file mode 100644
index 0000000..2218cdd
Binary files /dev/null and b/sc/qa/unit/data/ods/linked_graphic.jpg differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 8aff9e1..33312e4 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -130,7 +130,9 @@ public:
 
     void testPivotTableXLSX();
     void testPivotTableTwoDataFieldsXLSX();
+
     void testSwappedOutImageExport();
+    void testLinkedGraphicRT();
 
     void testSupBookVirtualPath();
 
@@ -177,6 +179,7 @@ public:
     CPPUNIT_TEST(testSupBookVirtualPath);
 #endif
     CPPUNIT_TEST(testSwappedOutImageExport);
+    CPPUNIT_TEST(testLinkedGraphicRT);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -2375,6 +2378,45 @@ void ScExportTest::testSupBookVirtualPath()
     xDocSh->DoClose();
 }
 
+void ScExportTest::testLinkedGraphicRT()
+{
+    // Problem was with linked images
+    const char* aFilterNames[] = {
+        "calc8",
+        "MS Excel 97",
+        "Calc Office Open XML",
+        "generic_HTML",
+    };
+
+    for( size_t nFilter = 0; nFilter < SAL_N_ELEMENTS(aFilterNames); ++nFilter )
+    {
+        // Load the original file with one image
+        ScDocShellRef xDocSh = loadDoc("document_with_linked_graphic.", ODS);
+        const OString sFailedMessage = OString("Failed on filter: ") + aFilterNames[nFilter];
+
+        // Export the document and import again for a check
+        ScDocShellRef xDocSh2 = saveAndReload(xDocSh, nFilter);
+        xDocSh->DoClose();
+
+        // Check whether graphic imported well after export
+        ScDocument& rDoc = xDocSh->GetDocument();
+        ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
+        CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pDrawLayer != NULL );
+        const SdrPage *pPage = pDrawLayer->GetPage(0);
+        CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pPage != NULL );
+        SdrGrafObj* pObject = dynamic_cast<SdrGrafObj*>(pPage->GetObj(0));
+        CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pObject != NULL );
+        CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pObject->IsLinkedGraphic() );
+
+        const GraphicObject& rGraphicObj = pObject->GetGraphicObject(true);
+        CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), !rGraphicObj.IsSwappedOut());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE( sFailedMessage.getStr(), GRAPHIC_BITMAP, rGraphicObj.GetGraphic().GetType());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE( sFailedMessage.getStr(), sal_uLong(864900), rGraphicObj.GetSizeBytes());
+
+        xDocSh2->DoClose();
+    }
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 65ecd966c5f8a67cb385724ae62b93915f519b38
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri Dec 5 00:39:01 2014 +0100

    Test for linked graphic export / import of Impress
    
    To avoid regression fixed by:
    02b17c1bbdd19a978b9de646c0dacdad179c60de
    
    It seems PPTX import is broken now.
    
    Change-Id: I17228f4d8511b43d028b9ed8a6e77505e6143860
    (cherry picked from commit 33e49c711c988dfbbb75b605878850f83180a796)

diff --git a/sd/qa/unit/data/odp/document_with_linked_graphic.odp b/sd/qa/unit/data/odp/document_with_linked_graphic.odp
new file mode 100644
index 0000000..b0c327d
Binary files /dev/null and b/sd/qa/unit/data/odp/document_with_linked_graphic.odp differ
diff --git a/sd/qa/unit/data/odp/linked_graphic.jpg b/sd/qa/unit/data/odp/linked_graphic.jpg
new file mode 100644
index 0000000..2218cdd
Binary files /dev/null and b/sd/qa/unit/data/odp/linked_graphic.jpg differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 189dbf2..7b17668 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -79,6 +79,7 @@ public:
     void testFdo83751();
     void testFdo79731();
     void testSwappedOutImageExport();
+    void testLinkedGraphicRT();
 
     CPPUNIT_TEST_SUITE(SdExportTest);
     CPPUNIT_TEST(testN821567);
@@ -96,6 +97,7 @@ public:
     CPPUNIT_TEST(testFdo83751);
     CPPUNIT_TEST(testFdo79731);
     CPPUNIT_TEST(testSwappedOutImageExport);
+    CPPUNIT_TEST(testLinkedGraphicRT);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -590,6 +592,52 @@ void SdExportTest::testSwappedOutImageExport()
     }
 }
 
+void SdExportTest::testLinkedGraphicRT()
+{
+    // Problem was with linked images
+    const sal_Int32 vFormats[] = {
+        ODP,
+        PPT,
+//      PPTX, -> this fails now, need a fix
+    };
+
+    for( size_t nExportFormat = 0; nExportFormat < SAL_N_ELEMENTS(vFormats); ++nExportFormat )
+    {
+        // Load the original file with one image
+        ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/document_with_linked_graphic.odp"), ODP);
+        const OString sFailedMessage = OString("Failed on filter: ") + OString(aFileFormats[vFormats[nExportFormat]].pFilterName);
+
+        // Export the document and import again for a check
+        uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY);
+        uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
+        utl::MediaDescriptor aMediaDescriptor;
+        aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8);
+
+        utl::TempFile aTempFile;
+        aTempFile.EnableKillingFile();
+        xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
+        xComponent.set(xStorable, uno::UNO_QUERY);
+        xComponent->dispose();
+        xDocShRef = loadURL(aTempFile.GetURL(), nExportFormat);
+
+        // Check whether graphic imported well after export
+        SdDrawDocument *pDoc = xDocShRef->GetDoc();
+        CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pDoc != NULL );
+        const SdrPage *pPage = pDoc->GetPage(1);
+        CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pPage != NULL );
+        SdrGrafObj* pObject = dynamic_cast<SdrGrafObj*>(pPage->GetObj(2));
+        CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pObject != NULL );
+        CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pObject->IsLinkedGraphic() );
+
+        const GraphicObject& rGraphicObj = pObject->GetGraphicObject(true);
+        CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), !rGraphicObj.IsSwappedOut());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE( sFailedMessage.getStr(), GRAPHIC_BITMAP, rGraphicObj.GetGraphic().GetType());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE( sFailedMessage.getStr(), sal_uLong(864900), rGraphicObj.GetSizeBytes());
+
+        xDocShRef->DoClose();
+    }
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 81e02099fc8095343c07bad110d5a01eaec5815c
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri Dec 5 15:01:30 2014 +0100

    Set back this 20 MB default value for compatibility reasons
    
    See also:
    dbdacc73ae154237314d599194cc686bd738a9bf
    
    This ten multiplier which was moved from the implementation
    to the settings is live in the code only from 4.4 version, so
    actually we can remove it without any problem, don't need to change
    the default value on the UI.
    I don't have any other reason to change that value so...
    
    Change-Id: Ia17874cafeb013b89eedc300710392763c868f44
    (cherry picked from commit 9d0f597cee004b4f09f87e3599a85fc2e3672ee9)

diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 719ed09..957fa0f 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -1466,7 +1466,7 @@
             objects.</desc>
             <label>Total Graphic Cache Size</label>
           </info>
-          <value>209715200</value>
+          <value>22000000</value>
         </prop>
         <prop oor:name="ObjectCacheSize" oor:type="xs:int" oor:nillable="false">
           <info>


More information about the Libreoffice-commits mailing list