diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-06-18 10:05:38 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-06-18 10:24:54 +0200 |
commit | 860f543cdbf1d7ce8ddb3f9ad81c1c9aa41f02ed (patch) | |
tree | 0d299c43f863ad6ac6772999328a9c4e52310808 | |
parent | 836454d0c1a490066f12cbe6327422ffb1065426 (diff) |
chart2, sw: remaining textbox DOCX import test preparations
Ideally now all testcases handle both cases during DOCX import:
- current situation, when shape with text is imported as a Writer
TextFrame
- future situation, when shape with text will be imported as shape with
an assicated TextBox
Change-Id: I5b95ff4672cecf39eb744f8557f967ade73404c0
-rw-r--r-- | chart2/qa/extras/chart2export.cxx | 15 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 16 |
2 files changed, 28 insertions, 3 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index 21a9ece8de2e..851d67409dae 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -14,6 +14,7 @@ #include <com/sun/star/lang/XServiceName.hpp> #include <com/sun/star/packages/zip/ZipFileAccess.hpp> #include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/text/XTextFramesSupplier.hpp> #include <unotools/ucbstreamhelper.hxx> #include <rtl/strbuf.hxx> @@ -693,7 +694,19 @@ void Chart2ExportTest::testShapeFollowedByChart() CPPUNIT_ASSERT(pXmlDoc); OUString aValueOfFirstDocPR = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/w:drawing[1]/wp:inline[1]/wp:docPr[1]", "id"); - OUString aValueOfSecondDocPR = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[2]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:docPr[1]", "id"); + OUString aValueOfSecondDocPR; + + uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + if (xIndexAccess->getCount()) + { + // TODO TextBox: remove this when TextBox is enabled by default + // This second run is a bug, should be the first ideally + aValueOfSecondDocPR = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[2]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:docPr[1]", "id"); + } + else + aValueOfSecondDocPR = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:docPr[1]", "id"); + CPPUNIT_ASSERT( aValueOfFirstDocPR != aValueOfSecondDocPR ); } diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index ed2a4de2d1e0..a2c499774ad4 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1483,8 +1483,20 @@ DECLARE_OOXMLIMPORT_TEST(testDefaultSectBreakCols, "default-sect-break-cols.docx DECLARE_OOXMLIMPORT_TEST(testFdo69636, "fdo69636.docx") { // The problem was that the mso-layout-flow-alt:bottom-to-top VML shape property wasn't handled for sw text frames. - uno::Reference<text::XTextRange> xFrame(getShape(1), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(sal_Int32(900), getProperty<sal_Int32>(getRun(getParagraphOfText(1, xFrame->getText()), 1), "CharRotation")); + uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + if (xIndexAccess->getCount()) + { + // TODO TextBox: remove this when TextBox is enabled by default + uno::Reference<text::XTextRange> xFrame(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(900), getProperty<sal_Int32>(getRun(getParagraphOfText(1, xFrame->getText()), 1), "CharRotation")); + } + else + { + uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY); + comphelper::SequenceAsHashMap aCustomShapeGeometry(xPropertySet->getPropertyValue("CustomShapeGeometry")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-270), aCustomShapeGeometry["TextPreRotateAngle"].get<sal_Int32>()); + } } DECLARE_OOXMLIMPORT_TEST(testChartProp, "chart-prop.docx") |