https://bugs.documentfoundation.org/show_bug.cgi?id=149567

            Bug ID: 149567
           Summary: test::BootstrapFixture::validate does not trigger on
                    "Fatal:" error
           Product: LibreOffice
           Version: unspecified
          Hardware: x86-64 (AMD64)
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: LibreOffice
          Assignee: libreoffice-bugs@lists.freedesktop.org
          Reporter: rb.hensc...@t-online.de

Created attachment 180768
  --> https://bugs.documentfoundation.org/attachment.cgi?id=180768&action=edit
File used in the unit test.

The test below should fail in "save" but it does not.

Problem is, that the validator produces for the double attribute not a string
with "Error", but a string with "Fatal".
So line
    if( aContentOUString.indexOf("Error") != -1 )
[https://opengrok.libreoffice.org/xref/core/test/source/bootstrapfixture.cxx?r=5200a736#239]
does not catch the failure.

I guess the line should be
    if (aContentOUString.indexOf("Error") != -1 ||
aContentOUString.indexOf("Fatal") != -1)
With that change the test fails as expected. But I don't know whether such
change will produce problems somewhere else.

For reproducing the problem, the following unit test has to be added to file
core/xmloff/qa/unit/draw.cxx and the attached file to core/xmloff/qa/unit/data

CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextRotationPlusPre)
{
    // import
    getComponent() =
loadFromDesktop(m_directories.getURLFromSrc(DATA_DIRECTORY)
                                         + "tdf149551_verticalText.pptx",
                                    
"com.sun.star.presentation.PresentationDocument");
    // The file has a shape with attribute vert="vert" in <bodyPr> element.
That generates a
    // TextPreRotateAngle attribute in CustomShapeGeometry.

    // Add a TextRotateAngle attribute.
    uno::Reference<drawing::XShape> xShape(getShape(0));
    uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY);
    uno::Sequence<beans::PropertyValue> aGeomSeq;
    xShapeProps->getPropertyValue("CustomShapeGeometry") >>= aGeomSeq;
    auto aGeomVec(comphelper::sequenceToContainer<
std::vector<beans::PropertyValue> >(aGeomSeq));
    aGeomVec.push_back(comphelper::makePropertyValue("TextRotateAngle",
sal_Int32(45)));
    aGeomSeq = comphelper::containerToSequence(aGeomVec);
    xShapeProps->setPropertyValue("CustomShapeGeometry", uno::Any(aGeomSeq));

    // Save to ODF. Without the fix, a file format error was produced, because
attribute
    // draw:text-rotate-angle was written twice, one from TextPreRotateAngle
and the other from
    // TextRotateAngle.
    utl::TempFile aTempFile;
    save("impress8", aTempFile);
}

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to