diff options
-rw-r--r-- | sc/qa/unit/units.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sc/qa/unit/units.cxx b/sc/qa/unit/units.cxx index 1dbf74f755c0..ee6af8a46038 100644 --- a/sc/qa/unit/units.cxx +++ b/sc/qa/unit/units.cxx @@ -14,6 +14,8 @@ #include "helper/qahelper.hxx" +#include "rangelst.hxx" + #include <com/sun/star/util/NumberFormat.hpp> using namespace sc::units; @@ -50,6 +52,7 @@ public: void testUnitsCompatible(); void testCellConversion(); + void testConvertCellUnits(); void testUnitsForRange(); void testRangeConversion(); @@ -64,6 +67,7 @@ public: CPPUNIT_TEST(testUnitsCompatible); CPPUNIT_TEST(testCellConversion); + CPPUNIT_TEST(testConvertCellUnits); CPPUNIT_TEST(testUnitsForRange); CPPUNIT_TEST(testRangeConversion); @@ -877,6 +881,22 @@ void UnitsTest::testRangeConversion() { // 3. actual sensible ranges } +void UnitsTest::testConvertCellUnits() +{ + mpDoc->EnsureTable(0); + + // Set up a column with a normal header and a few data values + ScAddress aAddress(20, 0, 0); + mpDoc->SetString(aAddress, "100km"); + ScRange aRange(aAddress); + ScRangeList aRangeList(aRange); + OUString aOutput("miles"); + bool bConverted = mpUnitsImpl->convertCellUnits(aRangeList, mpDoc, aOutput); + CPPUNIT_ASSERT(bConverted); + double nVal = mpDoc->GetValue(aAddress); + CPPUNIT_ASSERT_DOUBLES_EQUAL(62.1371192932129, nVal, 1e-14); +} + CPPUNIT_TEST_SUITE_REGISTRATION(UnitsTest); CPPUNIT_PLUGIN_IMPLEMENT(); |