Bug 149567 - test::BootstrapFixture::validate does not trigger on "Fatal:" error
Summary: test::BootstrapFixture::validate does not trigger on "Fatal:" error
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: topicQA
Depends on:
Blocks: Dev-related
  Show dependency treegraph
 
Reported: 2022-06-14 17:54 UTC by Regina Henschel
Modified: 2024-03-02 14:15 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
File used in the unit test. (15.70 KB, application/zip)
2022-06-14 17:54 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2022-06-14 17:54:41 UTC
Created attachment 180768 [details]
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);
}
Comment 1 Regina Henschel 2022-06-14 23:03:54 UTC
If I add 'Fatal', I get this failure:

D:/Build_2020/core/test/source/bootstrapfixture.cxx(242) : error : Assertion
Test name: testTdf113696WriterImage::Load_Verify_Reload_Verify
forced failure
- C:\cygwin64\tmp\lu66564ojlvv.tmp:  Fatal: The ODF package 'file:///C:/cygwin64/tmp/lu66564ojlvv.tmp' shall be a ZIP fi
le!
org.odftoolkit.odfdom.pkg.OdfValidationException; The ODF package 'file:///C:/cygwin64/tmp/lu66564ojlvv.tmp' shall be a
ZIP file!
Comment 2 Roman Kuznetsov 2022-09-28 16:23:57 UTC
Xisco, we need your help here
Comment 3 Xisco Faulí 2023-02-15 09:48:36 UTC
Hi Regina,
Is this issue still valid? I see you already created the unittests for bug 149551 in 7d06665b7f5e7a7d1e9ac608c3bb827003fa3cb4 and 6c635fb11af389d88f36d4bf6b43421af062086a...
Comment 4 Regina Henschel 2023-02-15 13:27:34 UTC
The issue is valid in principle. But because after my fix https://cgit.freedesktop.org/libreoffice/core/commit/?id=aca189d118d4351b293c089cb26584eb898e1849 for bug 149551 the produced file is valid, you can see the problem only if you have a build from before that patch.

I don't know a scenario which produces double attributes in current builds. And if one is detected, it would surely be fixed immediately. I only come across the problem when I tested, that my unit test fails before my patch was applied.