sc/qa/unit/subsequent_filters_test2.cxx |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

New commits:
commit f6fefed87a3ffac4a8d236e6a96a6405bfbb31f0
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Jan 3 11:16:40 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Jan 3 14:31:53 2022 +0100

    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/+/127887
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/qa/unit/subsequent_filters_test2.cxx 
b/sc/qa/unit/subsequent_filters_test2.cxx
index 6055b286f330..4852c1006b13 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>
@@ -1366,14 +1367,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
-    (void)
-        aYear; //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();
 }

Reply via email to