Fix VBA get*Padding, which returns a floating-point value

Introduced in commit f3234f4f14 (VBA
Add Padding properties to XTable, 2022-08-05). The unit test is
edited to test that the value returned by the methods is equal to
the initially set value, with precision of 0.1 pt.

Change-Id: I24144cd0e3c1e72bd2664a2a052ac3c7006595ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169762
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Mike Kaganski 2024-06-29 22:37:09 +05:00
parent c910d8cd67
commit 203bd3f674
3 changed files with 6 additions and 7 deletions

Binary file not shown.

View file

@ -116,7 +116,7 @@ void SwMacrosTest::testVba()
OUString("testFontColor.docm"), OUString("testFontColor.docm"),
OUString("vnd.sun.Star.script:Project.ThisDocument.testAll?language=Basic&location=document") OUString("vnd.sun.Star.script:Project.ThisDocument.testAll?language=Basic&location=document")
} },
// TODO - make these pass in Writer // TODO - make these pass in Writer
{ {
OUString("testSentences.docm"), OUString("testSentences.docm"),
@ -133,8 +133,7 @@ void SwMacrosTest::testVba()
{ {
u"testTables.docm"_ustr, u"testTables.docm"_ustr,
u"vnd.sun.Star.script:Project.ThisDocument.TestAll?language=Basic&location=document"_ustr u"vnd.sun.Star.script:Project.ThisDocument.TestAll?language=Basic&location=document"_ustr
} },
}; };
for (auto const & [ sFileBaseName, sMacroUrl ] : testInfo) for (auto const & [ sFileBaseName, sMacroUrl ] : testInfo)
{ {

View file

@ -101,7 +101,7 @@ SwVbaTable::getBottomPadding()
uno::Reference< beans::XPropertySet > xPropertySet( mxTextTable, uno::UNO_QUERY_THROW); uno::Reference< beans::XPropertySet > xPropertySet( mxTextTable, uno::UNO_QUERY_THROW);
table::TableBorderDistances aTableBorderDistances; table::TableBorderDistances aTableBorderDistances;
xPropertySet->getPropertyValue(u"TableBorderDistances"_ustr) >>= aTableBorderDistances; xPropertySet->getPropertyValue(u"TableBorderDistances"_ustr) >>= aTableBorderDistances;
return convertMm100ToPoint(aTableBorderDistances.BottomDistance); return convertMm100ToPoint<double>(aTableBorderDistances.BottomDistance);
} }
void SAL_CALL void SAL_CALL
@ -120,7 +120,7 @@ SwVbaTable::getLeftPadding()
uno::Reference< beans::XPropertySet > xPropertySet( mxTextTable, uno::UNO_QUERY_THROW); uno::Reference< beans::XPropertySet > xPropertySet( mxTextTable, uno::UNO_QUERY_THROW);
table::TableBorderDistances aTableBorderDistances; table::TableBorderDistances aTableBorderDistances;
xPropertySet->getPropertyValue(u"TableBorderDistances"_ustr) >>= aTableBorderDistances; xPropertySet->getPropertyValue(u"TableBorderDistances"_ustr) >>= aTableBorderDistances;
return convertMm100ToPoint(aTableBorderDistances.LeftDistance); return convertMm100ToPoint<double>(aTableBorderDistances.LeftDistance);
} }
void SAL_CALL void SAL_CALL
@ -139,7 +139,7 @@ SwVbaTable::getRightPadding()
uno::Reference< beans::XPropertySet > xPropertySet( mxTextTable, uno::UNO_QUERY_THROW); uno::Reference< beans::XPropertySet > xPropertySet( mxTextTable, uno::UNO_QUERY_THROW);
table::TableBorderDistances aTableBorderDistances; table::TableBorderDistances aTableBorderDistances;
xPropertySet->getPropertyValue(u"TableBorderDistances"_ustr) >>= aTableBorderDistances; xPropertySet->getPropertyValue(u"TableBorderDistances"_ustr) >>= aTableBorderDistances;
return convertMm100ToPoint(aTableBorderDistances.RightDistance); return convertMm100ToPoint<double>(aTableBorderDistances.RightDistance);
} }
void SAL_CALL void SAL_CALL
@ -158,7 +158,7 @@ SwVbaTable::getTopPadding()
uno::Reference< beans::XPropertySet > xPropertySet( mxTextTable, uno::UNO_QUERY_THROW); uno::Reference< beans::XPropertySet > xPropertySet( mxTextTable, uno::UNO_QUERY_THROW);
table::TableBorderDistances aTableBorderDistances; table::TableBorderDistances aTableBorderDistances;
xPropertySet->getPropertyValue(u"TableBorderDistances"_ustr) >>= aTableBorderDistances; xPropertySet->getPropertyValue(u"TableBorderDistances"_ustr) >>= aTableBorderDistances;
return convertMm100ToPoint(aTableBorderDistances.TopDistance); return convertMm100ToPoint<double>(aTableBorderDistances.TopDistance);
} }
void SAL_CALL void SAL_CALL