sc/qa/unit/ucalc.cxx           |   58 +++++++++++++++++++++++++++++++++++++++
 sc/qa/unit/ucalc_copypaste.cxx |   60 -----------------------------------------
 2 files changed, 58 insertions(+), 60 deletions(-)

New commits:
commit 7d48438750068ec9fa0ed5703d2340fc737aa201
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Jul 30 13:17:12 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Jul 30 15:59:07 2024 +0200

    CppunitTest_sc_ucalc: these tests are not related to copy/paste at all
    
    Change-Id: I044443fd0f259f326476dc657c505b8934922d99
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171240
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index c5c83476fe5a..03842326f809 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -111,6 +111,64 @@ CPPUNIT_TEST_FIXTURE(Test, testCollator)
     CPPUNIT_ASSERT_MESSAGE("these strings are supposed to be different!", nRes 
!= 0);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testUndoBackgroundColor)
+{
+    m_pDoc->InsertTab(0, u"Table1"_ustr);
+
+    ScMarkData aMark(m_pDoc->GetSheetLimits());
+
+    // Set Values to B1, C2, D5
+    m_pDoc->SetValue(ScAddress(1, 0, 0), 1.0); // B1
+    m_pDoc->SetValue(ScAddress(2, 1, 0), 2.0); // C2
+    m_pDoc->SetValue(ScAddress(3, 4, 0), 3.0); // D5
+
+    // Add patterns
+    ScPatternAttr aCellBlueColor(m_pDoc->getCellAttributeHelper());
+    aCellBlueColor.GetItemSet().Put(SvxBrushItem(COL_BLUE, ATTR_BACKGROUND));
+    m_pDoc->ApplyPatternAreaTab(0, 3, m_pDoc->MaxCol(), 3, 0, aCellBlueColor);
+
+    // Insert a new row at row 3
+    ScRange aRowOne(0, 2, 0, m_pDoc->MaxCol(), 2, 0);
+    aMark.SetMarkArea(aRowOne);
+    ScDocFunc& rFunc = m_xDocShell->GetDocFunc();
+    rFunc.InsertCells(aRowOne, &aMark, INS_INSROWS_BEFORE, true, true);
+
+    // Check patterns
+    const SfxPoolItem* pItem = nullptr;
+    m_pDoc->GetPattern(ScAddress(1000, 4, 
0))->GetItemSet().HasItem(ATTR_BACKGROUND, &pItem);
+    CPPUNIT_ASSERT(pItem);
+    CPPUNIT_ASSERT_EQUAL(COL_BLUE, static_cast<const 
SvxBrushItem*>(pItem)->GetColor());
+
+    // Undo the new row
+    m_pDoc->GetUndoManager()->Undo();
+
+    // Check patterns
+    // Failed if row 3 is not blue all the way through
+    pItem = nullptr;
+    m_pDoc->GetPattern(ScAddress(1000, 3, 
0))->GetItemSet().HasItem(ATTR_BACKGROUND, &pItem);
+    CPPUNIT_ASSERT(pItem);
+    CPPUNIT_ASSERT_EQUAL(COL_BLUE, static_cast<const 
SvxBrushItem*>(pItem)->GetColor());
+
+    m_pDoc->DeleteTab(0);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testMergedHyperlink)
+{
+    m_pDoc->InsertTab(0, u"Table1"_ustr);
+    m_pDoc->InitDrawLayer(m_xDocShell.get());
+
+    ScFieldEditEngine& pEE = m_pDoc->GetEditEngine();
+    pEE.SetTextCurrentDefaults(u"https://libreoffice.org/"_ustr);
+    m_pDoc->SetEditText(ScAddress(1, 0, 0), pEE.CreateTextObject()); // B1
+
+    m_pDoc->DoMergeContents(0, 0, 1, 0, 0); // A1:B1
+
+    CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, m_pDoc->GetCellType(ScAddress(0, 0, 
0))); // A1
+    const EditTextObject* pEditObj = m_pDoc->GetEditText(ScAddress(0, 0, 0)); 
// A1
+    CPPUNIT_ASSERT(pEditObj);
+    CPPUNIT_ASSERT_EQUAL(u"https://libreoffice.org/"_ustr, 
pEditObj->GetText(0));
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testSharedStringPool)
 {
     m_pDoc->InsertTab(0, u"foo"_ustr);
diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx
index 299182d794f2..cba06db1de22 100644
--- a/sc/qa/unit/ucalc_copypaste.cxx
+++ b/sc/qa/unit/ucalc_copypaste.cxx
@@ -26,7 +26,6 @@
 #include <refundo.hxx>
 #include <scitems.hxx>
 #include <scopetools.hxx>
-#include <undomanager.hxx>
 
 #include <sfx2/docfile.hxx>
 
@@ -10649,65 +10648,6 @@ CPPUNIT_TEST_FIXTURE(TestCopyPaste, 
testCopyPasteMatrixFormula)
     m_pDoc->DeleteTab(0);
 }
 
-CPPUNIT_TEST_FIXTURE(TestCopyPaste, testUndoBackgroundColor)
-{
-    m_pDoc->InsertTab(0, u"Table1"_ustr);
-
-    ScDocument aClipDoc(SCDOCMODE_CLIP);
-    ScMarkData aMark(m_pDoc->GetSheetLimits());
-
-    // Set Values to B1, C2, D5
-    m_pDoc->SetValue(ScAddress(1, 0, 0), 1.0); // B1
-    m_pDoc->SetValue(ScAddress(2, 1, 0), 2.0); // C2
-    m_pDoc->SetValue(ScAddress(3, 4, 0), 3.0); // D5
-
-    // Add patterns
-    ScPatternAttr aCellBlueColor(m_pDoc->getCellAttributeHelper());
-    aCellBlueColor.GetItemSet().Put(SvxBrushItem(COL_BLUE, ATTR_BACKGROUND));
-    m_pDoc->ApplyPatternAreaTab(0, 3, m_pDoc->MaxCol(), 3, 0, aCellBlueColor);
-
-    // Insert a new row at row 3
-    ScRange aRowOne(0, 2, 0, m_pDoc->MaxCol(), 2, 0);
-    aMark.SetMarkArea(aRowOne);
-    ScDocFunc& rFunc = m_xDocShell->GetDocFunc();
-    rFunc.InsertCells(aRowOne, &aMark, INS_INSROWS_BEFORE, true, true);
-
-    // Check patterns
-    const SfxPoolItem* pItem = nullptr;
-    m_pDoc->GetPattern(ScAddress(1000, 4, 
0))->GetItemSet().HasItem(ATTR_BACKGROUND, &pItem);
-    CPPUNIT_ASSERT(pItem);
-    CPPUNIT_ASSERT_EQUAL(COL_BLUE, static_cast<const 
SvxBrushItem*>(pItem)->GetColor());
-
-    // Undo the new row
-    m_pDoc->GetUndoManager()->Undo();
-
-    // Check patterns
-    // Failed if row 3 is not blue all the way through
-    pItem = nullptr;
-    m_pDoc->GetPattern(ScAddress(1000, 3, 
0))->GetItemSet().HasItem(ATTR_BACKGROUND, &pItem);
-    CPPUNIT_ASSERT(pItem);
-    CPPUNIT_ASSERT_EQUAL(COL_BLUE, static_cast<const 
SvxBrushItem*>(pItem)->GetColor());
-
-    m_pDoc->DeleteTab(0);
-}
-
-CPPUNIT_TEST_FIXTURE(TestCopyPaste, testMergedHyperlink)
-{
-    m_pDoc->InsertTab(0, u"Table1"_ustr);
-    m_pDoc->InitDrawLayer(m_xDocShell.get());
-
-    ScFieldEditEngine& pEE = m_pDoc->GetEditEngine();
-    pEE.SetTextCurrentDefaults(u"https://libreoffice.org/"_ustr);
-    m_pDoc->SetEditText(ScAddress(1, 0, 0), pEE.CreateTextObject()); // B1
-
-    m_pDoc->DoMergeContents(0, 0, 1, 0, 0); // A1:B1
-
-    CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, m_pDoc->GetCellType(ScAddress(0, 0, 
0))); // A1
-    const EditTextObject* pEditObj = m_pDoc->GetEditText(ScAddress(0, 0, 0)); 
// A1
-    CPPUNIT_ASSERT(pEditObj);
-    CPPUNIT_ASSERT_EQUAL(u"https://libreoffice.org/"_ustr, 
pEditObj->GetText(0));
-}
-
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to