Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
5971a8f1
Kaydet (Commit)
5971a8f1
authored
May 06, 2014
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#77944: Write test for this.
Change-Id: I0dae7533121d5501b35c289bd48ef8d139e37d3e
üst
5de854b4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
0 deletions
+54
-0
qahelper.cxx
sc/qa/unit/helper/qahelper.cxx
+4
-0
ucalc.cxx
sc/qa/unit/ucalc.cxx
+48
-0
ucalc.hxx
sc/qa/unit/ucalc.hxx
+2
-0
No files found.
sc/qa/unit/helper/qahelper.cxx
Dosyayı görüntüle @
5971a8f1
...
@@ -404,7 +404,11 @@ ScTokenArray* getTokens(ScDocument& rDoc, const ScAddress& rPos)
...
@@ -404,7 +404,11 @@ ScTokenArray* getTokens(ScDocument& rDoc, const ScAddress& rPos)
{
{
ScFormulaCell
*
pCell
=
rDoc
.
GetFormulaCell
(
rPos
);
ScFormulaCell
*
pCell
=
rDoc
.
GetFormulaCell
(
rPos
);
if
(
!
pCell
)
if
(
!
pCell
)
{
OUString
aStr
=
rPos
.
Format
(
SCA_VALID
);
cerr
<<
aStr
<<
" is not a formula cell."
<<
endl
;
return
NULL
;
return
NULL
;
}
return
pCell
->
GetCode
();
return
pCell
->
GetCode
();
}
}
...
...
sc/qa/unit/ucalc.cxx
Dosyayı görüntüle @
5971a8f1
...
@@ -3772,6 +3772,54 @@ void Test::testCopyPasteSkipEmptyConditionalFormatting()
...
@@ -3772,6 +3772,54 @@ void Test::testCopyPasteSkipEmptyConditionalFormatting()
m_pDoc->DeleteTab(0);
m_pDoc->DeleteTab(0);
}
}
void Test::testCutPasteRefUndo()
{
// Testing scenario: A2 references B2, and B2 gets cut and pasted onto C2,
// which updates A2's formula to reference C2. Then the paste action gets
// undone, which should also undo A2's formula to reference back to B2.
sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
m_pDoc->InsertTab(0, "Test");
// A2 references B2.
m_pDoc->SetString(ScAddress(0,1,0), "=B2");
ScMarkData aMark;
aMark.SelectOneTable(0);
// Set up clip document for cutting of B2.
ScDocument aClipDoc(SCDOCMODE_CLIP);
aClipDoc.ResetClip(m_pDoc, &aMark);
ScClipParam aParam(ScAddress(1,1,0), true);
aClipDoc.SetClipParam(aParam);
aClipDoc.SetValue(ScAddress(1,1,0), 12.0);
// Set up undo document for reference update.
ScDocument* pUndoDoc = new ScDocument(SCDOCMODE_UNDO);
pUndoDoc->InitUndo(m_pDoc, 0, 0);
// Do the pasting of 12 into C2. This should update A2 to reference C2.
m_pDoc->CopyFromClip(ScAddress(2,1,0), aMark, IDF_CONTENTS, pUndoDoc, &aClipDoc, true, false);
CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(0,1,0));
if (!checkFormula(*m_pDoc, ScAddress(0,1,0), "C2"))
CPPUNIT_FAIL("A2 should be referencing C2.");
// At this point, the ref undo document should contain a formula cell at A2 that references B2.
if (!checkFormula(*pUndoDoc, ScAddress(0,1,0), "B2"))
CPPUNIT_FAIL("A2 in the undo document should be referencing B2.");
ScUndoPaste aUndo(&getDocShell(), ScRange(ScAddress(2,1,0)), aMark, pUndoDoc, NULL, IDF_CONTENTS, NULL, false, NULL);
aUndo.Undo();
// Now A2 should be referencing B2 once again.
if (!checkFormula(*m_pDoc, ScAddress(0,1,0), "B2"))
CPPUNIT_FAIL("A2 should be referencing B2 after undo.");
m_pDoc->DeleteTab(0);
}
void Test::testUndoCut()
void Test::testUndoCut()
{
{
m_pDoc->InsertTab(0, "Test");
m_pDoc->InsertTab(0, "Test");
...
...
sc/qa/unit/ucalc.hxx
Dosyayı görüntüle @
5971a8f1
...
@@ -261,6 +261,7 @@ public:
...
@@ -261,6 +261,7 @@ public:
void
testCopyPasteMultiRange
();
void
testCopyPasteMultiRange
();
void
testCopyPasteSkipEmpty
();
void
testCopyPasteSkipEmpty
();
void
testCopyPasteSkipEmptyConditionalFormatting
();
void
testCopyPasteSkipEmptyConditionalFormatting
();
void
testCutPasteRefUndo
();
void
testUndoCut
();
void
testUndoCut
();
void
testMoveBlock
();
void
testMoveBlock
();
void
testCopyPasteRelativeFormula
();
void
testCopyPasteRelativeFormula
();
...
@@ -449,6 +450,7 @@ public:
...
@@ -449,6 +450,7 @@ public:
CPPUNIT_TEST
(
testCopyPasteMultiRange
);
CPPUNIT_TEST
(
testCopyPasteMultiRange
);
CPPUNIT_TEST
(
testCopyPasteSkipEmpty
);
CPPUNIT_TEST
(
testCopyPasteSkipEmpty
);
//CPPUNIT_TEST(testCopyPasteSkipEmptyConditionalFormatting);
//CPPUNIT_TEST(testCopyPasteSkipEmptyConditionalFormatting);
CPPUNIT_TEST
(
testCutPasteRefUndo
);
CPPUNIT_TEST
(
testUndoCut
);
CPPUNIT_TEST
(
testUndoCut
);
CPPUNIT_TEST
(
testMoveBlock
);
CPPUNIT_TEST
(
testMoveBlock
);
CPPUNIT_TEST
(
testCopyPasteRelativeFormula
);
CPPUNIT_TEST
(
testCopyPasteRelativeFormula
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment