Kaydet (Commit) fab11968 authored tarafından YogeshBharate's avatar YogeshBharate Kaydeden (comit) Miklos Vajna

Code changes and unit test to check no empty font name is exported

Problem Description:
In fontTable.xml, empty font name gets exported.
So while exporting check no empty font name is exported.

Conflicts:
	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
	https://gerrit.libreoffice.org/6319

Change-Id: Icaa58d23b7754925291867b4c9557c8232f77d69
üst 56368292
......@@ -1532,6 +1532,23 @@ DECLARE_OOXML_TEST(testCharHighlight, "char_highlight.docx")
}
}
DECLARE_OOXML_TEST(testFontNameIsEmpty, "font-name-is-empty.docx")
{
// Check no empty font name is exported
// This test does not fail, if the document contains a font with empty name.
xmlDocPtr pXmlFontTable = parseExport("word/fontTable.xml");
xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlFontTable, "/w:fonts/w:font");
sal_Int32 length = xmlXPathNodeSetGetLength(pXmlNodes);
for(sal_Int32 index = 0; index < length; index++){
xmlNodePtr pXmlNode = pXmlNodes->nodeTab[index];
OUString attrVal = OUString::createFromAscii((const char*)xmlGetProp(pXmlNode, BAD_CAST("name")));
if (attrVal == ""){
CPPUNIT_FAIL("Font name is empty.");
}
}
}
DECLARE_OOXML_TEST(testMultiColumnLineSeparator, "multi-column-line-separator-SAVED.docx")
{
// Check for the Column Separator value.It should be FALSE as the document doesnt contains separator line.
......
......@@ -838,16 +838,19 @@ void wwFont::WriteDocx( DocxAttributeOutput* rAttrOutput ) const
{
// no font embedding, panose id, subsetting, ... implemented
rAttrOutput->StartFont( msFamilyNm );
if (!msFamilyNm.isEmpty())
{
rAttrOutput->StartFont( msFamilyNm );
if ( mbAlt )
rAttrOutput->FontAlternateName( msAltNm );
rAttrOutput->FontCharset( sw::ms::rtl_TextEncodingToWinCharset( meChrSet ), meChrSet );
rAttrOutput->FontFamilyType( meFamily );
rAttrOutput->FontPitchType( mePitch );
rAttrOutput->EmbedFont( msFamilyNm, meFamily, mePitch, meChrSet );
if ( mbAlt )
rAttrOutput->FontAlternateName( msAltNm );
rAttrOutput->FontCharset( sw::ms::rtl_TextEncodingToWinCharset( meChrSet ), meChrSet );
rAttrOutput->FontFamilyType( meFamily );
rAttrOutput->FontPitchType( mePitch );
rAttrOutput->EmbedFont( msFamilyNm, meFamily, mePitch, meChrSet );
rAttrOutput->EndFont();
rAttrOutput->EndFont();
}
}
void wwFont::WriteRtf( const RtfAttributeOutput* rAttrOutput ) const
......
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