sw/qa/uibase/fldui/fldui.cxx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
New commits: commit 4c7a6870fca388288695d88622c517b30293e034 Author: Andreas Heinisch <[email protected]> AuthorDate: Mon Feb 2 01:43:27 2026 +0100 Commit: Andreas Heinisch <[email protected]> CommitDate: Mon Feb 2 07:55:46 2026 +0100 tdf#170392 - Align file name format constants with translate constants Automated test in order to check if the file name fields are the same after a reload. Change-Id: I6c67a8d84a044fe13b6dd81bd1f867422cbdaca0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198501 Reviewed-by: Andreas Heinisch <[email protected]> Tested-by: Jenkins diff --git a/sw/qa/uibase/fldui/fldui.cxx b/sw/qa/uibase/fldui/fldui.cxx index 28e54b52285c..7290dbff605a 100644 --- a/sw/qa/uibase/fldui/fldui.cxx +++ b/sw/qa/uibase/fldui/fldui.cxx @@ -138,6 +138,34 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf68364InsertConditionalFieldWithTwoDots) CPPUNIT_ASSERT_EQUAL(u"19.12.2023"_ustr, pWrtShell->GetCurField()->ExpandField(true, nullptr)); } +CPPUNIT_TEST_FIXTURE(Test, testTdf170392FilenameFormatConstants) +{ + // Create an empty document + createSwDoc(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + + // Insert a filename field containing SwFileNameFormat::Path + SwFieldMgr aFieldMgr(pWrtShell); + SwInsertField_Data aFieldData(SwFieldTypesEnum::Filename, 0, u""_ustr, u""_ustr, 3); + CPPUNIT_ASSERT(aFieldMgr.InsertField(aFieldData)); + + // First reload in order to get a value for the filename field + saveAndReload(TestFilter::ODT); + pWrtShell = getSwDocShell()->GetWrtShell(); + pWrtShell->SttEndDoc(true); + const auto aExpandedField = pWrtShell->GetCurField()->ExpandField(true, nullptr); + + // Second reload in order to check consistency for the filename field + saveAndReload(TestFilter::ODT); + pWrtShell = getSwDocShell()->GetWrtShell(); + pWrtShell->SttEndDoc(true); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: filename field is the same + // - Actual : filename field differ since the filename format constants differ + CPPUNIT_ASSERT_EQUAL(aExpandedField, pWrtShell->GetCurField()->ExpandField(true, nullptr)); +} + CPPUNIT_TEST_FIXTURE(Test, testInsertRefmarkSelection) { // Given a document with a single selected word:
