[Libreoffice-commits] core.git: sc/qa sc/source
scito (via logerrit)
logerrit at kemper.freedesktop.org
Fri May 7 07:21:32 UTC 2021
sc/qa/unit/uicalc/uicalc.cxx | 39 ++++++++++++++++++++++++++++++++++-----
sc/source/ui/view/cellsh1.cxx | 2 ++
2 files changed, 36 insertions(+), 5 deletions(-)
New commits:
commit 7b450b6ccd9f9bee0bb47500e7bf71f9ba641e36
Author: scito <info at scito.ch>
AuthorDate: Thu May 6 20:33:48 2021 +0200
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri May 7 09:20:54 2021 +0200
tdf#102255 improve test and docu of .uno:PasteTransposed
check that relevant types, notes and attributes are pasted,
i.e. the uno command sets the right parameters
Improvement of my former commit
02b72784e5601636d26c8e4592958c262efb1a7d
Change-Id: I1d8e7d09a867bbabe719bcdd8c7e908ab100aa4c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115191
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 2dff22da94b0..abd9ad47646e 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -521,8 +521,25 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testPasteTransposed)
CPPUNIT_ASSERT(pDoc);
insertStringToCell(*pModelObj, "A1", "1");
- insertStringToCell(*pModelObj, "A2", "2");
- insertStringToCell(*pModelObj, "A3", "3");
+ insertStringToCell(*pModelObj, "A2", "a");
+ insertStringToCell(*pModelObj, "A3", "=A1");
+
+ // Add a note to A1
+ goToCell("A1");
+ uno::Sequence<beans::PropertyValue> aArgs
+ = comphelper::InitPropertySequence({ { "Text", uno::makeAny(OUString("Note in A1")) } });
+ dispatchCommand(mxComponent, ".uno:InsertAnnotation", aArgs);
+
+ // Set A2 bold
+ goToCell("A2");
+ dispatchCommand(mxComponent, ".uno:Bold", {});
+
+ // Check preconditions
+ CPPUNIT_ASSERT_MESSAGE("There should be a note on A1", pDoc->HasNote(ScAddress(0, 0, 0)));
+ const ScPatternAttr* pPattern = pDoc->GetPattern(0, 1, 0);
+ vcl::Font aFont;
+ pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, aFont.GetWeight());
goToCell("A1:A3");
@@ -539,9 +556,21 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testPasteTransposed)
dispatchCommand(mxComponent, ".uno:PasteTransposed", {});
- CPPUNIT_ASSERT_EQUAL(OUString("1"), pDoc->GetString(ScAddress(0, 0, 0))); // A1
- CPPUNIT_ASSERT_EQUAL(OUString("2"), pDoc->GetString(ScAddress(1, 0, 0))); // B1
- CPPUNIT_ASSERT_EQUAL(OUString("3"), pDoc->GetString(ScAddress(2, 0, 0))); // C1
+ OUString aFormula;
+ CPPUNIT_ASSERT_EQUAL(OUString("1"), pDoc->GetString(0, 0, 0)); // A1
+ CPPUNIT_ASSERT_EQUAL(1.0, pDoc->GetValue(0, 0, 0)); // A1
+ CPPUNIT_ASSERT_EQUAL(OUString("a"), pDoc->GetString(1, 0, 0)); // B1
+ pDoc->GetFormula(2, 0, 0, aFormula); // C1
+ CPPUNIT_ASSERT_EQUAL(OUString("=A1"), aFormula); // C1
+ CPPUNIT_ASSERT_EQUAL(OUString("1"), pDoc->GetString(2, 0, 0)); // C1
+ CPPUNIT_ASSERT_EQUAL(1.0, pDoc->GetValue(2, 0, 0)); // C1
+
+ CPPUNIT_ASSERT_MESSAGE("There should be a note on A1", pDoc->HasNote(ScAddress(0, 0, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("Note in A1"), pDoc->GetNote(ScAddress(0, 0, 0))->GetText());
+
+ pPattern = pDoc->GetPattern(1, 0, 0);
+ pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, aFont.GetWeight());
}
CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf131442)
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index efa1e4dae4c8..f7abd1908f1a 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1517,6 +1517,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
ScTabViewShell::GetClipData(GetViewData().GetActiveWin()))) // own cell data
{
rReq.SetSlot(FID_INS_CELL_CONTENTS);
+ // By default content (values/numbers, strings, formulas and dates),
+ // attributes and notes are pasted
rReq.AppendItem(SfxBoolItem(FN_PARAM_3, true)); // transpose
ExecuteSlot(rReq, GetInterface());
rReq.SetReturnValue(SfxInt16Item(nSlot, 1)); // 1 = success
More information about the Libreoffice-commits
mailing list