Kaydet (Commit) 860f543c authored tarafından Miklos Vajna's avatar Miklos Vajna

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
üst 836454d0
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <com/sun/star/lang/XServiceName.hpp> #include <com/sun/star/lang/XServiceName.hpp>
#include <com/sun/star/packages/zip/ZipFileAccess.hpp> #include <com/sun/star/packages/zip/ZipFileAccess.hpp>
#include <com/sun/star/text/XTextDocument.hpp> #include <com/sun/star/text/XTextDocument.hpp>
#include <com/sun/star/text/XTextFramesSupplier.hpp>
#include <unotools/ucbstreamhelper.hxx> #include <unotools/ucbstreamhelper.hxx>
#include <rtl/strbuf.hxx> #include <rtl/strbuf.hxx>
...@@ -693,7 +694,19 @@ void Chart2ExportTest::testShapeFollowedByChart() ...@@ -693,7 +694,19 @@ void Chart2ExportTest::testShapeFollowedByChart()
CPPUNIT_ASSERT(pXmlDoc); 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 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 ); CPPUNIT_ASSERT( aValueOfFirstDocPR != aValueOfSecondDocPR );
} }
......
...@@ -1483,8 +1483,20 @@ DECLARE_OOXMLIMPORT_TEST(testDefaultSectBreakCols, "default-sect-break-cols.docx ...@@ -1483,8 +1483,20 @@ DECLARE_OOXMLIMPORT_TEST(testDefaultSectBreakCols, "default-sect-break-cols.docx
DECLARE_OOXMLIMPORT_TEST(testFdo69636, "fdo69636.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. // 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); uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(900), getProperty<sal_Int32>(getRun(getParagraphOfText(1, xFrame->getText()), 1), "CharRotation")); 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") DECLARE_OOXMLIMPORT_TEST(testChartProp, "chart-prop.docx")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment