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
16cf6731
Kaydet (Commit)
16cf6731
authored
Eki 20, 2011
tarafından
Markus Mohrhard
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
improve unit test for UpdateReference
check InsertTabs/InsertTab/DeleteTabs too
üst
59b1f948
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
6 deletions
+51
-6
ucalc.cxx
sc/qa/unit/ucalc.cxx
+51
-6
No files found.
sc/qa/unit/ucalc.cxx
Dosyayı görüntüle @
16cf6731
...
...
@@ -237,7 +237,7 @@ public:
void
testAutofilter
();
void
testCopyPaste
();
void
testMergedCells
();
void
test
SheetDelet
e
();
void
test
UpdateReferenc
e
();
/**
* Make sure the sheet streams are invalidated properly.
...
...
@@ -282,7 +282,7 @@ public:
CPPUNIT_TEST
(
testAutofilter
);
CPPUNIT_TEST
(
testCopyPaste
);
CPPUNIT_TEST
(
testMergedCells
);
CPPUNIT_TEST
(
test
SheetDelet
e
);
CPPUNIT_TEST
(
test
UpdateReferenc
e
);
CPPUNIT_TEST_SUITE_END
();
private
:
...
...
@@ -2312,32 +2312,77 @@ void Test::testMergedCells()
m_pDoc
->
DeleteTab
(
0
);
}
void
Test
::
test
SheetDelet
e
()
void
Test
::
test
UpdateReferenc
e
()
{
//test that formulas are correctly updated during sheet delete
//TODO: add test cases for InsertTabs/InsertTab and DeleteTabs
//TODO: add tests for references to other sheets, relative references, updating of named ranges, ...
//TODO: maybe rename then to testUpdateReference
m_pDoc
->
InsertTab
(
0
,
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"Sheet1"
)));
m_pDoc
->
InsertTab
(
1
,
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"Sheet2"
)));
m_pDoc
->
InsertTab
(
2
,
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"Sheet3"
)));
rtl
::
OUString
aSheet1
(
RTL_CONSTASCII_USTRINGPARAM
(
"Sheet1"
));
rtl
::
OUString
aSheet2
(
RTL_CONSTASCII_USTRINGPARAM
(
"Sheet2"
));
rtl
::
OUString
aSheet3
(
RTL_CONSTASCII_USTRINGPARAM
(
"Sheet3"
));
rtl
::
OUString
aSheet4
(
RTL_CONSTASCII_USTRINGPARAM
(
"Sheet4"
));
m_pDoc
->
InsertTab
(
0
,
aSheet1
);
m_pDoc
->
InsertTab
(
1
,
aSheet2
);
m_pDoc
->
InsertTab
(
2
,
aSheet3
);
m_pDoc
->
InsertTab
(
3
,
aSheet4
);
m_pDoc
->
SetValue
(
0
,
0
,
2
,
1
);
m_pDoc
->
SetValue
(
1
,
0
,
2
,
2
);
m_pDoc
->
SetValue
(
1
,
1
,
3
,
4
);
m_pDoc
->
SetString
(
2
,
0
,
2
,
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"=A1+B1"
)));
m_pDoc
->
SetString
(
2
,
1
,
2
,
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"=Sheet4.B2+A1"
)));
double
aValue
;
m_pDoc
->
GetValue
(
2
,
0
,
2
,
aValue
);
CPPUNIT_ASSERT_MESSAGE
(
"formula does not return correct result"
,
aValue
==
3
);
m_pDoc
->
GetValue
(
2
,
1
,
2
,
aValue
);
CPPUNIT_ASSERT_MESSAGE
(
"formula does not return correct result"
,
aValue
==
5
);
//test deleting both sheets: one is not directly before the sheet, the other one is
m_pDoc
->
DeleteTab
(
0
);
m_pDoc
->
GetValue
(
2
,
0
,
1
,
aValue
);
CPPUNIT_ASSERT_MESSAGE
(
"after deleting first sheet formula does not return correct result"
,
aValue
==
3
);
m_pDoc
->
GetValue
(
2
,
1
,
1
,
aValue
);
CPPUNIT_ASSERT_MESSAGE
(
"after deleting first sheet formula does not return correct result"
,
aValue
==
5
);
m_pDoc
->
DeleteTab
(
0
);
m_pDoc
->
GetValue
(
2
,
0
,
0
,
aValue
);
CPPUNIT_ASSERT_MESSAGE
(
"after deleting second sheet formula does not return correct result"
,
aValue
==
3
);
m_pDoc
->
GetValue
(
2
,
1
,
0
,
aValue
);
CPPUNIT_ASSERT_MESSAGE
(
"after deleting second sheet formula does not return correct result"
,
aValue
==
5
);
//test adding two sheets
m_pDoc
->
InsertTab
(
0
,
aSheet2
);
m_pDoc
->
GetValue
(
2
,
0
,
1
,
aValue
);
CPPUNIT_ASSERT_MESSAGE
(
"after inserting first sheet formula does not return correct result"
,
aValue
==
3
);
m_pDoc
->
GetValue
(
2
,
1
,
1
,
aValue
);
CPPUNIT_ASSERT_MESSAGE
(
"after inserting first sheet formula does not return correct result"
,
aValue
==
5
);
m_pDoc
->
InsertTab
(
0
,
aSheet1
);
m_pDoc
->
GetValue
(
2
,
0
,
2
,
aValue
);
CPPUNIT_ASSERT_MESSAGE
(
"after inserting second sheet formula does not return correct result"
,
aValue
==
3
);
m_pDoc
->
GetValue
(
2
,
1
,
2
,
aValue
);
CPPUNIT_ASSERT_MESSAGE
(
"after inserting second sheet formula does not return correct result"
,
aValue
==
5
);
m_pDoc
->
DeleteTabs
(
0
,
2
);
m_pDoc
->
GetValue
(
2
,
0
,
0
,
aValue
);
CPPUNIT_ASSERT_MESSAGE
(
"after deleting sheets formula does not return correct result"
,
aValue
==
3
);
m_pDoc
->
GetValue
(
2
,
1
,
0
,
aValue
);
CPPUNIT_ASSERT_MESSAGE
(
"after deleting sheets formula does not return correct result"
,
aValue
==
5
);
std
::
vector
<
rtl
::
OUString
>
aSheets
;
aSheets
.
push_back
(
aSheet1
);
aSheets
.
push_back
(
aSheet2
);
m_pDoc
->
InsertTabs
(
0
,
aSheets
,
false
,
true
);
m_pDoc
->
GetValue
(
2
,
0
,
2
,
aValue
);
rtl
::
OUString
aFormula
;
m_pDoc
->
GetFormula
(
2
,
0
,
2
,
aFormula
);
std
::
cout
<<
"formel: "
<<
rtl
::
OUStringToOString
(
aFormula
,
RTL_TEXTENCODING_UTF8
).
getStr
()
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
<<
aValue
<<
std
::
endl
;
CPPUNIT_ASSERT_MESSAGE
(
"after inserting sheets formula does not return correct result"
,
aValue
==
3
);
m_pDoc
->
GetValue
(
2
,
1
,
2
,
aValue
);
CPPUNIT_ASSERT_MESSAGE
(
"after inserting sheets formula does not return correct result"
,
aValue
==
5
);
}
...
...
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