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
f8399849
Kaydet (Commit)
f8399849
authored
Nis 24, 2012
tarafından
Markus Mohrhard
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add test case for copy&paste formulas between documents
üst
52d90ce0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
4 deletions
+42
-4
ucalc.cxx
sc/qa/unit/ucalc.cxx
+42
-4
No files found.
sc/qa/unit/ucalc.cxx
Dosyayı görüntüle @
f8399849
...
@@ -4262,16 +4262,24 @@ void Test::testCopyPasteFormulas()
...
@@ -4262,16 +4262,24 @@ void Test::testCopyPasteFormulas()
void
Test
::
testCopyPasteFormulasExternalDoc
()
void
Test
::
testCopyPasteFormulasExternalDoc
()
{
{
rtl
::
OUString
aDocName
(
"file:///source.fake"
);
SfxMedium
*
pMedium
=
new
SfxMedium
(
aDocName
,
STREAM_STD_READWRITE
);
m_xDocShRef
->
DoInitNew
(
pMedium
);
m_pDoc
=
m_xDocShRef
->
GetDocument
();
ScDocShellRef
xExtDocSh
=
new
ScDocShell
;
ScDocShellRef
xExtDocSh
=
new
ScDocShell
;
OUString
aExtDocName
(
RTL_CONSTASCII_USTRINGPARAM
(
"file:///extdata.fake"
));
OUString
aExtDocName
(
"file:///extdata.fake"
);
OUString
aExtSh1Name
(
RTL_CONSTASCII_USTRINGPARAM
(
"ExtSheet1"
));
OUString
aExtSh1Name
(
"ExtSheet1"
);
OUString
aExtSh2Name
(
RTL_CONSTASCII_USTRINGPARAM
(
"ExtSheet2"
));
OUString
aExtSh2Name
(
"ExtSheet2"
);
OUString
aExtSh3Name
(
RTL_CONSTASCII_USTRINGPARAM
(
"ExtSheet3"
));
SfxMedium
*
pMed
=
new
SfxMedium
(
aExtDocName
,
STREAM_STD_READWRITE
);
SfxMedium
*
pMed
=
new
SfxMedium
(
aExtDocName
,
STREAM_STD_READWRITE
);
xExtDocSh
->
DoInitNew
(
pMed
);
xExtDocSh
->
DoInitNew
(
pMed
);
CPPUNIT_ASSERT_MESSAGE
(
"external document instance not loaded."
,
CPPUNIT_ASSERT_MESSAGE
(
"external document instance not loaded."
,
findLoadedDocShellByName
(
aExtDocName
)
!=
NULL
);
findLoadedDocShellByName
(
aExtDocName
)
!=
NULL
);
ScDocument
*
pExtDoc
=
xExtDocSh
->
GetDocument
();
pExtDoc
->
InsertTab
(
0
,
aExtSh1Name
);
pExtDoc
->
InsertTab
(
1
,
aExtSh2Name
);
m_pDoc
->
InsertTab
(
0
,
"Sheet1"
);
m_pDoc
->
InsertTab
(
0
,
"Sheet1"
);
m_pDoc
->
InsertTab
(
1
,
"Sheet2"
);
m_pDoc
->
InsertTab
(
1
,
"Sheet2"
);
...
@@ -4280,7 +4288,37 @@ void Test::testCopyPasteFormulasExternalDoc()
...
@@ -4280,7 +4288,37 @@ void Test::testCopyPasteFormulasExternalDoc()
m_pDoc
->
SetString
(
0
,
2
,
0
,
"=$Sheet2.A1"
);
m_pDoc
->
SetString
(
0
,
2
,
0
,
"=$Sheet2.A1"
);
m_pDoc
->
SetString
(
0
,
3
,
0
,
"=$Sheet2.$A$1"
);
m_pDoc
->
SetString
(
0
,
3
,
0
,
"=$Sheet2.$A$1"
);
m_pDoc
->
SetString
(
0
,
4
,
0
,
"=$Sheet2.A$1"
);
m_pDoc
->
SetString
(
0
,
4
,
0
,
"=$Sheet2.A$1"
);
m_pDoc
->
SetString
(
0
,
5
,
0
,
"=$Sheet1.$A$1"
);
ScRange
aRange
(
0
,
0
,
0
,
0
,
5
,
0
);
ScClipParam
aClipParam
(
aRange
,
false
);
ScMarkData
aMark
;
aMark
.
SetMarkArea
(
aRange
);
ScDocument
*
pClipDoc
=
new
ScDocument
(
SCDOCMODE_CLIP
);
m_pDoc
->
CopyToClip
(
aClipParam
,
pClipDoc
,
&
aMark
);
sal_uInt16
nFlags
=
IDF_ALL
;
aRange
=
ScRange
(
1
,
1
,
1
,
1
,
6
,
1
);
ScMarkData
aMarkData2
;
aMarkData2
.
SetMarkArea
(
aRange
);
pExtDoc
->
CopyFromClip
(
aRange
,
aMarkData2
,
nFlags
,
NULL
,
pClipDoc
);
rtl
::
OUString
aFormula
;
pExtDoc
->
GetFormula
(
1
,
1
,
1
,
aFormula
);
//adjust absolute refs pointing to the copy area
CPPUNIT_ASSERT_EQUAL
(
aFormula
,
rtl
::
OUString
(
"=COLUMN($B$2)"
));
pExtDoc
->
GetFormula
(
1
,
2
,
1
,
aFormula
);
//adjust absolute refs and keep relative refs
CPPUNIT_ASSERT_EQUAL
(
aFormula
,
rtl
::
OUString
(
"=$B$2+C3"
));
pExtDoc
->
GetFormula
(
1
,
3
,
1
,
aFormula
);
// make absolute sheet refs external refs
CPPUNIT_ASSERT_EQUAL
(
aFormula
,
rtl
::
OUString
(
"='file:///source.fake'#$Sheet2.B2"
));
pExtDoc
->
GetFormula
(
1
,
4
,
1
,
aFormula
);
CPPUNIT_ASSERT_EQUAL
(
aFormula
,
rtl
::
OUString
(
"='file:///source.fake'#$Sheet2.$A$1"
));
pExtDoc
->
GetFormula
(
1
,
5
,
1
,
aFormula
);
CPPUNIT_ASSERT_EQUAL
(
aFormula
,
rtl
::
OUString
(
"='file:///source.fake'#$Sheet2.B$1"
));
pExtDoc
->
GetFormula
(
1
,
6
,
1
,
aFormula
);
CPPUNIT_ASSERT_EQUAL
(
aFormula
,
rtl
::
OUString
(
"=$ExtSheet2.$B$2"
));
}
}
CPPUNIT_TEST_SUITE_REGISTRATION
(
Test
);
CPPUNIT_TEST_SUITE_REGISTRATION
(
Test
);
...
...
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