sc/qa/unit/uicalc/uicalc2.cxx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
New commits: commit 227836ab20278ba7232d61ec14abe18b9132fdbe Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Tue Jan 9 16:24:50 2024 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Wed Jan 10 15:21:55 2024 +0100 tdf#158254: sc_uicalc2: Add unittest Change-Id: Ifc2bac24958cc0330d8174079886851ff1c0c990 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161834 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit ef6ff2df2e1286974da2f344aa3b8e3ae9093a79) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161854 (cherry picked from commit c9b7ead4cd0b74bdd4bbb364afc245c6299d74c9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161857 diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx index 36399e81a08b..d4f03213d4bd 100644 --- a/sc/qa/unit/uicalc/uicalc2.cxx +++ b/sc/qa/unit/uicalc/uicalc2.cxx @@ -13,6 +13,7 @@ #include <svx/svdpage.hxx> #include <vcl/keycodes.hxx> #include <vcl/scheduler.hxx> +#include <stlsheet.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/propertysequence.hxx> @@ -87,6 +88,30 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf150499) CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(1), pDoc->GetTableCount()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf158254) +{ + createScDoc(); + ScDocument* pDoc = getScDoc(); + + goToCell("A:G"); + dispatchCommand(mxComponent, + ".uno:StyleApply?Style:string=Accent%201&FamilyName:string=CellStyles", {}); + + const ScPatternAttr* pPattern = pDoc->GetPattern(5, 0, 0); + ScStyleSheet* pStyleSheet = const_cast<ScStyleSheet*>(pPattern->GetStyleSheet()); + + // Without the fix in place, this test would have failed with + // - Expected: Accent 1 + // - Actual : Default + CPPUNIT_ASSERT_EQUAL(OUString("Accent 1"), pStyleSheet->GetName()); + + dispatchCommand(mxComponent, ".uno:Undo", {}); + + pPattern = pDoc->GetPattern(5, 0, 0); + pStyleSheet = const_cast<ScStyleSheet*>(pPattern->GetStyleSheet()); + CPPUNIT_ASSERT_EQUAL(OUString("Default"), pStyleSheet->GetName()); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf133326) { createScDoc("tdf133326.ods");