[Libreoffice-commits] core.git: sd/CppunitTest_sd_import_tests.mk sd/qa
sd/CppunitTest_sd_import_tests.mk |2 sd/qa/unit/data/odg/tdf114488.fodg | 365 + sd/qa/unit/import-tests.cxx| 15 + 3 files changed, 382 insertions(+) New commits: commit acab4a99dcab546927712657c3ca4399a1b06fbb Author: Samuel MehrbrodtDate: Thu Jan 18 15:01:29 2018 +0100 Unit test for tdf#114488 Change-Id: Ib9430d2c1cc05c7b73273270f8f96e716fc4dc3f Reviewed-on: https://gerrit.libreoffice.org/48129 Reviewed-by: Samuel Mehrbrodt Tested-by: Samuel Mehrbrodt diff --git a/sd/CppunitTest_sd_import_tests.mk b/sd/CppunitTest_sd_import_tests.mk index f12e200a29d6..27c7f9181b71 100644 --- a/sd/CppunitTest_sd_import_tests.mk +++ b/sd/CppunitTest_sd_import_tests.mk @@ -73,6 +73,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_import_tests,\ configmgr/source/configmgr \ dbaccess/util/dba \ desktop/source/deployment/deployment \ +drawinglayer/drawinglayer \ embeddedobj/util/embobj \ emfio/emfio \ filter/source/config/cache/filterconfig1 \ @@ -108,6 +109,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_import_tests,\ unoxml/source/rdf/unordf \ unoxml/source/service/unoxml \ uui/util/uui \ +xmlscript/util/xmlscript \ xmloff/util/xo \ xmlsecurity/util/xmlsecurity \ )) diff --git a/sd/qa/unit/data/odg/tdf114488.fodg b/sd/qa/unit/data/odg/tdf114488.fodg new file mode 100644 index ..41a3c497d380 --- /dev/null +++ b/sd/qa/unit/data/odg/tdf114488.fodg @@ -0,0 +1,365 @@ + + +http://www.w3.org/1999/xlink; xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:scr ipt="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office; xmlns:ooow="http://openoffice.org/2004/writer; xmlns:oooc="http://openoffice.org/2004/calc; xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:xforms="http://www.w3.org/2002/xforms; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xmlns:rpt="http://openoffice.org/2005/report; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:grddl="http://www.w3.org/2003/g/data-view#; xmlns:officeooo="http://openoffice.org/2009/office; xmlns:tableooo="http://openoffice.org/2009/table; xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xml ns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/; office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.graphics"> + 2016-12-14T10:36:44.07900PT2M21S1LibreOfficeDev/6.1.0.0.alpha0$Linux_X86_64 LibreOffice_project/d36007ffd98bc9ed2f8ca6151a5283bd46a92485 + + + -817 + -127 + 10457 + 6649 + + + view1 + false + false + true + true + false + false + false + false + true + 1500 + false + //8= + //8= + + false + true + true + 0 + 0 + true + true + true + 4 + 0 + -940 + 787 + 8624 + 6889 + 1270 + 1270 + 127 + 127 + 127 + 1 + 127 + 1 + false + 1500 + false + false + + + + + true + $(brandbaseurl)/share/palette%3B$(userpath)/config/standard.sob + 0 + $(brandbaseurl)/share/palette%3B$(userpath)/config/standard.soc + $(brandbaseurl)/share/palette%3B$(userpath)/config/standard.sod + 1270 + false + $(brandbaseurl)/share/palette%3B$(userpath)/config/standard.sog + $(brandbaseurl)/share/palette%3B$(userpath)/config/standard.soh + false + false + true + true + false + false + true + false + false + false + $(brandbaseurl)/share/palette%3B$(userpath)/config/standard.soe + false + 7 + 4 + false + 0 + low-resolution + + false + + false + 1
[Libreoffice-commits] core.git: sd/CppunitTest_sd_import_tests.mk sd/qa
sd/CppunitTest_sd_import_tests.mk |1 sd/qa/unit/import-tests.cxx | 41 +- 2 files changed, 20 insertions(+), 22 deletions(-) New commits: commit fb4296d14f0421e289afa5e456b75082cdf8716f Author: Miklos VajnaDate: Wed Jan 17 10:28:38 2018 +0100 CppunitTest_sd_import_tests: clean up manual model/frame/controller assembly Change-Id: I50341e783ad0964167dc9819a28aa1f264de44b0 Reviewed-on: https://gerrit.libreoffice.org/48032 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sd/CppunitTest_sd_import_tests.mk b/sd/CppunitTest_sd_import_tests.mk index 0307580ac9d7..f12e200a29d6 100644 --- a/sd/CppunitTest_sd_import_tests.mk +++ b/sd/CppunitTest_sd_import_tests.mk @@ -80,6 +80,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_import_tests,\ filter/source/svg/svgfilter \ filter/source/xmlfilteradaptor/xmlfa \ filter/source/xmlfilterdetect/xmlfd \ + filter/source/storagefilterdetect/storagefd \ forms/util/frm \ framework/util/fwk \ i18npool/util/i18npool \ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 52d7d0c44010..ea237604bf4e 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -70,6 +70,7 @@ #include #include #include +#include #include #include @@ -99,6 +100,8 @@ std::ostream& operator<<(std::ostream& rStrm, const uno::Reference& xRef) class SdImportTest : public SdModelTestBase { public: +virtual void setUp() override; + void testDocumentLayout(); void testSmoketest(); void testN759180(); @@ -244,6 +247,12 @@ public: CPPUNIT_TEST_SUITE_END(); }; +void SdImportTest::setUp() +{ +SdModelTestBase::setUp(); +mxDesktop.set(frame::Desktop::create(getComponentContext())); +} + /** Test document against a reference XML dump of shapes. If you want to update one of these tests, or add a new one, set the nUpdateMe @@ -1376,25 +1385,11 @@ void SdImportTest::testTdf99729() for (unsigned int i = 0; i < SAL_N_ELEMENTS(filenames); ++i) { // 1st check for new behaviour - having AnchoredTextOverflowLegacy compatibility flag set to false in settings.xml -sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(filenames[i]), ODP); - -const css::uno::Reference< css::frame::XFrame > xFrame = SfxFrame::CreateBlankFrame(); -CPPUNIT_ASSERT(xFrame.is()); -const css::uno::Reference< css::frame::XModel2 > xModel(xDocShRef->GetModel(), css::uno::UNO_QUERY); -CPPUNIT_ASSERT(xModel.is()); -const css::uno::Reference< css::frame::XController2 > xController(xModel->createViewController( -"Default", -css::uno::Sequence< css::beans::PropertyValue >(), -xFrame -), css::uno::UNO_QUERY); -CPPUNIT_ASSERT(xController.is()); -xController->attachModel(xModel.get()); -xModel->connectController(xController.get()); -xFrame->setComponent(xController->getComponentWindow(), xController.get()); -xController->attachFrame(xFrame); -xModel->setCurrentController(xController.get()); - -uno::Reference < uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); +uno::Reference xComponent += loadFromDesktop(m_directories.getURLFromSrc(filenames[i]), + "com.sun.star.presentation.PresentationDocument"); + +uno::Reference xContext = getComponentContext(); CPPUNIT_ASSERT(xContext.is()); uno::Reference< drawing::XGraphicExportFilter > xGraphicExporter = drawing::GraphicExportFilter::create(xContext); CPPUNIT_ASSERT(xGraphicExporter.is()); @@ -1416,7 +1411,10 @@ void SdImportTest::testTdf99729() aDescriptor[2].Name = "FilterData"; aDescriptor[2].Value <<= aFilterData; -uno::Reference< lang::XComponent > xPage(getPage(0, xDocShRef), uno::UNO_QUERY); +uno::Reference xDrawPagesSupplier(xComponent, uno::UNO_QUERY); +uno::Reference xPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +CPPUNIT_ASSERT(xPage.is()); xGraphicExporter->setSourceDocument(xPage); xGraphicExporter->filter(aDescriptor); @@ -1434,8 +1432,7 @@ void SdImportTest::testTdf99729() ++nonwhitecounts[i]; } } -xController->dispose(); -xFrame->dispose(); +xComponent->dispose(); } // The numbers 1-9 should be above the Text Box in rectangle 154,16 - 170,112. // If text alignment is wrong, the rectangle will be white. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org
[Libreoffice-commits] core.git: sd/CppunitTest_sd_import_tests.mk sd/qa
sd/CppunitTest_sd_import_tests.mk |2 + sd/qa/unit/data/pdf/txtpic.pdf|binary sd/qa/unit/import-tests.cxx | 43 ++ sd/qa/unit/sdmodeltestbase.hxx| 12 +++--- 4 files changed, 54 insertions(+), 3 deletions(-) New commits: commit 44337a1fdae8cdc68b6cf539166e60feea879a9b Author: Mihai Varga mihai.va...@collabora.com Date: Thu Feb 19 10:46:41 2015 +0200 Unit tests for PDF import The PDF file consists of a text section followed by an image. So in the first test there should be 2 shapes (text and image) while in the second test which has the SkipImages filter option, there should be a single shape. Change-Id: I30ba0a832b665aa2fd5182b18778b485c62d7590 Reviewed-on: https://gerrit.libreoffice.org/14552 Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com diff --git a/sd/CppunitTest_sd_import_tests.mk b/sd/CppunitTest_sd_import_tests.mk index 8a84e4c..c30aef6 100644 --- a/sd/CppunitTest_sd_import_tests.mk +++ b/sd/CppunitTest_sd_import_tests.mk @@ -77,6 +77,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_import_tests,\ embeddedobj/util/embobj \ filter/source/config/cache/filterconfig1 \ filter/source/svg/svgfilter \ +filter/source/xmlfilteradaptor/xmlfa \ forms/util/frm \ framework/util/fwk \ i18npool/util/i18npool \ @@ -88,6 +89,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_import_tests,\ sd/util/sd \ sd/util/sdfilt \ sd/util/sdd \ +sdext/source/pdfimport/pdfimport \ sfx2/util/sfx \ sot/util/sot \ svl/source/fsstor/fsstorage \ diff --git a/sd/qa/unit/data/pdf/txtpic.pdf b/sd/qa/unit/data/pdf/txtpic.pdf new file mode 100644 index 000..220c582 Binary files /dev/null and b/sd/qa/unit/data/pdf/txtpic.pdf differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index b401687..6e0710d 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -23,6 +23,8 @@ #include editeng/postitem.hxx #include rsc/rscsfx.hxx +#include sfx2/sfxsids.hrc +#include svl/stritem.hxx #include svx/svdotext.hxx #include svx/svdoashp.hxx #include svx/svdograf.hxx @@ -92,8 +94,11 @@ public: void testShapeLineStyle(); void testBnc862510_6(); void testBnc862510_7(); +void testPDFImport(); +void testPDFImportSkipImages(); CPPUNIT_TEST_SUITE(SdImportTest); + CPPUNIT_TEST(testDocumentLayout); CPPUNIT_TEST(testSmoketest); CPPUNIT_TEST(testN759180); @@ -123,6 +128,7 @@ public: CPPUNIT_TEST(testShapeLineStyle); CPPUNIT_TEST(testBnc862510_6); CPPUNIT_TEST(testBnc862510_7); +CPPUNIT_TEST(testPDFImport); CPPUNIT_TEST_SUITE_END(); }; @@ -1068,6 +1074,43 @@ void SdImportTest::testBnc862510_7() xDocShRef-DoClose(); } +void SdImportTest::testPDFImport() +{ +::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc(/sd/qa/unit/data/pdf/txtpic.pdf), PDF); +SdDrawDocument *pDoc = xDocShRef-GetDoc(); +CPPUNIT_ASSERT_MESSAGE( no document, pDoc != NULL ); +uno::Reference drawing::XDrawPagesSupplier xDoc(xDocShRef-GetDoc()-getUnoModel(), uno::UNO_QUERY_THROW ); +uno::Reference drawing::XDrawPage xPage(xDoc-getDrawPages()-getByIndex(0), uno::UNO_QUERY_THROW ); +CPPUNIT_ASSERT_MESSAGE( no exactly two shapes, xPage-getCount() == 2 ); + +uno::Reference drawing::XShape xShape(xPage-getByIndex(0), uno::UNO_QUERY_THROW ); +CPPUNIT_ASSERT_MESSAGE( failed to load shape, xShape.is() ); +uno::Referencetext::XText xText = uno::Referencetext::XTextRange(xShape, uno::UNO_QUERY)-getText(); +CPPUNIT_ASSERT_MESSAGE( not a text shape, xText.is() ); + +xDocShRef-DoClose(); +} + +void SdImportTest::testPDFImportSkipImages() +{ +SfxAllItemSet *pParams = new SfxAllItemSet( SfxGetpApp()-GetPool() ); +pParams-Put( SfxStringItem ( SID_FILE_FILTEROPTIONS, OUString(SkipImages) ) ); + +::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc(/sd/qa/unit/data/pdf/txtpic.pdf), PDF, pParams); +SdDrawDocument *pDoc = xDocShRef-GetDoc(); +CPPUNIT_ASSERT_MESSAGE( no document, pDoc != NULL ); +uno::Reference drawing::XDrawPagesSupplier xDoc(xDocShRef-GetDoc()-getUnoModel(), uno::UNO_QUERY_THROW ); +uno::Reference drawing::XDrawPage xPage(xDoc-getDrawPages()-getByIndex(0), uno::UNO_QUERY_THROW ); +CPPUNIT_ASSERT_MESSAGE( no exactly one shape, xPage-getCount() == 1 ); + +uno::Reference drawing::XShape xShape(xPage-getByIndex(0), uno::UNO_QUERY_THROW ); +CPPUNIT_ASSERT_MESSAGE( failed to load shape, xShape.is() ); +uno::Referencetext::XText xText = uno::Referencetext::XTextRange(xShape, uno::UNO_QUERY)-getText(); +CPPUNIT_ASSERT_MESSAGE( not a text shape, xText.is() ); + +xDocShRef-DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sd/qa/unit/sdmodeltestbase.hxx
[Libreoffice-commits] core.git: sd/CppunitTest_sd_import_tests.mk sd/qa
sd/CppunitTest_sd_import_tests.mk |2 + sd/qa/unit/data/fdo71075.odp |binary sd/qa/unit/import-tests.cxx | 56 ++ 3 files changed, 58 insertions(+) New commits: commit 3752d67c050f369f683ca60e50e0a30f59166449 Author: Muthu Subramanian sumu...@collabora.com Date: Wed Nov 6 15:37:20 2013 +0530 fdo#71075: Adding unit test for chart import (odp) diff --git a/sd/CppunitTest_sd_import_tests.mk b/sd/CppunitTest_sd_import_tests.mk index 8e0773c..a0f2ad9 100644 --- a/sd/CppunitTest_sd_import_tests.mk +++ b/sd/CppunitTest_sd_import_tests.mk @@ -67,6 +67,8 @@ $(eval $(call gb_CppunitTest_use_ure,sd_import_tests)) $(eval $(call gb_CppunitTest_use_components,sd_import_tests,\ animations/source/animcore/animcore \ basic/util/sb \ +chart2/source/chartcore \ +chart2/source/controller/chartcontroller \ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ diff --git a/sd/qa/unit/data/fdo71075.odp b/sd/qa/unit/data/fdo71075.odp new file mode 100644 index 000..b418faf Binary files /dev/null and b/sd/qa/unit/data/fdo71075.odp differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 6581726..2a7de2d 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -24,6 +24,14 @@ #include com/sun/star/animations/XAnimationNode.hpp #include com/sun/star/animations/XAnimate.hpp #include com/sun/star/beans/XPropertySet.hpp +#include com/sun/star/chart/XChartDocument.hpp +#include com/sun/star/chart2/XChartDocument.hpp +#include com/sun/star/chart2/XDataSeriesContainer.hpp +#include com/sun/star/chart2/XCoordinateSystemContainer.hpp +#include com/sun/star/chart2/XChartTypeContainer.hpp +#include com/sun/star/chart2/data/XLabeledDataSequence.hpp +#include com/sun/star/chart2/data/XDataSequence.hpp +#include com/sun/star/chart2/data/XNumericalDataSequence.hpp using namespace ::com::sun::star; @@ -36,6 +44,7 @@ public: void testN759180(); void testN778859(); void testFdo64512(); +void testFdo71075(); CPPUNIT_TEST_SUITE(SdFiltersTest); CPPUNIT_TEST(testDocumentLayout); @@ -43,6 +52,8 @@ public: CPPUNIT_TEST(testN759180); CPPUNIT_TEST(testN778859); CPPUNIT_TEST(testFdo64512); +CPPUNIT_TEST(testFdo71075); + CPPUNIT_TEST_SUITE_END(); }; @@ -227,6 +238,51 @@ void SdFiltersTest::testFdo64512() xTargetShape != xSvgShape ); } +// Unit test for importing charts +void SdFiltersTest::testFdo71075() +{ +double values[] = { 12.0, 13.0, 14.0 }; +::com::sun::star::uno::Any aAny; +::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc(/sd/qa/unit/data/fdo71075.odp)); +CPPUNIT_ASSERT_MESSAGE( failed to load, xDocShRef.Is() ); +CPPUNIT_ASSERT_MESSAGE( not in destruction, !xDocShRef-IsInDestruction() ); + +SdDrawDocument *pDoc = xDocShRef-GetDoc(); +CPPUNIT_ASSERT_MESSAGE( no document, pDoc != NULL ); +uno::Reference drawing::XDrawPagesSupplier xDoc(xDocShRef-GetDoc()-getUnoModel(), uno::UNO_QUERY_THROW ); +uno::Reference drawing::XDrawPage xPage(xDoc-getDrawPages()-getByIndex(0), uno::UNO_QUERY_THROW ); +uno::Reference drawing::XShape xShape(xPage-getByIndex(0), uno::UNO_QUERY_THROW ); +CPPUNIT_ASSERT_MESSAGE( failed to load shape, xShape.is() ); + +uno::Reference beans::XPropertySet xPropSet( xShape, uno::UNO_QUERY ); +aAny = xPropSet-getPropertyValue( OUString(Model) ); +CPPUNIT_ASSERT_MESSAGE( failed to load shape, aAny.hasValue() ); + +uno::Reference chart::XChartDocument xChartDoc; +aAny = xChartDoc; +CPPUNIT_ASSERT_MESSAGE( failed to load chart, xChartDoc.is() ); +uno::Reference chart2::XChartDocument xChart2Doc( xChartDoc, uno::UNO_QUERY ); +CPPUNIT_ASSERT_MESSAGE( failed to load chart, xChart2Doc.is() ); + +uno::Reference chart2::XCoordinateSystemContainer xBCooSysCnt( xChart2Doc-getFirstDiagram(), uno::UNO_QUERY ); +uno::Sequence uno::Reference chart2::XCoordinateSystem aCooSysSeq( xBCooSysCnt-getCoordinateSystems()); +uno::Reference chart2::XChartTypeContainer xCTCnt( aCooSysSeq[0], uno::UNO_QUERY ); + +uno::Reference chart2::XDataSeriesContainer xDSCnt( xCTCnt-getChartTypes()[0], uno::UNO_QUERY ); +CPPUNIT_ASSERT_MESSAGE( failed to load data series, xDSCnt.is() ); +uno::Sequence uno::Reference chart2::XDataSeries aSeriesSeq( xDSCnt-getDataSeries()); +CPPUNIT_ASSERT_MESSAGE( Invalid Series count, aSeriesSeq.getLength() == 1); +uno::Reference chart2::data::XDataSource xSource( aSeriesSeq[0], uno::UNO_QUERY ); +uno::Sequence uno::Reference chart2::data::XLabeledDataSequence aSeqCnt(xSource-getDataSequences()); +CPPUNIT_ASSERT_MESSAGE( Invalid Series count, aSeqCnt.getLength() == 1); +uno::Reference chart2::data::XDataSequence xValueSeq( aSeqCnt[0]-getValues() ); +CPPUNIT_ASSERT_MESSAGE( Invalid Data count,