From 36d7e21c00d59eead018ad8ef339847a782b9734 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Thu, 16 Mar 2017 21:35:05 +0100 Subject: add test for tdf#106242 Change-Id: I11f67c118617c78fa86b87afed87fcddba4e69e1 Reviewed-on: https://gerrit.libreoffice.org/35295 Tested-by: Jenkins Reviewed-by: Markus Mohrhard --- sc/qa/unit/ucalc.hxx | 2 ++ sc/qa/unit/ucalc_condformat.cxx | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) (limited to 'sc') diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index c48a25f126af..fb2390c1f5da 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -468,6 +468,7 @@ public: void testCondCopyPaste(); void testCondCopyPasteSingleCell(); //e.g. fdo#82503 void testCondCopyPasteSingleCellToRange(); //e.g. fdo#82503 + void testCondCopyPasteSingleRowToRange(); //e.g. tdf#106242 void testCondCopyPasteSheetBetweenDoc(); void testCondCopyPasteSheet(); void testIconSet(); @@ -745,6 +746,7 @@ public: CPPUNIT_TEST(testCondCopyPaste); CPPUNIT_TEST(testCondCopyPasteSingleCell); CPPUNIT_TEST(testCondCopyPasteSingleCellToRange); + CPPUNIT_TEST(testCondCopyPasteSingleRowToRange); CPPUNIT_TEST(testCondCopyPasteSheetBetweenDoc); CPPUNIT_TEST(testCondCopyPasteSheet); CPPUNIT_TEST(testCondFormatEndsWithStr); diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx index ee0d8abee066..0b0a8a2af97b 100644 --- a/sc/qa/unit/ucalc_condformat.cxx +++ b/sc/qa/unit/ucalc_condformat.cxx @@ -378,6 +378,39 @@ void Test::testCondCopyPasteSingleCellToRange() m_pDoc->DeleteTab(0); } +void Test::testCondCopyPasteSingleRowToRange() +{ + m_pDoc->InsertTab(0, "Test"); + + ScConditionalFormat* pFormat = new ScConditionalFormat(1, m_pDoc); + ScRange aCondFormatRange(0,0,0,0,0,0); + ScRangeList aRangeList(aCondFormatRange); + pFormat->SetRange(aRangeList); + + ScCondFormatEntry* pEntry = new ScCondFormatEntry(SC_COND_DIRECT,"=B2","",m_pDoc,ScAddress(0,0,0),ScGlobal::GetRscString(STR_STYLENAME_RESULT)); + pFormat->AddEntry(pEntry); + m_pDoc->AddCondFormat(pFormat, 0); + + ScDocument aClipDoc(SCDOCMODE_CLIP); + copyToClip(m_pDoc, ScRange(0,0,0,MAXCOL,0,0), &aClipDoc); + ScRange aTargetRange(0,4,0,MAXCOL,4,0); + pasteOneCellFromClip(m_pDoc, aTargetRange, &aClipDoc); + + std::set aCondFormatIndices; + + ScConditionalFormat* pNewFormat = m_pDoc->GetCondFormat(0, 4, 0); + CPPUNIT_ASSERT(pNewFormat); + CPPUNIT_ASSERT(pNewFormat->GetKey() != pFormat->GetKey()); + + for (SCCOL nCol = 1; nCol <= MAXCOL; ++nCol) + { + ScConditionalFormat* pNewFormat2 = m_pDoc->GetCondFormat(nCol, 4, 0); + CPPUNIT_ASSERT(!pNewFormat2); + } + + m_pDoc->DeleteTab(0); +} + void Test::testCondCopyPasteSheetBetweenDoc() { m_pDoc->InsertTab(0, "Test"); -- cgit