From 82fc1fdebc622507d4220fefa72b9b4bda0f55d8 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 14 Jun 2018 20:25:26 +1000 Subject: tdf#91801: also restore command (formula) string on validating value SwUserFieldType::GetValue calls SwCalc::Calculate on this object, which resets own m_sCommand to the variable name being verified. Restore it after calculations, like other values. Change-Id: I1582fa2d356064e6e951063fa8479cd615a6591a Reviewed-on: https://gerrit.libreoffice.org/55789 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- sw/qa/extras/uiwriter/data/tdf91801.fodt | 21 +++++++++++++++++++++ sw/qa/extras/uiwriter/uiwriter.cxx | 11 +++++++++++ 2 files changed, 32 insertions(+) create mode 100755 sw/qa/extras/uiwriter/data/tdf91801.fodt (limited to 'sw/qa') diff --git a/sw/qa/extras/uiwriter/data/tdf91801.fodt b/sw/qa/extras/uiwriter/data/tdf91801.fodt new file mode 100755 index 000000000000..4d5486f71bbb --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf91801.fodt @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + 111 + + + + + + + \ No newline at end of file diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 924ff04f6911..d2086048ad94 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -342,6 +342,7 @@ public: void testHtmlCopyImages(); void testTdf116789(); void testTdf117225(); + void testTdf91801(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -535,6 +536,7 @@ public: CPPUNIT_TEST(testHtmlCopyImages); CPPUNIT_TEST(testTdf116789); CPPUNIT_TEST(testTdf117225); + CPPUNIT_TEST(testTdf91801); CPPUNIT_TEST_SUITE_END(); private: @@ -6232,6 +6234,15 @@ void SwUiWriterTest::testTdf117225() CPPUNIT_ASSERT_EQUAL(nExpected, nActual); } +void SwUiWriterTest::testTdf91801() +{ + // Tests calculation with several user field variables without prior user fields + createDoc("tdf91801.fodt"); + uno::Reference xTable(getParagraphOrTable(1), uno::UNO_QUERY); + uno::Reference xCell(xTable->getCellByName("A1")); + CPPUNIT_ASSERT_EQUAL(555.0, xCell->getValue()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); -- cgit