CppunitTest_xmloff_draw: inherit from UnoApiTest
Change-Id: Ia6e083df4dfb6a6354f3bbe2f5eabaca559281b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141771 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
parent
b2d6ad6447
commit
dd1069d77a
@ -25,6 +25,7 @@ $(eval $(call gb_CppunitTest_use_libraries,xmloff_draw, \
|
|||||||
cppu \
|
cppu \
|
||||||
embobj \
|
embobj \
|
||||||
sal \
|
sal \
|
||||||
|
subsequenttest \
|
||||||
test \
|
test \
|
||||||
unotest \
|
unotest \
|
||||||
utl \
|
utl \
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <test/bootstrapfixture.hxx>
|
#include <test/unoapi_test.hxx>
|
||||||
#include <unotest/macros_test.hxx>
|
|
||||||
#include <test/xmltesttools.hxx>
|
#include <test/xmltesttools.hxx>
|
||||||
|
|
||||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||||
@ -38,38 +37,18 @@
|
|||||||
|
|
||||||
using namespace ::com::sun::star;
|
using namespace ::com::sun::star;
|
||||||
|
|
||||||
constexpr OUStringLiteral DATA_DIRECTORY = u"/xmloff/qa/unit/data/";
|
|
||||||
|
|
||||||
/// Covers xmloff/source/draw/ fixes.
|
/// Covers xmloff/source/draw/ fixes.
|
||||||
class XmloffDrawTest : public test::BootstrapFixture,
|
class XmloffDrawTest : public UnoApiTest, public XmlTestTools
|
||||||
public unotest::MacrosTest,
|
|
||||||
public XmlTestTools
|
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
uno::Reference<lang::XComponent> mxComponent;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setUp() override;
|
XmloffDrawTest();
|
||||||
void tearDown() override;
|
|
||||||
void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override;
|
void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override;
|
||||||
uno::Reference<lang::XComponent>& getComponent() { return mxComponent; }
|
|
||||||
void save(const OUString& rFilterName, utl::TempFileNamed& rTempFile);
|
|
||||||
uno::Reference<drawing::XShape> getShape(sal_uInt8 nShapeIndex);
|
uno::Reference<drawing::XShape> getShape(sal_uInt8 nShapeIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
void XmloffDrawTest::setUp()
|
XmloffDrawTest::XmloffDrawTest()
|
||||||
|
: UnoApiTest("/xmloff/qa/unit/data/")
|
||||||
{
|
{
|
||||||
test::BootstrapFixture::setUp();
|
|
||||||
|
|
||||||
mxDesktop.set(frame::Desktop::create(mxComponentContext));
|
|
||||||
}
|
|
||||||
|
|
||||||
void XmloffDrawTest::tearDown()
|
|
||||||
{
|
|
||||||
if (mxComponent.is())
|
|
||||||
mxComponent->dispose();
|
|
||||||
|
|
||||||
test::BootstrapFixture::tearDown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XmloffDrawTest::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx)
|
void XmloffDrawTest::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx)
|
||||||
@ -77,16 +56,6 @@ void XmloffDrawTest::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx)
|
|||||||
XmlTestTools::registerODFNamespaces(pXmlXpathCtx);
|
XmlTestTools::registerODFNamespaces(pXmlXpathCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XmloffDrawTest::save(const OUString& rFilterName, utl::TempFileNamed& rTempFile)
|
|
||||||
{
|
|
||||||
uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
|
|
||||||
utl::MediaDescriptor aMediaDescriptor;
|
|
||||||
aMediaDescriptor["FilterName"] <<= rFilterName;
|
|
||||||
rTempFile.EnableKillingFile();
|
|
||||||
xStorable->storeToURL(rTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
|
|
||||||
validate(rTempFile.GetFileName(), test::ODF);
|
|
||||||
}
|
|
||||||
|
|
||||||
uno::Reference<drawing::XShape> XmloffDrawTest::getShape(sal_uInt8 nShapeIndex)
|
uno::Reference<drawing::XShape> XmloffDrawTest::getShape(sal_uInt8 nShapeIndex)
|
||||||
{
|
{
|
||||||
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent,
|
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent,
|
||||||
@ -101,19 +70,13 @@ uno::Reference<drawing::XShape> XmloffDrawTest::getShape(sal_uInt8 nShapeIndex)
|
|||||||
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextBoxLoss)
|
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextBoxLoss)
|
||||||
{
|
{
|
||||||
// Load a document that has a shape with a textbox in it. Save it to ODF and reload.
|
// Load a document that has a shape with a textbox in it. Save it to ODF and reload.
|
||||||
OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "textbox-loss.docx";
|
loadFromURL(u"textbox-loss.docx");
|
||||||
getComponent() = loadFromDesktop(aURL);
|
utl::TempFileNamed aTempFile = save("impress8");
|
||||||
uno::Reference<frame::XStorable> xStorable(getComponent(), uno::UNO_QUERY);
|
validate(aTempFile.GetFileName(), test::ODF);
|
||||||
utl::TempFileNamed aTempFile;
|
mxComponent = loadFromDesktop(aTempFile.GetURL());
|
||||||
aTempFile.EnableKillingFile();
|
|
||||||
utl::MediaDescriptor aMediaDescriptor;
|
|
||||||
aMediaDescriptor["FilterName"] <<= OUString("writer8");
|
|
||||||
xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
|
|
||||||
getComponent()->dispose();
|
|
||||||
getComponent() = loadFromDesktop(aTempFile.GetURL());
|
|
||||||
|
|
||||||
// Make sure that the shape is still a textbox.
|
// Make sure that the shape is still a textbox.
|
||||||
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(getComponent(), uno::UNO_QUERY);
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
||||||
uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
|
uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
|
||||||
uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(1), uno::UNO_QUERY);
|
uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(1), uno::UNO_QUERY);
|
||||||
bool bTextBox = false;
|
bool bTextBox = false;
|
||||||
@ -127,12 +90,11 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextBoxLoss)
|
|||||||
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf141301_Extrusion_Angle)
|
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf141301_Extrusion_Angle)
|
||||||
{
|
{
|
||||||
// Load a document that has a custom shape with extrusion direction as set by LO as its default.
|
// Load a document that has a custom shape with extrusion direction as set by LO as its default.
|
||||||
OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf141301_Extrusion_Skew.odg";
|
loadFromURL(u"tdf141301_Extrusion_Skew.odg");
|
||||||
getComponent() = loadFromDesktop(aURL, "com.sun.star.comp.drawing.DrawingDocument");
|
|
||||||
|
|
||||||
// Prepare use of XPath
|
// Prepare use of XPath
|
||||||
utl::TempFileNamed aTempFile;
|
utl::TempFileNamed aTempFile = save("draw8");
|
||||||
save("draw8", aTempFile);
|
validate(aTempFile.GetFileName(), test::ODF);
|
||||||
uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
|
uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
|
||||||
= packages::zip::ZipFileAccess::createWithURL(mxComponentContext, aTempFile.GetURL());
|
= packages::zip::ZipFileAccess::createWithURL(mxComponentContext, aTempFile.GetURL());
|
||||||
uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName("content.xml"),
|
uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName("content.xml"),
|
||||||
@ -148,8 +110,8 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf141301_Extrusion_Angle)
|
|||||||
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeExport)
|
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeExport)
|
||||||
{
|
{
|
||||||
// Create an Impress document which has a master page which has a theme associated with it.
|
// Create an Impress document which has a master page which has a theme associated with it.
|
||||||
getComponent() = loadFromDesktop("private:factory/simpress");
|
mxComponent = loadFromDesktop("private:factory/simpress");
|
||||||
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
|
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
|
||||||
uno::Reference<drawing::XMasterPageTarget> xDrawPage(
|
uno::Reference<drawing::XMasterPageTarget> xDrawPage(
|
||||||
xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
|
xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
|
||||||
uno::Reference<beans::XPropertySet> xMasterPage(xDrawPage->getMasterPage(), uno::UNO_QUERY);
|
uno::Reference<beans::XPropertySet> xMasterPage(xDrawPage->getMasterPage(), uno::UNO_QUERY);
|
||||||
@ -163,8 +125,8 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeExport)
|
|||||||
xMasterPage->setPropertyValue("Theme", aTheme);
|
xMasterPage->setPropertyValue("Theme", aTheme);
|
||||||
|
|
||||||
// Export to ODP:
|
// Export to ODP:
|
||||||
utl::TempFileNamed aTempFile;
|
utl::TempFileNamed aTempFile = save("impress8");
|
||||||
save("impress8", aTempFile);
|
validate(aTempFile.GetFileName(), test::ODF);
|
||||||
|
|
||||||
// Check if the 12 colors are written in the XML:
|
// Check if the 12 colors are written in the XML:
|
||||||
std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "styles.xml");
|
std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "styles.xml");
|
||||||
@ -180,9 +142,8 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeExport)
|
|||||||
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testVideoSnapshot)
|
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testVideoSnapshot)
|
||||||
{
|
{
|
||||||
// Execute ODP import:
|
// Execute ODP import:
|
||||||
OUString aURL = m_directories.getURLFromSrc(u"xmloff/qa/unit/data/video-snapshot.odp");
|
loadFromURL(u"video-snapshot.odp");
|
||||||
getComponent() = loadFromDesktop(aURL, "com.sun.star.presentation.PresentationDocument");
|
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent,
|
||||||
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(),
|
|
||||||
uno::UNO_QUERY_THROW);
|
uno::UNO_QUERY_THROW);
|
||||||
CPPUNIT_ASSERT(xDrawPagesSupplier.is());
|
CPPUNIT_ASSERT(xDrawPagesSupplier.is());
|
||||||
uno::Reference<drawing::XDrawPages> xDrawPages(xDrawPagesSupplier->getDrawPages());
|
uno::Reference<drawing::XDrawPages> xDrawPages(xDrawPagesSupplier->getDrawPages());
|
||||||
@ -205,8 +166,8 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testVideoSnapshot)
|
|||||||
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1356), rCrop.Right);
|
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1356), rCrop.Right);
|
||||||
|
|
||||||
// Execute ODP export:
|
// Execute ODP export:
|
||||||
utl::TempFileNamed aTempFile;
|
utl::TempFileNamed aTempFile = save("impress8");
|
||||||
save("impress8", aTempFile);
|
validate(aTempFile.GetFileName(), test::ODF);
|
||||||
|
|
||||||
std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml");
|
std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml");
|
||||||
xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
|
xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
|
||||||
@ -226,13 +187,10 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testVideoSnapshot)
|
|||||||
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeImport)
|
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeImport)
|
||||||
{
|
{
|
||||||
// Given a document that has a master page with a theme associated:
|
// Given a document that has a master page with a theme associated:
|
||||||
OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "theme.odp";
|
loadFromURL(u"theme.odp");
|
||||||
|
|
||||||
// When loading that document:
|
|
||||||
getComponent() = loadFromDesktop(aURL);
|
|
||||||
|
|
||||||
// Then make sure the doc model has a master page with a theme:
|
// Then make sure the doc model has a master page with a theme:
|
||||||
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
|
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
|
||||||
uno::Reference<drawing::XMasterPageTarget> xDrawPage(
|
uno::Reference<drawing::XMasterPageTarget> xDrawPage(
|
||||||
xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
|
xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
|
||||||
uno::Reference<beans::XPropertySet> xMasterpage(xDrawPage->getMasterPage(), uno::UNO_QUERY);
|
uno::Reference<beans::XPropertySet> xMasterpage(xDrawPage->getMasterPage(), uno::UNO_QUERY);
|
||||||
@ -250,12 +208,9 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeImport)
|
|||||||
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testReferToTheme)
|
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testReferToTheme)
|
||||||
{
|
{
|
||||||
// Given a document that refers to a theme color:
|
// Given a document that refers to a theme color:
|
||||||
OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "refer-to-theme.odp";
|
loadFromURL(u"refer-to-theme.odp");
|
||||||
|
utl::TempFileNamed aTempFile = save("impress8");
|
||||||
// When loading and saving that document:
|
validate(aTempFile.GetFileName(), test::ODF);
|
||||||
getComponent() = loadFromDesktop(aURL);
|
|
||||||
utl::TempFileNamed aTempFile;
|
|
||||||
save("impress8", aTempFile);
|
|
||||||
|
|
||||||
// Make sure the export result has the theme reference:
|
// Make sure the export result has the theme reference:
|
||||||
std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml");
|
std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml");
|
||||||
@ -317,13 +272,10 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTableInShape)
|
|||||||
{
|
{
|
||||||
// Given a document with a shape with a "FrameX" parent style (starts with Frame, but is not
|
// Given a document with a shape with a "FrameX" parent style (starts with Frame, but is not
|
||||||
// Frame):
|
// Frame):
|
||||||
OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "table-in-shape.fodt";
|
loadFromURL(u"table-in-shape.fodt");
|
||||||
|
|
||||||
// When loading that document:
|
|
||||||
getComponent() = loadFromDesktop(aURL);
|
|
||||||
|
|
||||||
// Then make sure the table inside the shape is not lost:
|
// Then make sure the table inside the shape is not lost:
|
||||||
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(getComponent(), uno::UNO_QUERY);
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
||||||
uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
|
uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
|
||||||
uno::Reference<text::XTextRange> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
|
uno::Reference<text::XTextRange> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
|
||||||
uno::Reference<container::XEnumerationAccess> xText(xShape->getText(), uno::UNO_QUERY);
|
uno::Reference<container::XEnumerationAccess> xText(xShape->getText(), uno::UNO_QUERY);
|
||||||
@ -363,17 +315,14 @@ void lcl_assertMetalProperties(std::string_view sInfo, uno::Reference<drawing::X
|
|||||||
|
|
||||||
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeExtended)
|
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeExtended)
|
||||||
{
|
{
|
||||||
// import
|
loadFromURL(u"tdf145700_3D_metal_type_MSCompatible.doc");
|
||||||
getComponent() = loadFromDesktop(m_directories.getURLFromSrc(DATA_DIRECTORY)
|
|
||||||
+ "tdf145700_3D_metal_type_MSCompatible.doc",
|
|
||||||
"com.sun.star.text.TextDocument");
|
|
||||||
// verify properties
|
// verify properties
|
||||||
uno::Reference<drawing::XShape> xShape(getShape(0));
|
uno::Reference<drawing::XShape> xShape(getShape(0));
|
||||||
lcl_assertMetalProperties("from doc", xShape);
|
lcl_assertMetalProperties("from doc", xShape);
|
||||||
|
|
||||||
// Test, that new attribute is written with loext namespace. Adapt when attribute is added to ODF.
|
// Test, that new attribute is written with loext namespace. Adapt when attribute is added to ODF.
|
||||||
utl::TempFileNamed aTempFile;
|
utl::TempFileNamed aTempFile = save("writer8");
|
||||||
save("writer8", aTempFile);
|
validate(aTempFile.GetFileName(), test::ODF);
|
||||||
|
|
||||||
// assert XML.
|
// assert XML.
|
||||||
std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml");
|
std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml");
|
||||||
@ -383,8 +332,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeExtended)
|
|||||||
"//draw:enhanced-geometry[@loext:extrusion-metal-type='loext:MetalMSCompatible']");
|
"//draw:enhanced-geometry[@loext:extrusion-metal-type='loext:MetalMSCompatible']");
|
||||||
|
|
||||||
// reload
|
// reload
|
||||||
getComponent()->dispose();
|
mxComponent = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.text.TextDocument");
|
||||||
getComponent() = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.text.TextDocument");
|
|
||||||
// verify properties
|
// verify properties
|
||||||
uno::Reference<drawing::XShape> xShapeReload(getShape(0));
|
uno::Reference<drawing::XShape> xShapeReload(getShape(0));
|
||||||
lcl_assertMetalProperties("from ODF 1.3 extended", xShapeReload);
|
lcl_assertMetalProperties("from ODF 1.3 extended", xShapeReload);
|
||||||
@ -392,17 +340,14 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeExtended)
|
|||||||
|
|
||||||
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeStrict)
|
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeStrict)
|
||||||
{
|
{
|
||||||
// import
|
loadFromURL(u"tdf145700_3D_metal_type_MSCompatible.doc");
|
||||||
getComponent() = loadFromDesktop(m_directories.getURLFromSrc(DATA_DIRECTORY)
|
|
||||||
+ "tdf145700_3D_metal_type_MSCompatible.doc",
|
|
||||||
"com.sun.star.text.TextDocument");
|
|
||||||
|
|
||||||
// save ODF 1.3 strict and test, that new attribute is not written. Adapt when attribute is
|
// save ODF 1.3 strict and test, that new attribute is not written. Adapt when attribute is
|
||||||
// added to ODF.
|
// added to ODF.
|
||||||
const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion(GetODFDefaultVersion());
|
const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion(GetODFDefaultVersion());
|
||||||
SetODFDefaultVersion(SvtSaveOptions::ODFVER_013);
|
SetODFDefaultVersion(SvtSaveOptions::ODFVER_013);
|
||||||
utl::TempFileNamed aTempFile;
|
utl::TempFileNamed aTempFile = save("writer8");
|
||||||
save("writer8", aTempFile);
|
validate(aTempFile.GetFileName(), test::ODF);
|
||||||
|
|
||||||
// assert XML.
|
// assert XML.
|
||||||
std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml");
|
std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml");
|
||||||
@ -434,18 +379,15 @@ void lcl_assertSpecularityProperty(std::string_view sInfo, uno::Reference<drawin
|
|||||||
|
|
||||||
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularityExtended)
|
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularityExtended)
|
||||||
{
|
{
|
||||||
// import
|
loadFromURL(u"tdf147580_extrusion-specularity.doc");
|
||||||
getComponent() = loadFromDesktop(m_directories.getURLFromSrc(DATA_DIRECTORY)
|
|
||||||
+ "tdf147580_extrusion-specularity.doc",
|
|
||||||
"com.sun.star.text.TextDocument");
|
|
||||||
// verify property
|
// verify property
|
||||||
uno::Reference<drawing::XShape> xShape(getShape(0));
|
uno::Reference<drawing::XShape> xShape(getShape(0));
|
||||||
lcl_assertSpecularityProperty("from doc", xShape);
|
lcl_assertSpecularityProperty("from doc", xShape);
|
||||||
|
|
||||||
// Test, that attribute is written in draw namespace with value 100% and in loext namespace with
|
// Test, that attribute is written in draw namespace with value 100% and in loext namespace with
|
||||||
// value 122.0703125%.
|
// value 122.0703125%.
|
||||||
utl::TempFileNamed aTempFile;
|
utl::TempFileNamed aTempFile = save("writer8");
|
||||||
save("writer8", aTempFile);
|
validate(aTempFile.GetFileName(), test::ODF);
|
||||||
|
|
||||||
// assert XML.
|
// assert XML.
|
||||||
std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml");
|
std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml");
|
||||||
@ -455,8 +397,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularityExtended)
|
|||||||
"//draw:enhanced-geometry[@loext:extrusion-specularity-loext='122.0703125%']");
|
"//draw:enhanced-geometry[@loext:extrusion-specularity-loext='122.0703125%']");
|
||||||
|
|
||||||
// reload and verify, that the loext value is used
|
// reload and verify, that the loext value is used
|
||||||
getComponent()->dispose();
|
mxComponent = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.text.TextDocument");
|
||||||
getComponent() = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.text.TextDocument");
|
|
||||||
// verify properties
|
// verify properties
|
||||||
uno::Reference<drawing::XShape> xShapeReload(getShape(0));
|
uno::Reference<drawing::XShape> xShapeReload(getShape(0));
|
||||||
lcl_assertSpecularityProperty("from ODF 1.3 extended", xShapeReload);
|
lcl_assertSpecularityProperty("from ODF 1.3 extended", xShapeReload);
|
||||||
@ -464,17 +405,14 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularityExtended)
|
|||||||
|
|
||||||
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularity)
|
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularity)
|
||||||
{
|
{
|
||||||
// import
|
loadFromURL(u"tdf147580_extrusion-specularity.doc");
|
||||||
getComponent() = loadFromDesktop(m_directories.getURLFromSrc(DATA_DIRECTORY)
|
|
||||||
+ "tdf147580_extrusion-specularity.doc",
|
|
||||||
"com.sun.star.text.TextDocument");
|
|
||||||
|
|
||||||
// The file has c3DSpecularAmt="80000" which results internally in specularity=122%.
|
// The file has c3DSpecularAmt="80000" which results internally in specularity=122%.
|
||||||
// Save to ODF 1.3 strict and make sure it does not produce a validation error.
|
// Save to ODF 1.3 strict and make sure it does not produce a validation error.
|
||||||
const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion(GetODFDefaultVersion());
|
const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion(GetODFDefaultVersion());
|
||||||
SetODFDefaultVersion(SvtSaveOptions::ODFVER_013);
|
SetODFDefaultVersion(SvtSaveOptions::ODFVER_013);
|
||||||
utl::TempFileNamed aTempFile;
|
utl::TempFileNamed aTempFile = save("writer8");
|
||||||
save("writer8", aTempFile);
|
validate(aTempFile.GetFileName(), test::ODF);
|
||||||
|
|
||||||
SetODFDefaultVersion(nCurrentODFVersion);
|
SetODFDefaultVersion(nCurrentODFVersion);
|
||||||
}
|
}
|
||||||
@ -517,8 +455,7 @@ bool lcl_getShapeSegments(uno::Sequence<drawing::EnhancedCustomShapeSegment>& rS
|
|||||||
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf148714_CurvedArrowsOld)
|
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf148714_CurvedArrowsOld)
|
||||||
{
|
{
|
||||||
// Load a document with CurveArrow shapes with faulty path as written by older LO versions.
|
// Load a document with CurveArrow shapes with faulty path as written by older LO versions.
|
||||||
OUString sURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf148714_CurvedArrowsOld.odp";
|
loadFromURL(u"tdf148714_CurvedArrowsOld.odp");
|
||||||
getComponent() = loadFromDesktop(sURL, "com.sun.star.presentation.PresentationDocument");
|
|
||||||
|
|
||||||
// Make sure, that the error has been corrected on opening.
|
// Make sure, that the error has been corrected on opening.
|
||||||
for (sal_Int32 nShapeIndex = 0; nShapeIndex < 4; nShapeIndex++)
|
for (sal_Int32 nShapeIndex = 0; nShapeIndex < 4; nShapeIndex++)
|
||||||
@ -556,10 +493,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf148714_CurvedArrowsOld)
|
|||||||
|
|
||||||
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextRotationPlusPre)
|
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextRotationPlusPre)
|
||||||
{
|
{
|
||||||
// import
|
loadFromURL(u"tdf149551_verticalText.pptx");
|
||||||
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
|
// The file has a shape with attribute vert="vert" in <bodyPr> element. That generates a
|
||||||
// TextPreRotateAngle attribute in CustomShapeGeometry.
|
// TextPreRotateAngle attribute in CustomShapeGeometry.
|
||||||
|
|
||||||
@ -576,12 +510,11 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextRotationPlusPre)
|
|||||||
// Save to ODF. Without the fix, a file format error was produced, because attribute
|
// 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
|
// draw:text-rotate-angle was written twice, one from TextPreRotateAngle and the other from
|
||||||
// TextRotateAngle.
|
// TextRotateAngle.
|
||||||
utl::TempFileNamed aTempFile;
|
|
||||||
// This should already catch the format error, but does not, see tdf#149567
|
// This should already catch the format error, but does not, see tdf#149567
|
||||||
save("impress8", aTempFile);
|
utl::TempFileNamed aTempFile = save("writer8");
|
||||||
|
validate(aTempFile.GetFileName(), test::ODF);
|
||||||
// But reload catches it.
|
// But reload catches it.
|
||||||
getComponent()->dispose();
|
mxComponent = loadFromDesktop(aTempFile.GetURL());
|
||||||
getComponent() = loadFromDesktop(aTempFile.GetURL());
|
|
||||||
}
|
}
|
||||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user