Kaydet (Commit) 246d1852 authored tarafından Justin Luth's avatar Justin Luth

tdf#109306 ooxmlimport: consider table sizes < 10%

Change-Id: I336d5a498f4f4523e03b1316b7adaca21df4de82
Reviewed-on: https://gerrit.libreoffice.org/43385Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
üst a4a182e2
......@@ -172,6 +172,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf79272_strictDxa, "tdf79272_strictDxa.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int32(4318), getProperty<sal_Int32>(xTables->getByIndex(0), "Width"));
}
DECLARE_OOXMLEXPORT_TEST(testTdf109306, "tdf109306.docx")
{
uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
// Both types of relative width specification (pct): simple integers (in fiftieths of percent)
// and floats with "%" unit specification must be treated correctly
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTables->getByIndex(0), "IsWidthRelative"));
CPPUNIT_ASSERT_EQUAL(sal_Int16(9), getProperty<sal_Int16>(xTables->getByIndex(0), "RelativeWidth"));
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTables->getByIndex(1), "IsWidthRelative"));
CPPUNIT_ASSERT_EQUAL(sal_Int16(80), getProperty<sal_Int16>(xTables->getByIndex(1), "RelativeWidth"));
}
DECLARE_OOXMLEXPORT_TEST(testKern, "kern.docx")
{
CPPUNIT_ASSERT(getProperty<bool>(getRun(getParagraph(1), 1), "CharAutoKerning"));
......
......@@ -1427,19 +1427,6 @@ DECLARE_OOXMLIMPORT_TEST(testTdf108849, "tdf108849.docx")
CPPUNIT_ASSERT_EQUAL_MESSAGE("Misplaced body-level sectPr's create extra sections!", 2, getPages());
}
DECLARE_OOXMLIMPORT_TEST(testTdf109306, "tdf109306.docx")
{
uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
// Both types of relative width specification (pct): simple integers (in fiftieths of percent)
// and floats with "%" unit specification must be treated correctly
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTables->getByIndex(0), "IsWidthRelative"));
CPPUNIT_ASSERT_EQUAL(sal_Int16(90), getProperty<sal_Int16>(xTables->getByIndex(0), "RelativeWidth"));
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTables->getByIndex(1), "IsWidthRelative"));
CPPUNIT_ASSERT_EQUAL(sal_Int16(80), getProperty<sal_Int16>(xTables->getByIndex(1), "RelativeWidth"));
}
DECLARE_OOXMLIMPORT_TEST(testTdf109524, "tdf109524.docx")
{
uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
......
......@@ -643,7 +643,7 @@ OOXMLMeasurementOrPercentValue::OOXMLMeasurementOrPercentValue(const char * pVal
double val = rtl_str_toDouble(pValue); // will ignore the trailing unit
int nLen = strlen(pValue);
if (nLen > 2 &&
if (nLen > 1 &&
pValue[nLen - 1] == '%')
{
mnValue = static_cast<int>(val * 50);
......
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