sc/qa/unit/subsequent_filters-test2.cxx |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit d5f36648643399ad63006a97a1f58b81690ccddf
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Jan 3 11:16:40 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Jan 4 12:32:19 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/+/127774
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127776

diff --git a/sc/qa/unit/subsequent_filters-test2.cxx 
b/sc/qa/unit/subsequent_filters-test2.cxx
index 18a571e08537..35ad23deba54 100644
--- a/sc/qa/unit/subsequent_filters-test2.cxx
+++ b/sc/qa/unit/subsequent_filters-test2.cxx
@@ -1365,13 +1365,15 @@ 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, nNumberFormat);
+    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();
 }

Reply via email to