sw/qa/uibase/fldui/fldui.cxx | 20 ++++++++++++++++++++ sw/source/core/fields/docufld.cxx | 3 --- 2 files changed, 20 insertions(+), 3 deletions(-)
New commits: commit 74f25206bc5a1a36b85683555cb27179e5da3275 Author: Andreas Heinisch <andreas.heini...@yahoo.de> AuthorDate: Mon Dec 18 10:54:15 2023 +0100 Commit: Andreas Heinisch <andreas.heini...@yahoo.de> CommitDate: Wed Dec 20 19:57:36 2023 +0100 tdf#68364 - Don't assume a database if only two dots are present Additionally, a database table name (database.table.column) has to be retrieved from the database to be valid. Change-Id: I8949ae61d96043412425d634763d2ea33ce6a0f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160910 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de> diff --git a/sw/qa/uibase/fldui/fldui.cxx b/sw/qa/uibase/fldui/fldui.cxx index 78b2fcedd42a..0bf6bfa33fb6 100644 --- a/sw/qa/uibase/fldui/fldui.cxx +++ b/sw/qa/uibase/fldui/fldui.cxx @@ -121,6 +121,26 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertRefmark) CPPUNIT_ASSERT_EQUAL(OUString("aaabbbccc"), pTextNode->GetText()); } +CPPUNIT_TEST_FIXTURE(Test, testTdf68364InsertConditionalFieldWithTwoDots) +{ + // Create an empty document + createSwDoc(); + SwDoc* pDoc = getSwDoc(); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + + // Insert a conditional field containing exactly two dots for its condition + SwFieldMgr aFieldMgr(pWrtShell); + SwInsertField_Data aFieldData(SwFieldTypesEnum::ConditionalText, 0, "true", "19.12.2023", 0); + CPPUNIT_ASSERT(aFieldMgr.InsertField(aFieldData)); + pWrtShell->SttEndDoc(true); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 19.12.2023 + // - Actual : + CPPUNIT_ASSERT_EQUAL(OUString("19.12.2023"), + pWrtShell->GetCurField()->ExpandField(true, nullptr)); +} + CPPUNIT_TEST_FIXTURE(Test, testInsertRefmarkSelection) { // Given a document with a single selected word: diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 37249555a0e4..ba5f45beceec 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -1389,9 +1389,6 @@ void SwHiddenTextField::Evaluate(SwDoc& rDoc) GetLanguage(), m_aContent, &fNumber ); m_bValid = true; } - else if( !sDBName.isEmpty() && !sDataSource.isEmpty() && - !sDataTableOrQuery.isEmpty() ) - m_bValid = true; } #endif }