diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-06-30 09:25:29 +0200 |
---|---|---|
committer | Andrzej Hunt <andrzej@ahunt.org> | 2015-10-20 18:18:43 +0200 |
commit | 123067c884105ee2d1fc252cdd060597c3035139 (patch) | |
tree | 333ce67f3b4ab5482e690da687f7bfa2ae9b8236 | |
parent | fix crash when converting units (diff) | |
download | core-123067c884105ee2d1fc252cdd060597c3035139.tar.gz core-123067c884105ee2d1fc252cdd060597c3035139.zip |
add test case for unit conversion
Change-Id: I726758c93b25ed16b5708a71645004537f32ac76
-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(); |