[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sw/qa sw/source
Mike Kaganski
mike.kaganski at collabora.com
Fri Jun 15 08:54:14 UTC 2018
sw/qa/extras/uiwriter/data/tdf91801.fodt | 21 +++++++++++++++++++++
sw/qa/extras/uiwriter/uiwriter.cxx | 11 +++++++++++
sw/source/core/bastyp/calc.cxx | 2 ++
3 files changed, 34 insertions(+)
New commits:
commit 53ed11accf52481ae0669b5b1676d73b05f38cf4
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date: Thu Jun 14 20:25:26 2018 +1000
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 <mike.kaganski at collabora.com>
(cherry picked from commit 82fc1fdebc622507d4220fefa72b9b4bda0f55d8)
Reviewed-on: https://gerrit.libreoffice.org/55841
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:ooow="http://openoffice.org/2004/writer" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:body>
+ <office:text>
+ <text:user-field-decls>
+ <text:user-field-decl office:value-type="float" office:value="111" text:name="aaa"/>
+ <text:user-field-decl office:value-type="float" office:value="222" text:name="bbb"/>
+ </text:user-field-decls>
+ <table:table table:name="Table1">
+ <table:table-column/>
+ <table:table-row>
+ <table:table-cell table:formula="ooow:aaa+bbb*2" office:value-type="float" office:value="111">
+ <text:p>111</text:p>
+ </table:table-cell>
+ </table:table-row>
+ </table:table>
+ <text:p/>
+ </office:text>
+ </office:body>
+</office:document>
\ No newline at end of file
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 2d4aa322db4c..25a9fb33bdf0 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<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
+ uno::Reference<table::XCell> xCell(xTable->getCellByName("A1"));
+ CPPUNIT_ASSERT_EQUAL(555.0, xCell->getValue());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 30a1ca83a5ab..1e407f8a0225 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -449,6 +449,7 @@ SwCalcExp* SwCalc::VarLook( const OUString& rStr, bool bIns )
sal_Int32 nCommandPos = m_nCommandPos;
SwCalcOper eCurrOper = m_eCurrOper;
SwCalcOper eCurrListOper = m_eCurrListOper;
+ OUString sCurrCommand = m_sCommand;
pFnd->nValue.PutDouble( pUField->GetValue( *this ) );
@@ -459,6 +460,7 @@ SwCalcExp* SwCalc::VarLook( const OUString& rStr, bool bIns )
m_nCommandPos = nCommandPos;
m_eCurrOper = eCurrOper;
m_eCurrListOper = eCurrListOper;
+ m_sCommand = sCurrCommand;
}
else
{
More information about the Libreoffice-commits
mailing list