summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-01-03 11:16:40 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-01-03 15:32:49 +0100
commitcceb1e07569261d1828ce1fc08861b407486930b (patch)
tree078b7259a7b08ad3852ac87f47b56b575fb349de
parent00bcff6edd2dce657711fa517f35f14beebcaafd (diff)
CppunitTest_sc_subsequent_filters_test2: check format instead of string
Otherwise, this might fail. See 660e538ee77109bc3e7dff4491164d696e503abc < Disable broken part of ScFiltersTest2::testTdf126116 > Change-Id: I40534b70fc19ee163d9e6cb0c081fae40b81fdb9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127774 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--sc/qa/unit/subsequent_filters_test2.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx
index ca69e1f6e3b3..75db57388f41 100644
--- a/sc/qa/unit/subsequent_filters_test2.cxx
+++ b/sc/qa/unit/subsequent_filters_test2.cxx
@@ -21,6 +21,7 @@
#include <sfx2/docfilt.hxx>
#include <sfx2/docfile.hxx>
#include <svl/stritem.hxx>
+#include <svl/numformat.hxx>
#include <svl/zformat.hxx>
#include <svx/svdograf.hxx>
#include <svx/svxids.hrc>
@@ -1363,13 +1364,14 @@ void ScFiltersTest2::testTdf126116()
rDoc.SetString(ScAddress(0, 0, 0), "03/03");
- // Get the current year from B1 with format YY
- OUString aYear = rDoc.GetString(ScAddress(1, 0, 0));
+ sal_uInt32 nNumberFormat = rDoc.GetNumberFormat(0, 0, 0);
+ const SvNumberformat* pNumberFormat = rDoc.GetFormatTable()->GetEntry(nNumberFormat);
+ const OUString& rFormatStr = pNumberFormat->GetFormatstring();
// Without the fix in place, this test would have failed with
- // - Expected: 03/03/21
- // - Actual : 03/03/2021
- CPPUNIT_ASSERT_EQUAL(OUString("03/03/" + aYear), rDoc.GetString(ScAddress(0, 0, 0)));
+ // - Expected: MM/DD/YY
+ // - Actual : MM/DD/YYYY
+ CPPUNIT_ASSERT_EQUAL(OUString("MM/DD/YY"), rFormatStr);
xDocSh->DoClose();
}